+
    	:i   c                   s   ^ RI t ^ RIt^ RItRtRt. ROtRt ^ RIt/ t]P                  R8  d   R]R&   ]P                  ! ]3RR/]BR	R/B t]P                  tR tRR ltRR ltRR ltRsRR ltRR ltR tRR ltR tRR ltR#     ^ RIt]]P                  R
&    LH  ] d    ^ RIt]]P                  R
&     Lei ; i; i)    Nz_admin$z_role$zselinux-pythonTunicodeZ	localedirz/usr/share/localeZfallback_c                sp    . p\        V 4      pVP                  4        F  pVP                  V4       K  	  V# )z&Get all interfaces from given xml file)get_interface_dictkeysappend)pathZinterfaces_listidictk   &   7/usr/lib/python3.14/site-packages/sepolicy/interface.pyget_interfaces_from_xmlr   5   s5    Ot$EZZ\q!     c                 sd    ^ RI Hp . pV '       g
   V! 4       pV# \        V 4      p\        V4      pV# )r    )get_methods)sepolicyr   get_xml_filer   )r   r   Zall_interfacesxml_pathr	   r
   get_all_interfacesr   >   s8    $N$
   %0:r   c                sn    . pV '       d[    \        V 4      p\        V4      pVP                  4        F-  pVP                  R4      '       g   K  VP	                  V4       K/  	  V# \        P                  ! 4        FC  pVP                  R4      '       g   K  VP	                  VP                  R4      ^ ,          4       KE  	  V#   \
         df   p\        P                  P                  TP                  P                  : R\        T4      : R24       \        P                  ! ^4        Rp?T# Rp?ii ; i)z>Get all domains with an admin interface from installed policy.Z_admin: 
