ok

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/sepolicy/
Upload File :
Current File : //usr/lib64/python2.7/site-packages/sepolicy/interface.pyc

�
4��]c	@slddlZddlZddlZdZdZdddddd	d
ddg	Zd
ZddlZejed�ej	e�yej
ededd�WnSek
r�ej
edddd�n*e
k
r�ddlZeejd<nXd�Zdd�Zdd�Zdd�Zdadd�Zdd�Zd�Zdd�Zd�Zdd �ZdS(!i����Ns_admin$s_role$tget_all_interfacestget_interfaces_from_xmlt	get_admintget_usertget_interface_dicttget_interface_format_textt!get_interface_compile_format_texttget_xml_filetinterface_compile_testtpolicycoreutilss/usr/share/localetunicodetcodesetsutf-8t	localedirt_cCs@g}t|�}x't|j��D]}|j|�q%W|S(s' Get all interfaces from given xml file(Rtlisttkeystappend(tpathtinterfaces_listtidicttk((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyR6s
tcCsDddlm}g}|s(|�}nt|�}t|�}|S(Ni����(tget_methods(tsepolicyRRR(RRtall_interfacestxml_path((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyR?scCs�g}|r�yXt|�}t|�}x9t|j��D]%}|jd�r:|j|�q:q:WWq�tk
r�}tjj	d|j
jt|�f�tj
d�q�XnCx@tj�D]2}|jd�r�|j|jd�d�q�q�W|S(s? Get all domains with an admin interface from installed policy.t_admins%s: %s
ii(RRRRtendswithRtIOErrortsyststderrtwritet	__class__t__name__tstrtexitRRtsplit(Rt
admin_listRRRteti((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyRKs&!cCsAg}|r�yut|�}t|�}xVt|j��D]B}|jd�r:d|d tj�kr||j|�q|q:q:WWq=tk
r�}t	j
jd|jj
t|�f�t	jd�q=Xnpxmtj�D]_}tjdt|�}t|�dkr�d|dtj�kr9|j|d�q9q�q�W|S(s1 Get all domains with SELinux user role interfacet_roles	%s_exec_ti����s%s: %s
is(.*)%si(RRRRRRt
get_all_typesRRRRRR R!R"R#RtretfindalltUSER_TRANSITION_INTERFACEtlen(Rt
trans_listRRRR&R'tm((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyRas$&s#/usr/share/selinux/devel/policy.xmlc
Cs)ddl}ddl}ddlm}m}tr8tSg}iag}|�}|dkrvtd�GH|�}nd}||7}|d7}y|jj	|�r�|j
jj|�}n|j
jj
|�}x9|jd�D](}	x|	jd�D]}
|
jd�|kr�xu|
jd	�D]d}x-|jd
�D]}|j|jd��q9W||jd�jd	gt|jd�<g}q#Wxx|
jd�D]d}x-|jd
�D]}|j|jd��q�W||jd�jdgt|jd�<g}q�Wq�q�Wq�WWntk
r$}nXtS(
Ni����(tget_all_modulestget_all_modules_from_mod_lstsUsing only non-base modules.sZ<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<policy>
<layer name="admin">
s
</layer>
</policy>
tlayertmoduletnamet	interfacetparamtsummaryttemplate(tostxml.etree.ElementTreeRR0R1tinterface_dicttNoneR
RtisfiletetreetElementTreetparset
fromstringR+tgettgetiteratorRtfindttextR(
RR9txmlR0R1tactive_modulest
param_listRttreetlR/R'R&((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyR|sH	
(
(cCsNt|�}d|dj||d�dj||djd��f}|S(Ns	%s(%s) %ss, it is
(RtjoinR$(R5RRtinterface_text((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyR�s>cCs`ddlm}g}xC||dD]3}|j|j|�d|dj|�f}q%W|S(Ni(ttest_moduleis%s(%s)
s, (t	templatesRNRtdict_valuesRL(tinterfaces_dictR5RNt	param_tmpR'RM((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyR�stcompiletestcCsIddlm}d}|tjd||j�7}|t||�7}|S(Ni(RNRtTEMPLATETYPE(RORNR*tsubtte_test_moduleR(R5RR4RNtte((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pytgenerate_compile_te�s
cCs�ddl}ddl}|jj|�d}|jj|�jd�d}y.|jd||d|jdt�}|SWnF|j	k
r�}t
jjd	�t
jj|j
�t
jd
�nXdS(s; Returns xml format of interfaces for given .if policy filei����Nt/t.isDpython /usr/share/selinux/devel/include/support/segenxml.py -w -m %sRtshells-
 Could not proceed selected interface file.
i(R9t
subprocessRtdirnametbasenameR$tcheck_outputtSTDOUTtTruetCalledProcessErrorRRRtoutputR#(tif_fileR9R\tbasedirtfilenameRcR&((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyR�s		cCs�dddddg}dg}dg}ddl}ddl}id	d
6dd6d
d6dd6}t|�}||kp�|jd�d|kp�||d|ks�td|�GHy�t|dd�}	|	jt||��|	j�y(|j	d|d
d|j
dt�WnC|jk
rX}
t
jjtd�|�t
jj|
j�nXWn3tk
r�}
t
jjtd�||
f�nXxYt|j��D](}|jj|�r�|j|�q�q�Wnt
jjtd|��dS(Ntuserdomtkerneltcorenettfilestdevtselinux_genboolR8i����scompiletest.pptppscompiletest.teRWscompiletest.fctfcscompiletest.iftifR
iisCompiling %s interfacetws,make -f /usr/share/selinux/devel/Makefile %sRR[s
Compile test for %s failed.
s%
Compile test for %s has not run. %s
s,
Compiling of %s interface is not supported.(R\R9RR$R
topenRRXtcloseR_R`RaRbRRRctEnvironmentErrorRtvaluesRtexiststremove(R5Rtexclude_interfacestexclude_interface_nametexclude_interface_typeR\R9tpolicy_filesRtfdR&tv((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyR�s4		"9
	$(R*RRtADMIN_TRANSITION_INTERFACER,t__all__tPROGNAMEtgettexttbindtextdomaint
textdomaintinstallRat	TypeErrorRtbuiltinsR
t__dict__RRRRR<R;RRRRXRR(((s8/usr/lib64/python2.7/site-packages/sepolicy/interface.pyt<module>s>!



		2	
		

Zerion Mini Shell 1.0