N)r   r   r   endswithr   IOErrorsysstderrwrite	__class____name__strexitr   r   split)r   Z
admin_listr   r   r   ei   &      r
   	get_adminr!   J   s    \J	#D)H&x0EZZ\::h''%%a( " 	 %%'Azz(##!!!''("3A"67 (   	JJ1;;+?+?QHIHHQKK 	s   =C C D4AD//D4c                s&    . pV '       d    \        V 4      p\        V4      pVP                  4        FS  pVP                  R4      '       g   K  RVRR ,          \        P
                  ! 4       9   g   KB  VP                  V4       KU  	  V# \        P                  ! 4        Fy  p\         P"                  ! R\$        ,          V4      p\'        V4      ^ 8  g   K7  RV^ ,          ,          \        P
                  ! 4       9   g   Ka  VP                  V^ ,          4       K{  	  V#   \         df   p\        P                  P                  TP                  P                  : R\        T4      : R24       \        P                  ! ^4        Rp?T# Rp?ii ; i)z0Get all domains with SELinux user role interfaceZ_rolez	%s_exec_tNr   r   z(.*)%si)r   r   r   r   r   Zget_all_typesr   r   r   r   r   r   r   r   r   r   refindallUSER_TRANSITION_INTERFACEZlen)r   Z
trans_listr   r   r   r   r   ms   &       r
   get_userr&   `   s-   `J		#D)H&x0EZZ\::g&&$q"v-(2H2H2JJ"))!, "  %%'A

8&??CA1vz1%)?)?)AA%%ad+	 (   	JJ1;;+?+?QHIHHQKK 	s$   =D  !D  5D   F+AFFc           	      s   ^ RI p^ RIp\        '       d   \        # / s. pRpW@,          pVR,          p VP                  P	                  V 4      '       d'   VP
                  P                  P                  V 4      pM%VP
                  P                  P                  V4      pVP                  R4       EF(  pVP                  R4       EF  pVP                  R4       Fp  pVP                  R4       F#  p	VP                  V	P                  R4      4       K%  	  W8P                  R	4      P                  R.\        VP                  R4      &   . pKr  	  VP                  R
4       Fp  pVP                  R4       F#  p	VP                  V	P                  R4      4       K%  	  W8P                  R	4      P                  R
.\        VP                  R4      &   . pKr  	  EK  	  EK+  	  \        #   \         d	     \        # i ; i)r    NzZ<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<policy>
<layer name="admin">
z
</layer>
</policy>
ZlayerZmodule	interfaceZparamnameZsummarytemplate)osZxml.etree.ElementTreeinterface_dictr   ZisfileZetreeZElementTreeZparseZ
fromstringr#   Ziterr   ZgetZfindZtextr   )
r   r*   ZxmlZ
param_listr   ZtreeZlr%   r   r   s
   &         r
   r   r   {   s    ~NJH H  H
77>>$99((..t4D99((33H=Dg&AYYx(,AYYw/"))!%%-8 07AFF9DUDZDZ]h6iNAEE&M3!#J	 -
 
+AYYw/"))!%%-8 07AFF9DUDZDZ]g6hNAEE&M3!#J	 , ) '   s   F*G# #G65G6c           	      s    \        V4      pV : R RP                  W ,          ^ ,          4      : RRP                  W ,          ^,          P                  R4      4      : 2pV# )(, z) Z r   )r   joinr   )r'   r   r   interface_texts   &&  r
   get_interface_format_textr0      sN    t$E$-tyy9I!9L/MsxxX]XhijXkXqXqrvXwOxyNr   c                 s    ^RI Hp . pW,          ^ ,           F>  pVP                  VP                  V,          4       V: RRP	                  V4      : R2pK@  	  X# )   test_moduler,   r-   z)
)	templatesr3   r   Zdict_valuesr.   )Zinterfaces_dictr'   r3   Z	param_tmpr   r/   s   &&    r
   !get_interface_compile_format_textr5      sS    &I'**0034'0$))I2FG + r   c                 s    ^RI Hp RpV\        P                  ! RW#P                  4      ,          pV\        W4      ,          pV# )r1   r2    ZTEMPLATETYPE)r4   r3   r"   ZsubZte_test_moduler5   )r'   r   r(   r3   tes   &&&  r
   generate_compile_ter8      s:    &	B"&&'A'A
BBB
+E
==BIr   c                s   ^ RI p ^ RIHp VP
                  P                  V 4      R,           pVP
                  P                  V 4      P                  R4      ^ ,          pV! RW4,           ,          4      w  rVV^ 8w  d^   \        P                  P                  R4       \        P                  P                  RV,          4       \        P                  ! ^4       R# V#   \         d
    ^ RIHp  Li ; i)z:Returns xml format of interfaces for given .if policy fileNgetstatusoutputZ/Z.zN/usr/bin/python3 /usr/share/selinux/devel/include/support/segenxml.py -w -m %sz-
 Could not process selected interface file.
z
%s)r*   commandsr:   ImportError
subprocessr   ZdirnameZbasenamer   r   r   r   r   )Zif_filer*   r:   ZbasedirZfilenamercoutputr    r
   r   r      s    /, ggoog&,Gww(..s3A6H !qu|  vH  "I  JJB	Qw

JK

&)  /./s   C C0/C0c                 s   . ROpR.p ^ RI Hp ^ RIpRRRRRR	R
R/p\        V4      pV P                  R4      ^ ,          V9   Eg)   Wp,          ^,          V9   Eg   \        \        R4      V ,          4        \        VR,          R4      pVP                  \        W4      4       VP                  4        V! RVR,          ,          4      w  rV	^ 8w  dO   \        P                  P                  V
4       \        P                  P                  \        R4      V ,          4       TP!                  4        F7  pTP"                  P%                  T4      '       g   K&  TP'                  T4       K9  	  R# \        P                  P                  \        R4      V ,          4       R#   \         d    ^ RIHp  ELi ; i  \         d;   p\        P                  P                  \        R4      Y3,          4        Rp?LRp?ii ; i)userdomr)   r9   NZppzcompiletest.ppr7   zcompiletest.teZfczcompiletest.fcZifzcompiletest.ifr   zCompiling %s interfaceZwz,make -f /usr/share/selinux/devel/Makefile %sz
Compile test for %s failed.
z%
Compile test for %s has not run. %s
z,
Compiling of %s interface is not supported.)r@   ZkernelZcorenetZfilesZdev)r;   r:   r<   r=   r*   r   r   Zprintr   Zopenr   r8   Zcloser   r   ZEnvironmentErrorZvaluesr   ZexistsZremove)r'   r   Zexclude_interfacesZexclude_interface_typer:   r*   Zpolicy_filesr   Zfdr>   r?   r   Zvs   &&           r
   interface_compile_testrA      s   I(\/, *D2BDJZ\`brsLt$EOOC #'99U=Ma=PTj=ja()I56
	\l4(#.BHH(:;HHJ()WZfgkZl)lmJBQw

  (

  #D!E	!QR $$&Aww~~a  		! '
 	

JKiWX1  /../"   	\JJQHIYNZ[[	\s*   F 7B*F7 F43F47G<0G77G<)	r   r   r!   r&   r   r0   r5   r   rA   )i   )r6   )z#/usr/share/selinux/devel/policy.xml)Zcompiletest)r"   r   r   ZADMIN_TRANSITION_INTERFACEr$   Z__all__ZPROGNAMEZgettextZkwargsZversion_infoZtranslationZtr   Zbuiltinsr   Z__dict__r<   Z__builtin__r   r   r   r!   r&   r+   r   r0   r5   r8   r   rA   ) r   r
   <module>rB      s  , 
 
 & $  W
 ,F
$ yH 	#1	#	# "	#A 	
		A	,0 'T$YK,,!$# ,$+S!,s*   AB	 	CB!!B?;C>B??C