+
        ȸ                       ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI5 Rt	^ RI
t
^ RIHt ^ RIHt ^ RIt ^ RIt/ t]P$                  RM8  d   R]R&   ]P&                  ! ]	3RR	/]BR
R/B t]P                   t^ RIt/ t]]R&   ]]R&   ]]R&   ]]R&   ]]R&   ]]R&   ] ]R&   ] ]R&   ] ]R&   ]!]R&   ]!]R&   ]!]R&   ]"]R&   ]"]R&   ]"]R&   ]#]R&   ]#]R&   ]#]R&   ]$]R&   ]$]R&   ]$]R &   ]%]R!&   ]%]R"&   ]%]R#&   RRRRRRRRRRRRR RR#R!/t&RR$RR$RR%RR&RR'RR(RR)R!R*RR/	t' ^ RI(t(](PR                  ! ](PT                  ! 4       4        ! R+ R,4      t+ ! R. R/4      t-R0 t.RNR1 lt/RNR2 lt0 ! R3 R44      t1 ! R5 R6]14      t2 ! R7 R8]14      t3 ! R9 R:]14      t4 ! R; R<]14      t5 ! R= R>]14      t6 ! R? R@]14      t7 ! RA RB]14      t8 ! RC RD]14      t9 ! RE RF]14      t: ! RG RH]14      t; ! RI RJ]14      t< ! RK RL]14      t=R#     ^ RIt]]P0                  R&    EL  ] d    ^ RIt]]P0                  R&     ELi ; i; i  ],]3 d     ! R- R,4      t+ Li ; i)O    N)*zselinux-python)SELinuxPolicy)	TypeQueryTunicode	localedirz/usr/share/localefallback_ z	all filesazregular filez--fz-d	directorydz-czcharacter devicecz-bzblock devicebz-ssocketsz-llzsymbolic linkpz-pz
named pipeanyblockchardirfilesymlinkpipec                   F   a  ] tR t^lt o R tRR ltRR ltR tR tRt	V t
R# )	loggerc                V    \         P                  ! 4       V n        . V n        . V n        R # N)audit
audit_openaudit_fdlog_listlog_change_listselfs   &-/usr/lib/python3.14/site-packages/seobject.py__init__logger.__init__n   s!    !,,.DMDM#%D     c	                N   R p	W68w  d   WR,           ,          pRp	WG8w  d   WR,           ,          pRp	WX8w  d   WR,           ,          pRp	V P                   P                  V P                  \        P                  \
        P                  ^ ,          \        V4      V^ W4WVWxRRR.4       R# )-sename,roleranger
   N)r#   appendr"   r    AUDIT_ROLE_ASSIGNsysargvstr)
r&   msgnamer-   seroleserange	oldsename	oldserole
oldserangeseps
   &&&&&&&&& r'   log
logger.logs   s    C"X~%"V|#$W}$MM  $--1H1H#((ST+WZ[^W_aeghjp  {B  OX  fh  jl  np  "q  rr*   c	                    V P                   P                  V P                  \        P                  \
        P                  ^ ,          \        V4      V^ W4WVWxRRR.4       R# )r   r
   N)r#   r1   r"   r    AUDIT_ROLE_REMOVEr3   r4   r5   	r&   r6   r7   r-   r8   r9   r:   r;   r<   s	   &&&&&&&&&r'   
log_removelogger.log_remove   si    MM  $--1H1H#((ST+WZ[^W_aeghjp  {B  OX  fh  jl  np  "q  rr*   c           	         V P                   P                  V P                  \        P                  \        V4      R RRR.4       R# )semanager
   N)r$   r1   r"   r    AUDIT_USER_MAC_CONFIG_CHANGEr5   r&   r6   s   &&r'   
log_changelogger.log_change   s:      ''8Z8Z\_`c\dfprtvxz|(}~r*   c                    V P                    F  p\        P                  ! W!.,           !   K   	  V P                   F  p\        P                  ! W!.,           !   K   	  . V n         . V n        R # r   )r#   r    audit_log_semanage_messager$   audit_log_user_comm_message)r&   successr   s   && r'   commitlogger.commit   sU    ]]001y=B #))11A	MC * DM#%D r*   )r"   r$   r#   Nr
   r
   r
   r
   r
   r
   r
   __name__
__module____qualname____firstlineno__r(   r>   rC   rI   rO   __static_attributes____classdictcell____classdict__s   @r'   r   r   l   s&     	&
	r	r		& 	&r*   r   c                   F   a  ] tR t^t o R tRR ltRR ltR tR tRt	V t
R# )	r   c                    . V n         R # r   r#   r%   s   &r'   r(   r)      s	    DMr*   c	                t   R V: RV: 2p	VR8w  d   V	RV,           ,          p	VR8w  d   V	RV,           ,          p	VR8w  d   V	RV,           ,          p	VR8w  d   V	RV,           ,          p	VR8w  d   Ve   V	RV,           ,          p	VR8w  d   Ve   V	R	V,           ,          p	V P                   P                  V	4       R# )
 z name=r
   z sename=z oldsename=z role=z
 old_role=Nz
 MLSRange=z old_MLSRange=r#   r1   )
r&   r6   r7   r-   r8   r9   r:   r;   r<   messages
   &&&&&&&&& r'   r>   r?      s    '*D1G|:..B=944|8f,,B<)33"}!4<'11RJ$:+j88MM  )r*   c	           
     .    V P                  WW4WVWx4       R # r   )r>   rB   s	   &&&&&&&&&r'   rC   rD      s    HHSIZr*   c                J    V P                   P                  R V,          4       R# )z %sNr`   rH   s   &&r'   rI   rJ      s    MM  -r*   c                    V^8X  d   RpMRpV P                    F.  p\        P                  ! \        P                  W#,           4       K0  	  R# )   zSuccessful: zFailed: N)r#   syslogLOG_INFO)r&   rN   ra   r   s   &&  r'   rO   rP      s5    !|($]]foow{; #r*   r]   NrQ   rR   rY   s   @r'   r   r      s$     		* 	[	.	< 	<r*   c                   @   a  ] tR t^t o RR ltRR ltR tR tRtV t	R# )
nullloggerc	                    R # r    rB   s	   &&&&&&&&&r'   r>   nulllogger.log       r*   c	                    R # r   rk   rB   s	   &&&&&&&&&r'   rC   nulllogger.log_remove   rm   r*   c                    R # r   rk   rH   s   &&r'   rI   nulllogger.log_change   rm   r*   c                    R # r   rk   )r&   rN   s   &&r'   rO   nulllogger.commit   rm   r*   rk   NrQ   )
rS   rT   rU   rV   r>   rC   rI   rO   rW   rX   rY   s   @r'   ri   ri      s      r*   ri   c                    R pRpVR,           V,           R,           pVR,           V,           R,           pVR,           V,           R,           R,           V,           R,           p\         P                  ! RV,           R	,           V 4      # )
zs[0-9]*zc[0-9]*z(\.z)?z(\,z)*z(-z(:^$)research)rawsensitivitycategory	cat_range
categoriesregs   &     r'   validate_levelr      sp    KH6!H,t3IV#i/$6J

{
*T
1D
8:
E
LC99S3Y_c**r*   c                     R pV^8X  d
   V: V : 2pMT p\         P                  ! V4      w  rEV^ 8w  d   V # V'       d   V\        V4      R pVR8X  d   V # V# za:b:c:Nr
   )selinuxselinux_raw_to_trans_contextlen)ry   prependfillercontextrctranss   &&    r'   	translater      s_    F!|"C(66w?KR	Qw
c&kl#{
r*   c                     R pV^8X  d
   V: V : 2pMT p\         P                  ! V4      w  rEV^ 8w  d   V # V'       d   V\        V4      R pVR8X  d   V # V# r   )r   selinux_trans_to_raw_contextr   )r   r   r   r   r   ry   s   &&    r'   untranslater      s_    F!|"E*44W=IR	Qw#f+,
by
r*   c                   j   a  ] tR t^t o RtRtRtRtRR ltR t	R t
R tR tR tR	 tR
 tR tRtV tR# )semanageRecordsFNc                l   V'       d$   \        V\        4      '       d   Wn        MWn        \	        VR R4      V n        V P                  '       g   \	        VRR4      V n        V P                  V P                  4      V n        \        P                  ! 4       w  r#V P                  R8X  g   V P                  V8X  d   \        4       V n        R# \        P                  ! V P                  4       \        P                  ! \        P                  ! 4       : V P                  : 24       \!        4       V n        R# )noreloadFstorer
   N)
isinstancer5   r   argsgetattrr   
get_handleshr   selinux_getpolicytyper   mylogsepolicyload_store_policyselinux_set_policy_rootselinux_pathri   )r&   r   r   
localstores   &&  r'   r(   semanageRecords.__init__   s    $$$!
 	j%8zzz w3DJ//$**- 668::tzzZ7DJ&&tzz2++g6J6J6Ldjj,YZ#DJr*   c                    V'       * V n         R # r   )r   )r&   loads   &&r'   
set_reloadsemanageRecords.set_reload  s     r*   c                   \         P                  '       d   \         P                  # \        4       pV'       g   \        \	        R 4      4      h\         P
                  '       g#   VR8w  d   \        W!\        4       V\         n        \        V4      '       g    \        V4       \        \	        R4      4      h\        V4      pV\        8  d    \        V4       \        \	        R4      4      h\        V4      pV^ 8  d    \        V4       \        \	        R4      4      h\        V4      s\        ^ 8  d    \        V4       \        \	        R4      4      hV\         n        \         P                  # )z Could not create semanage handler
   z:SELinux policy is not managed or store cannot be accessed.zCannot read policy store.z'Could not establish semanage connectionz!Could not test MLS enabled status)r   handlesemanage_handle_create
ValueErrorr	   transactionsemanage_select_storeSEMANAGE_CON_DIRECTr   semanage_is_managedsemanage_handle_destroysemanage_access_checkSEMANAGE_CAN_READsemanage_connectsemanage_mls_enabledis_mls_enabled)r&   r   r   r   s   &&  r'   r   semanageRecords.get_handle  s    !!!")))')QABCC***u{!&1DE$)O!"6**#F+Q[\]]"6*!!#F+Q:;<<f%6#F+QHIJJ-f5A#F+QBCDD!'%%%r*   c                *    \        \        R 4      4      hzNot yet implementedr   r	   r%   s   &r'   	deleteallsemanageRecords.deleteall3      0122r*   c                    \         P                  '       d   \        \        R 4      4      hV P	                  4        R\         n        R# )z(Semanage transaction already in progressTN)r   r   r   r	   beginr%   s   &r'   startsemanageRecords.start6  s0    &&&QIJKK

&*#r*   c                    \         P                  '       d   R # \        V P                  4      pV^ 8  d   \	        \        R4      4      hR # )Nz$Could not start semanage transaction)r   r   semanage_begin_transactionr   r   r	   r&   r   s   & r'   r   semanageRecords.begin<  s<    &&&'06QEFGG r*   c                *    \        \        R 4      4      hr   r   r%   s   &r'   
customizedsemanageRecords.customizedC  r   r*   c                R   \         P                  '       d   R # V P                  '       d   \        V P                  ^ 4       \        V P                  4      pV^ 8  d0   V P                  P                  ^ 4       \        \        R4      4      hV P                  P                  ^4       R # )Nz%Could not commit semanage transaction)
r   r   r   semanage_set_reloadr   semanage_commitr   rO   r   r	   r   s   & r'   rO   semanageRecords.commitF  sr    &&&===+TWW%6JJa QFGHH

!r*   c                    \         P                  '       g   \        \        R 4      4      hR\         n        V P	                  4        R# )z$Semanage transaction not in progressFN)r   r   r   r	   rO   r%   s   &r'   finishsemanageRecords.finishR  s0    ***QEFGG&+#r*   )r   r   r   r   r   r   )rS   rT   rU   rV   r   r   r   r   r(   r   r   r   r   r   r   rO   r   rW   rX   rY   s   @r'   r   r      sM     KFED&,!"&H3+H3
 r*   r   c                   X   a  ] tR tRt o RR ltR tR tRR ltR tR t	R	 t
R
 tRtV tR# )moduleRecordsiY  Nc                0    \         P                  W4       R # r   r   r(   r&   r   s   &&r'   r(   moduleRecords.__init__[        ,r*   c                   . p\        V P                  4      w  r#pV^ 8  d   \        \        R4      4      h\	        V4       F  p\        W54      p\        V P                  V4      w  r'V^ 8  d   \        \        R4      4      h\        V P                  V4      w  r(V^ 8  d   \        \        R4      4      h\        V P                  V4      w  r)V^ 8  d   \        \        R4      4      h\        V P                  V4      w  r*V^ 8  d   \        \        R4      4      hVP                  WxW34       K  	  VP                  R RR7       VP                  R	 R
7       V# )r   Could not list SELinux moduleszCould not get module namezCould not get module enabledzCould not get module priorityzCould not get module lang_extc                     V ^,          #    rk   ts   &r'   <lambda>'moduleRecords.get_all.<locals>.<lambda>z      QqTr*   T)keyreversec                     V ^ ,          # r   rk   r   s   &r'   r   r   {  r   r*   )r   )semanage_module_list_allr   r   r	   r0   semanage_module_list_nthsemanage_module_info_get_name semanage_module_info_get_enabled!semanage_module_info_get_priority!semanage_module_info_get_lang_extr1   sort)r&   r   r   mlistnumberimodr7   enabledprioritylang_exts   &          r'   get_allmoduleRecords.get_all^  s(   6tww?F6Q?@AAvA*54C4TWWcBHBAv #>!?@@:477CHKBAv #A!BCC<TWWcJLBAv #B!CDD<TWWcJLBAv #B!CDDHHdX89' , 	
>40	>"r*   c                    V P                  4       p\        V4      ^ 8X  d   . # V Uu. uF  q"^,          ^ 8X  g   K  VNK  	  up Uu. uF  pRV^ ,          ,          NK  	  up# u upi u upi )r   z-d %s)r   r   )r&   allr   xs   &   r'   r   moduleRecords.customized~  s]    llns8q=I47(ECqQ419C(EF(E1!A$(EFF(EFs   A"A"A'c           
        V P                  4       p\        V4      ^ 8X  d   R# V'       d6   \        R\        R4      :R R\        R4      :R R\        R4      : R24       V F[  pV^,          ^ 8X  d   \        R	4      pMV'       d   K'  R
p\        V^ ,          :R RV^,          :R RV^,          :R RV: 24       K]  	  R# )r   N
zModule Name25r_   Priority9LanguageDisabledr
   5)r   r   printr	   )r&   heading	locallistr   r   disableds   &&&   r'   listmoduleRecords.list  s    llns8q==)91Z=!J-XYAtqyZ=!A$$!addHEF r*   c                T   \         P                  P                  V4      '       g   \        \	        R 4      V,          4      h\        V P                  V4      pV^ 8  d   \        \	        R4      V,          4      h\        V P                  V4      pV^ 8  d   V P                  4        R# R# )zModule does not exist: %s 3Invalid priority %d (needs to be between 1 and 999)N)	ospathexistsr   r	   semanage_set_default_priorityr   semanage_module_install_filerO   )r&   r   r   r   s   &&& r'   addmoduleRecords.add  s~    ww~~d##Q;<tCDD*477H=6QTUX``aa)$''487KKM r*   c                   VP                  4        F  p\        V P                  4      w  rEV^ 8  d   \        \	        R4      4      h\        V P                  WS4      pV^ 8  d   \        \	        R4      4      h\        V P                  WR4      pV^ 8  g   K  V'       d   \        \	        R4      V,          4      h\        \	        R4      V,          4      h	  V P                  4        R# )r   zCould not create module keyzCould not set module key namezCould not enable module %szCould not disable module %sN)splitsemanage_module_key_creater   r   r	   semanage_module_key_set_namesemanage_module_set_enabledrO   )r&   moduleenablemr   r   s   &&&   r'   set_enabledmoduleRecords.set_enabled  s    A09GBAv #@!ABB-dggs>BAv #B!CDD,TWWcBBAv$Q'C%Dq%HII$Q'D%E%IJJ   	r*   c                F   \        V P                  V4      pV^ 8  d   \        \        R4      V,          4      hVP	                  4        FD  p\        V P                  V4      pV^ 8  g   K"  VR8w  g   K+  \        \        R4      V,          4      h	  V P                  4        R# )r   r  z*Could not remove module %s (remove failed)N)r  r   r   r	   r  semanage_module_removerO   )r&   r  r   r   r  s   &&&  r'   deletemoduleRecords.delete  s    *477H=6QTUX``aaA'3BAv"( #O!PST!TUU  
 	r*   c                    V P                  4        Uu. uF  q^,          ^ 8X  g   K  VNK  	  up Uu. uF  q"^ ,          NK  	  ppV F  pV P                  VR4       K  	  R# u upi u upi )re   TN)r   r  )r&   r   r   r   r  s   &    r'   r   moduleRecords.deleteall  s^    '+||~C~!1AA~CDCaqTTCDAQ%  DDs   A"A"A'rk   r   re   r   )rS   rT   rU   rV   r(   r   r   r   r	  r  r  r   rW   rX   rY   s   @r'   r   r   Y  s5     -@GG 
$
& &r*   r   c                   0   a  ] tR tRt o RR ltR tRtV tR# )dontauditClassi  Nc                0    \         P                  W4       R # r   r   r   s   &&r'   r(   dontauditClass.__init__  r   r*   c                    VR9  d   \        \        R4      4      hV P                  4        \        V P                  VR8H  4       V P                  4        R# )onoffz'dontaudit requires either 'on' or 'off'N)r"  r#  )r   r	   r   semanage_set_disable_dontauditr   rO   )r&   	dontaudits   &&r'   toggledontauditClass.toggle  s@    M)QHIJJ

&tww	U0BCr*   rk   r   )rS   rT   rU   rV   r(   r&  rW   rX   rY   s   @r'   r  r    s     - r*   r  c                   R   a  ] tR tRt o RR ltR tR tRR ltR tR t	R	 t
R
tV tR# )permissiveRecordsi  Nc                0    \         P                  W4       R # r   r   r   s   &&r'   r(   permissiveRecords.__init__  r   r*   c                T   . p\        V P                  4      w  r#pV^ 8  d   \        \        R4      4      h\	        V4       Fc  p\        W54      p\        V4      pV'       g   K#  VP                  R4      '       g   K<  VP                  VP                  R4      ^,          4       Ke  	  V# )r   r   permissive_)
semanage_module_listr   r   r	   r0   r   semanage_module_get_name
startswithr1   r  )r&   r   r   r   r   r   r   r7   s   &       r'   r   permissiveRecords.get_all  s    2477;F6Q?@AAvA*54C+C0Dt66M2156	 
 r*   c                l    \        V P                  4       4       Uu. uF  pR V,          NK  	  up# u upi )z-a %s)sortedr   )r&   r   s   & r'   r   permissiveRecords.customized  s-    %+DLLN%;<%;!%;<<<s   1c                    \         P                  ! \         P                  4       Uu. uF  q3R ,          '       g   K  VNK  	  up Uu. uF  qDR,          NK  	  pp\        V4      ^ 8X  d   R# V'       d   \	        R\        R4      ,          4       V P                  4       pV F  pWv9  g   K  \	        V4       K  	  \        V4      ^ 8X  d   R# V'       d   \	        R\        R4      ,          4       V F  p\	        V4       K  	  R# u upi u upi )
permissiver7   Nz
%-25s
zBuiltin Permissive TypeszCustomized Permissive Types)r   infoTYPEr   r   r	   r   )r&   r   r   r   yr   r   r   s   &&&     r'   r   permissiveRecords.list  s    .6mmHMM.J"^.JP\oo11.J"^_"^Qyy"^_s8q=+#=!>?@\\^
A"a  z?a+#@!ABCA!H ! #__s   DDDc                    R V,          pRV,          p\        V P                  V\        V4      VR4      pV^ 8  d   V P                  4        V^ 8  d   \	        \        R4      V,          4      hR# )permissive_%sz(typepermissive %s)cilz?Could not set permissive domain %s (module installation failed)N)semanage_module_installr   r   rO   r   r	   )r&   typer7   modtxtr   s   &&   r'   r	  permissiveRecords.add  sc    %&-$TWWfc&k4O7KKM6Q`adhhii r*   c                    VP                  4        FB  p\        V P                  R V,          4      pV^ 8  g   K)  \        \	        R4      V,          4      h	  V P                  4        R# )r<  z5Could not remove permissive domain %s (remove failed)N)r  r  r   r   r	   rO   )r&   r7   nr   s   &&  r'   r  permissiveRecords.delete  sP    A'11DEBAv #Z![^b!bcc 
 	r*   c                    V P                  4       p\        V4      ^ 8  d%   RP                  V4      pV P                  V4       R# R# )r   r_   N)r   r   joinr  )r&   r   r   s   &  r'   r   permissiveRecords.deleteall  s6    LLNq6A:((1+CKK r*   rk   r   r  )rS   rT   rU   rV   r(   r   r   r   r	  r  r   rW   rX   rY   s   @r'   r)  r)    s.     -=(	j r*   r)  c                      a  ] tR tRt o RR ltR tR tR tRR ltRR lt	R	 t
R
 tR tR tRR ltR tRR ltRtV tR# )loginRecordsi  Nc                h    \         P                  W4       R V n        R V n        R V n        R V n        R # r   )r   r(   r:   r<   r-   r9   r   s   &&r'   r(   loginRecords.__init__  s,      ,r*   c                @   \         P                  ! V4      w  q@n        V n        VR 8X  d   Rp\	        V P
                  4      pVP                  V P                  4      w  pw  rxVP                  V4      w  pw  ry\        ^8X  d   VR 8w  d   \        V4      pMTp\        V P                  V4      w  rzV^ 8  d   \        \        R4      V,          4      hV^ ,          R8X  d     \        P                  ! VR,          4       M \        P                   ! V4       \#        V P                  4      w  r{V^ 8  d   \        \        R4      V,          4      h\%        V P                  W4      pV^ 8  d   \        \        R4      V,          4      h\        ^8X  d@   VR 8w  d9   \'        V P                  W4      pV^ 8  d   \        \        R	4      V,          4      h\)        V P                  W4      pV^ 8  d   \        \        R
4      V,          4      h\+        V P                  W4      pV^ 8  d   \        \        R4      V,          4      h\-        V
4       \/        V4       R#    \        \        R4      TR,          ,          4      h; i   \        \        R4      T,          4      h; i)r
   user_uCould not create a key for %s%re   NNzLinux Group %s does not existzLinux User %s does not existz%Could not create login mapping for %sCould not set name for %sCould not set MLS range for %sz!Could not set SELinux user for %sz"Could not add login mapping for %sN)r   getseuserbynamer:   r<   seluserRecordsr   getr   r   semanage_seuser_key_creater   r   r	   grpgetgrnampwdgetpwnamsemanage_seuser_createsemanage_seuser_set_namesemanage_seuser_set_mlsrangesemanage_seuser_set_senamesemanage_seuser_modify_localsemanage_seuser_key_freesemanage_seuser_free)r&   r7   r-   r9   recuserrecr0   r   r;   r8   kus   &&&&        r'   __addloginRecords.__add  s#   /6/F/Ft/L,^T_R<F +!(T^^!<%kk&1|Q"}%g.,TWWd;6Q>?$FGG7c>PT"X&KT" )16QFG$NOO%dggq76Q:;dBCCagm-dggqBBAv #C!Dt!KLL';6QBCdJKK)$''186QCDtKLL #Q=P #B!Cd2h!NOOK #A!BT!IJJs   !I  J  $I= Jc                     V P                  4        V P                  V4      '       d/   \        \        R 4      V,          4       V P	                  WV4       MV P                  WV4       V P                  4        R#   \         d   pThRp?ii ; i)z:Login mapping for %s is already defined, modifying insteadN)r   _loginRecords__existsr   r	   _loginRecords__modify_loginRecords__addrO   r   r&   r7   r-   r9   errors   &&&& r'   r	  loginRecords.addS  sm    
	JJL}}T""aTUX\\]dG4

41KKM 	K	s   &A; AA; ;BBBc                   \        V P                  V4      w  r#V^ 8  d   \        \        R4      V,          4      h\	        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      h\        V4       V# )r   rN  2Could not check if login mapping for %s is defined)rV  r   r   r	   semanage_seuser_existsr`  r&   r7   r   rd  r  s   &&   r'   __existsloginRecords.__existsa  sn    ,TWWd;6Q>?$FGG-dggq96QSTW[[\\ #r*   c                   \         P                  ! V4      w  q@n        V n        VR 8X  d   VR 8X  d   \	        \        R4      4      h\        V P                  4      pVP                  V P                  4      w  pw  rxVR 8w  d   VP                  V4      w  pw  ryMTp	VR 8w  d   W0n	        MW`n	        \        V P                  V4      w  rzV^ 8  d   \	        \        R4      V,          4      h\        V P                  V
4      w  r{V^ 8  d   \	        \        R4      V,          4      hV'       g   \	        \        R4      V,          4      h\        V P                  V
4      w  r|V^ 8  d   \	        \        R4      V,          4      h\        V4      V n        \        V4      V n        \         ^8X  d(   VR 8w  d!   \#        V P                  V\%        V4      4       VR 8w  d   \'        V P                  W4       W n        MV P                  V n        \+        V P                  W4      pV^ 8  d   \	        \        R4      V,          4      h\-        V
4       \/        V4       R# )r
   zRequires seuser or serangerN  rp  #Login mapping for %s is not definedzCould not query seuser for %sz%Could not modify login mapping for %sN)r   rS  r:   r<   r   r	   rT  r   rU  r9   rV  r   rq  semanage_seuser_querysemanage_seuser_get_mlsrangesemanage_seuser_get_senamer   r]  r   r^  r-   r_  r`  ra  )r&   r7   r-   r9   rb  rc  r0   r   r;   r8   rd  r  re  s   &&&&         r'   __modifyloginRecords.__modifym  s   /6/F/Ft/L,^T_R<GrMQ;<== +!(T^^!<R<")++f"5E<BFb="L L,TWWd;6Q>?$FGG-dggq96QSTW[[\\QDELMM'36Q>?$FGG6q93A6agm(![5IJR<&tww: K..DK)$''186QFG$NOO #Qr*   c                     V P                  4        V P                  WV4       V P                  4        R #   \         d   pThR p?ii ; ir   )r   rj  rO   r   rl  s   &&&& r'   modifyloginRecords.modify  s<    	JJLMM$0KKM 	K	s   26 AAAc                   \         P                  ! V4      w  q n        V n        \	        V P
                  4      pVP                  V P                  4      w  pw  rV\        V P                  V4      w  rWV^ 8  d   \        \        R4      V,          4      h\        V P                  V4      w  rXV^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h\        V P                  V4      w  rXV^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h\        V P                  V4      pV^ 8  d   \        \        R4      V,          4      h\        V4       \         P                  ! R4      w  q n        V n        VP                  V P                  4      w  pw  rYR# )r   rN  rp  rv  z<Login mapping for %s is defined in policy, cannot be deletedz%Could not delete login mapping for %s__default__N)r   rS  r:   r<   rT  r   rU  rV  r   r   r	   rq  semanage_seuser_exists_localsemanage_seuser_del_localr`  r-   r9   )
r&   r7   rb  rc  r0   r   r;   rd  r  r8   s
   &&        r'   __deleteloginRecords.__delete  sm   /6/F/Ft/L,^T_ +!(T^^!<,TWWd;6Q>?$FGG-dggq96QSTW[[\\QDELMM3DGGQ?6QSTW[[\\Q]^aeeff&tww26QFG$NOO #)0)@)@)O&[$,%kk$++6|Fr*   c                     V P                  4        V P                  V4       V P                  4        R #   \         d   pThR p?ii ; ir   )r   _loginRecords__deleterO   r   r&   r7   rm  s   && r'   r  loginRecords.delete  s:    	JJLMM$KKM 	K	s   15 A AAc                   \        V P                  4      w  rV^ 8  d   \        \        R4      4      h V P	                  4        V F  pV P                  \        V4      4       K  	  V P                  4        R#   \         d   pThRp?ii ; ir   Could not list login mappingsN)semanage_seuser_list_localr   r   r	   r   r  semanage_seuser_get_namerO   r&   r   ulistre  rm  s   &    r'   r   loginRecords.deleteall  sr    096Q>?@@	JJL6q9: KKM 	K	s   AA9 9BBBc                   / p\         P                  ! 4       R ,           V n        \        P                  ! V P                  4       F  w  r#pW P                  8X  g   K  V Fv  p \        VR,           V,           4      pVP                  4       P                  4       P                  R4      pVP                  4        V^,          V^,          V^ ,          3W&   Kx  	  K  	  V#   \         d     K  i ; i)z/logins/:)r   selinux_policy_rootlogins_pathr  walkopenreadrstripr  close
IndexError)r&   ddictr  dirsfilesr7   fdrb  s   &       r'   get_all_loginsloginRecords.get_all_logins  s    "6689D!#)9)9!:D'''!D!$*t"34 ggi..066s;
'*1vs1vs1v&> " ";  & s   "A2CC-,C-c                0   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   F'  p\        V4      p\        V4      \        V4      R3W%&   K)  	  V# )r   r  r   )	r  r   r  semanage_seuser_listr   r	   r  ry  rx  )r&   r   r  r   re  r7   s   &&    r'   r   loginRecords.get_all  s    9$''BR3DGG<R6Q>?@@A+A.D5a8:VWX:Y[^_EK  r*   c           	     T   . pV P                  R 4      p\        VP                  4       4       Fw  pW#,          ^,          '       d:   VP                  RW#,          ^ ,          : RW#,          ^,          : RV: 24       KQ  VP                  RW#,          ^ ,          : RV: 24       Ky  	  V# )Tz-a -s  -r '' r_   r   r3  keysr1   r&   r   r  rd  s   &   r'   r   loginRecords.customized  x    T"

%Ax{{%(1++ux{{ANO%(1++q9:	 &
 r*   c                   V P                  V4      pV P                  4       p\        VP                  4       4      p\        VP                  4       4      p\	        V4      ^ 8X  d   \	        V4      ^ 8X  d   R# \
        ^8X  Ed   V'       dD   \        R\        R4      :R R\        R4      :R R\        R4      :R R\        R4      : R2	4       V FF  pW7,          p\        V:R RV^ ,          :R R\        V^,          4      :R RV^,          : 24       KH  	  \	        V4      '       d   \        R	V P                  ,          4       V FF  pWG,          p\        V:R RV^ ,          :R R\        V^,          4      :R RV^,          : 24       KH  	  R# V'       d)   \        R\        R4      :R
 R\        R4      :R
 R24       V F$  p\        V:R
 RW7,          ^ ,          :R
 24       K&  	  R# )r   Nr   z
Login Name20r_   SELinux UserzMLS/MCS RangeServicez
Local customization in %sr   )
r   r  r3  r  r   r   r   r	   r   r  )	r&   r   r   r  ldictlkeysr  rd  re  s	   &&&      r'   r   loginRecords.list  sJ   Y'##%uzz|$ejjl#t9>c%jAoQAlOQ~EVXYZiXjlmnwlxyzH1Q441Q4!A$OP  5zz3d6F6FFGH1Q441Q4!A$OP  1\?An<MNOq%(1++67 r*   )r  r:   r<   r-   r9   r  r   )r
   r
   r   r  )rS   rT   rU   rV   r(   rk  r	  ri  rj  r}  r  r  r   r  r   r   r   rW   rX   rY   s   @r'   rI  rI    sM     4 l
0 d7<8 8r*   rI  c                      a  ] tR tRt o RR ltR tR tR tR t. RRR3R	 lt	. RRR3R
 lt
R tR tR tRR ltR tRR ltRtV tR# )rT  i  Nc                0    \         P                  W4       R # r   r   r   s   &&r'   r(   seluserRecords.__init__  r   r*   c                   \        V P                  V4      w  r#V^ 8  d   \        \        R4      V,          4      h\	        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      h\        V P                  V4      w  r%V^ 8  d   \        \        R4      V,          4      h\        V4      p\        V P                  V4      p\        V4       \        V4       Wg3# )r   rN  -Could not check if SELinux user %s is definedCould not query user for %s)
semanage_user_key_creater   r   r	   semanage_user_existssemanage_user_querysemanage_user_get_mlsrangesemanage_user_get_rolessemanage_user_key_freesemanage_user_free)r&   r7   r   rd  r  re  r9   r8   s   &&      r'   rU  seluserRecords.get"  s    *477D96Q>?$FGG+DGGQ76QNORVVWW%dggq16Q<=DEE,Q/(!4q!1r*   c                   \         ^8X  d+   VR8X  d   RpM\        V4      pVR8X  d   RpM\        V4      p\        V4      ^8  d   \        \	        R4      V,          4      h\        V P                  V4      w  rgV^ 8  d   \        \	        R4      V,          4      h\        V P                  4      w  rhV^ 8  d   \        \	        R4      V,          4      h\        V P                  W4      pV^ 8  d   \        \	        R4      V,          4      hV FD  p	\        V P                  W4      pV^ 8  g   K"  \        \	        R4      P                  WR7      4      h	  \         ^8X  dq   \        V P                  W4      pV^ 8  d   \        \	        R	4      V,          4      h\        V P                  W4      pV^ 8  d   \        \	        R
4      V,          4      h\        V P                  W4      pV^ 8  d&   \        \	        R4      P                  X	VR7      4      h\        V P                  V4      w  rjV^ 8  d   \        \	        R4      V,          4      h\        V P                  Wx4      pV^ 8  d   \        \	        R4      V,          4      h\!        V4       \#        V4       V P$                  P'                  RVRP)                  V4      VR7       R# )re   r
   s0z%You must add at least one role for %srN  z$Could not create SELinux user for %srQ  z$Could not add role {role} for {name})r/   r7   rR  zCould not set MLS level for %sz(Could not add prefix {prefix} for {role})r/   prefixzCould not extract key for %szCould not add SELinux user %sseuserr.   )r-   r8   r9   N)r   r   r   r   r	   r  r   semanage_user_createsemanage_user_set_namesemanage_user_add_roleformatsemanage_user_set_mlsrangesemanage_user_set_mlslevelsemanage_user_set_prefixsemanage_user_key_extractsemanage_user_modify_localr  r  r   r>   rF  )r&   r7   rolesselevelr9   r  r   rd  re  rr   s   &&&&&&     r'   rf  seluserRecords.__add2  sK   Q"}%g."}%g.u:>QFG$NOO*477D96Q>?$FGG&tww/6QEFMNN#DGGQ56Q:;dBCCA'6BAv #I!J!Q!QWX!Q!dee 
 Q+DGGQ@BAv #C!Dt!KLL+DGGQ@BAv #C!Dt!KLL%dggq96QIJQQWXagQhii-dggq9	6Q=>EFF'66Q>?$FGGq!1

xSXXe_gVr*   c                Z    V P                  4        V P                  V4      '       d0   \        \        R 4      V,          4       V P	                  WW4V4       MV P                  WW4V4       V P                  4        R#   \         d#   pT P                  P                  ^ 4       ThRp?ii ; i)z5SELinux user %s is already defined, modifying insteadN)	r   _seluserRecords__existsr   r	   _seluserRecords__modify_seluserRecords__addrO   r   r   r&   r7   r  r  r9   r  rm  s   &&&&&& r'   r	  seluserRecords.addi  s    
	JJL}}T""aOPSWWXd7VD

4&AKKM 	JJa K	s   &A= AA= =B*B%%B*c                   \        V P                  V4      w  r#V^ 8  d   \        \        R4      V,          4      h\	        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      h\        V4       V# )r   rN  r  )r  r   r   r	   r  r  rr  s   &&   r'   rs  seluserRecords.__existsv  sn    *477D96Q>?$FGG+DGGQ76QNORVVWWq!r*   r
   c           
        R pR pRP                  V4      pVR 8X  dR   \        V4      ^ 8X  dB   VR 8X  d;   VR 8X  d4   \        ^8X  d   \        \	        R4      4      h\        \	        R4      4      h\        V P                  V4      w  rV	^ 8  d   \        \	        R4      V,          4      h\        V P                  V
4      w  rV	^ 8  d   \        \	        R4      V,          4      hV'       g   \        \	        R4      V,          4      h\        V P                  V
4      w  rV	^ 8  d   \        \	        R4      V,          4      h\        V4      p\        V P                  V4      w  rV	^ 8  d   RP                  V4      p\        ^8X  d(   VR 8w  d!   \        V P                  V\        V4      4       \        ^8X  d(   VR 8w  d!   \        V P                  V\        V4      4       VR 8w  d   \        V P                  W4       \        V4      ^ 8w  dD   V F  pW9  g   K  \        W4       K  	  V F!  pW9  g   K  \!        V P                  W4       K#  	  \#        V P                  W4      p	V	^ 8  d   \        \	        R4      V,          4      h\%        V
4       \'        V4       R	P                  VP)                  4       4      pR	P                  VP)                  4       4      pV P*                  P-                  R
WWWgR7       R# )r
   r_   z&Requires prefix, roles, level or rangezRequires prefix or rolesrN  r  SELinux user %s is not definedr  z Could not modify SELinux user %sr.   r  )r-   r:   r8   r9   r;   r<   N)rF  r   r   r   r	   r  r   r  r  r  r  r  r   r  r  semanage_user_del_roler  r  r  r  r  r   r>   )r&   r7   r  r  r9   r  r;   r<   newrolesr   rd  r  re  rlistr  r/   s   &&&&&&          r'   rz  seluserRecords.__modify  sX   	
88E?R<CJ!O2'R-" #K!LMM #=!>??*477D96Q>?$FGG+DGGQ76QNORVVWWQ?@4GHH%dggq16Q<=DEE/2
-dggq97Iagm&tww;w3GHagm&tww;w3GHR<$TWWa8u:?>*10  >*477A9  (66QABTIJJq!1xx()HHY__./	

xTfo  	Hr*   c                     V P                  4        V P                  WW4V4       V P                  4        R#   \         d#   pT P                  P                  ^ 4       ThRp?ii ; ir   N)r   r  rO   r   r   r  s   &&&&&& r'   r}  seluserRecords.modify  sP    	JJLMM$w@KKM 	JJa K	s   37 A$AA$c                   \        V P                  V4      w  r#V^ 8  d   \        \        R4      V,          4      h\	        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h\        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h\        V P                  V4      w  r%V^ 8  d   \        \        R4      V,          4      h\        V4      p\        V P                  V4      w  r'RP                  V4      p\        V P                  V4      pV^ 8  d   \        \        R4      V,          4      h\        V4       \        V4       V P                  P                  RWVR	7       R
# )r   rN  r  r  z7SELinux user %s is defined in policy, cannot be deletedr  r.   z Could not delete SELinux user %sr  )r:   r<   r;   N)r  r   r   r	   r  semanage_user_exists_localr  r  r  rF  semanage_user_del_localr  r  r   rC   )	r&   r7   r   rd  r  re  r<   r  r;   s	   &&       r'   r  seluserRecords.__delete  ss   *477D96Q>?$FGG+DGGQ76QNORVVWWQ?@4GHH1$''1=6QNORVVWWQXY\``aa%dggq16Q<=DEE/2
-dggq9HHUO	$TWWa06QABTIJJq!1

h$Ybcr*   c                     V P                  4        V P                  V4       V P                  4        R#   \         d#   pT P                  P                  ^ 4       ThRp?ii ; ir  )r   _seluserRecords__deleterO   r   r   r  s   && r'   r  seluserRecords.delete  sL    	JJLMM$KKM 	JJa K	s   15 A" AA"c                R   \        V P                  4      w  rV^ 8  d   \        \        R4      4      h V P	                  4        V F  pV P                  \        V4      4       K  	  V P                  4        R#   \         d#   pT P                  P                  ^ 4       ThRp?ii ; ir  )	semanage_user_list_localr   r   r	   r   r  semanage_user_get_namerO   r   r  s   &    r'   r   seluserRecords.deleteall  s    .tww76Q>?@@	JJL4Q78 KKM 	JJa K	s   AA9 9B&B!!B&c                   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   F  p\        V4      p\        V P                  V4      w  r6V^ 8  d   \	        \        R4      V,          4      hRP                  V4      p\        V4      \        V4      \        V4      V3V\        V4      &   K  	  V# )r   zCould not list SELinux usersz Could not list roles for user %sr_   )r  r   r  semanage_user_listr   r	   r  r  rF  semanage_user_get_prefixsemanage_user_get_mlslevelr  )r&   r   r  r   re  r7   r  r  s   &&      r'   r   seluserRecords.get_all  s    7@R1$'':R6Q=>??A)!,D1$''1=KRAv #E!F!MNNHHUOE0H0KMghiMj  mG  HI  mJ  LQ  0RE(+,  r*   c                   . pV P                  R 4      p\        VP                  4       4       F  pW#,          ^,          '       g   W#,          ^,          '       dK   VP                  RW#,          ^,          : RW#,          ^,          : RW#,          ^,          : RV: 24       Kw  VP                  RW#,          ^,          : RV: 24       K  	  V# )Tz-a -L z -r z -R 'r  z-a -R 'r  r  s   &   r'   r   seluserRecords.customized  s    T"

%Ax{{ehqkkUXa[[RWRZ[\R]R]_`abEHQKK;<	 &
 r*   c                N   V P                  V4      p\        V4      ^ 8X  d   R# \        VP                  4       4      p\        ^8X  Ed   V'       d   \        RR:R R\        R4      :R R\        R4      :R R\        R4      :R	 24       \        \        R
4      :R R\        R4      :R R\        R4      :R R\        R4      :R	 R\        R4      : R2
4       V Fk  p\        V:R RW5,          ^ ,          :R R\        W5,          ^,          4      :R R\        W5,          ^,          4      :R	 RW5,          ^,          : 2	4       Km  	  R# V'       d'   \        \        R
4      :R R\        R4      : R24       V F#  p\        V:R RW5,          ^,          : 24       K%  	  R# )r   Nr   r
   15r_   Labeling10zMLS/30r  Prefixz	MCS Levelz	MCS RangezSELinux Roles)r   r   r3  r  r   r   r	   r   r&   r   r   r  r  rd  s   &&&   r'   r   seluserRecords.list  s-   Y'u:?ejjl#QR:&	STU[S\]^.8I1X;XYZeXfhijuhvxy  {J  yK  L  Ma!iPUPXYZP[F\^ghmhpqrhs^tv{v~  @A  wB  C  D  a&7?9KLMAux{34 r*   )r  r   r   r  )rS   rT   rU   rV   r(   rU  r  r	  r  r  r}  r  r  r   r   r   r   rW   rX   rY   s   @r'   rT  rT    sg     - 5Wn
 $&r2b 6Hp "$RB dB(5 5r*   rT  c                      a  ] tR tRt o . tRR ltR tR tR tR t	R t
R	 tR
 tR tR tRR ltRR ltR tRR ltRtV tR# )portRecordsi-  Nc                    \         P                  W4        \        \        \        P                  ! \        P
                  R 4      4      ^ ,          R,          4      V n        R#   \         d     R# i ; i)	port_typetypesN)r   r(   r   r   r7  	ATTRIBUTEvalid_typesRuntimeErrorr   s   &&r'   r(   portRecords.__init__1  sV      ,	#Dx7I7I;)W$XYZ$[\c$deD 		s   A
A# #A21A2c                |   R \         R\        R\        R\        /pW#P	                  4       9   d
   W2,          pM\        \        R4      4      hVR8X  d   \        \        R4      4      h\        V\        4      '       d   VP                  R^4      pMV3p\        V4      ^8X  d   \        V^ ,          4      ;rgM$\        V^ ,          4      p\        V^,          4      pVR8  d   \        \        R	4      4      h\        V P                  WvV4      w  rV^ 8  d%   \        \        R
4      P                  W!R7      4      hWWv3# )tcpudpsctpdccpz0Protocol has to be one of udp, tcp, dccp or sctpr
   zPort is requiredr,     zInvalid Portz)Could not create a key for {proto}/{port}protoport)SEMANAGE_PROTO_TCPSEMANAGE_PROTO_UDPSEMANAGE_PROTO_SCTPSEMANAGE_PROTO_DCCPr  r   r	   r   r5   r  r   intsemanage_port_key_creater   r  )
r&   r  r  	protocolsproto_dportshighlowr   rd  s
   &&&       r'   __genkeyportRecords.__genkey8  s   ..002	
 NN$$&GQQRSS2:Q1233dC  JJsA&EGEu:?U1X&D3eAh-CuQx=D%<Q~.//*477CwG6QJKRRY^RjkkC&&r*   c                `   \         ^8X  d   VR8X  d   RpM\        V4      pVR8X  d   \        \        R4      4      h\        P
                  ! V4      pW@P                  9  d   \        \        R4      V,          4      hV P                  W4      w  rVrx\        V P                  4      w  rV	^ 8  d%   \        \        R4      P                  W!R7      4      h\        W4       \        WV4       \        V P                  4      w  rV	^ 8  d%   \        \        R4      P                  W!R7      4      h\        V P                  VR4      p	V	^ 8  d%   \        \        R	4      P                  W!R7      4      h\        V P                  VR
4      p	V	^ 8  d%   \        \        R4      P                  W!R7      4      h\!        V P                  W4      p	V	^ 8  d%   \        \        R4      P                  W!R7      4      h\         ^8X  dI   VR8w  dB   \#        V P                  W4      p	V	^ 8  d%   \        \        R4      P                  W!R7      4      h\%        V P                  W4      p	V	^ 8  d%   \        \        R4      P                  W!R7      4      h\'        V P                  WZ4      p	V	^ 8  d%   \        \        R4      P                  W!R7      4      h\)        V4       \+        V4       \-        V
4       V P.                  P1                  RV: R\2        P4                  ! V4      : RR: RR
: RV: RV: 24       R# )re   r
   r  Type is required'Type %s is invalid, must be a port typez(Could not create port for {proto}/{port}r  z+Could not create context for {proto}/{port}system_uz5Could not set user in port context for {proto}/{port}object_rz5Could not set role in port context for {proto}/{port}z5Could not set type in port context for {proto}/{port}z;Could not set mls fields in port context for {proto}/{port}z-Could not set port context for {proto}/{port}z!Could not add port {proto}/{port}zresrc=port op=add lport= proto=
 tcontext=r  N)r   r   r   r	   r   get_real_type_namer  _portRecords__genkeysemanage_port_creater   r  semanage_port_set_protosemanage_port_set_rangesemanage_context_createsemanage_context_set_usersemanage_context_set_rolesemanage_context_set_typesemanage_context_set_mlssemanage_port_set_consemanage_port_modify_localsemanage_context_freesemanage_port_key_freesemanage_port_freer   rI   r   getprotobyname)r&   r  r  r9   r?  rd  r  r  r  r   r   cons   &&&&&       r'   rf  portRecords.__addX  s   Q"}%g.2:Q1233**40'''QHIDPQQ"&--"<S&tww/6QIJQQX]Qijj+-+DGG4	6QLMTT[`Tlmm&twwZ@6QVW^^ej^vww&twwZ@6QVW^^ej^vww&tww:6QVW^^ej^vwwagm)$''3@BAv #`!a!h!hot!h  "A  B  B"477A36QNOVV]bVnoo'66QBCJJQVJbccc"q!1

\`bhbwbwx}b~  AK  MW  Y]  _f  g  	hr*   c                   V P                  4        V P                  W4      '       d8   \        \        R 4      P	                  W!R7      4       V P                  WW44       MV P                  WW44       V P                  4        R# )z6Port {proto}/{port} already defined, modifying insteadr  N)r   _portRecords__existsr   r	   r  _portRecords__modify_portRecords__addrO   )r&   r  r  r9   r?  s   &&&&&r'   r	  portRecords.add  s\    

==%%!LMTT[`TlmMM$w5JJtG2r*   c                    V P                  W4      w  r4rV\        V P                  V4      w  rxV^ 8  d%   \        \	        R4      P                  W!R7      4      h\        V4       V# )r   1Could not check if port {proto}/{port} is definedr  )r%  semanage_port_existsr   r   r	   r  r1  	r&   r  r  rd  r  r  r  r   r  s	   &&&      r'   rs  portRecords.__exists  s[    "&--"<S+DGGQ76QRSZZafZrssq!r*   c                   VR 8X  d;   VR 8X  d4   \         ^8X  d   \        \        R4      4      h\        \        R4      4      h\        P                  ! V4      pV'       d,   W@P
                  9  d   \        \        R4      V,          4      hV P                  W4      w  rVrx\        V P                  V4      w  rV	^ 8  d%   \        \        R4      P                  W!R7      4      hV
'       g%   \        \        R4      P                  W!R7      4      h\        V P                  V4      w  rV	^ 8  d%   \        \        R4      P                  W!R7      4      h\        V4      p\         ^8X  d+   VR 8X  d   RpM \        V P                  V\        V4      4       VR 8w  d   \        V P                  W4       \        V P                  W[4      p	V	^ 8  d%   \        \        R	4      P                  W!R7      4      h\!        V4       \#        V4       V P$                  P'                  R
V: R\(        P*                  ! V4      : RR: RR: RV: RV: 24       R# )r
   Requires setype or serangeRequires setyper  r<  r  "Port {proto}/{port} is not definedz#Could not query port {proto}/{port}r  z$Could not modify port {proto}/{port}zresrc=port op=modify lport=r"  r#  r   r  r!  N)r   r   r	   r   r$  r  r%  r=  r   r  semanage_port_querysemanage_port_get_conr-  r   r,  r/  r1  r2  r   rI   r   r3  )r&   r  r  r9   setyperd  r  r  r  r   r  r   r4  s   &&&&&        r'   rz  portRecords.__modify  s   b=Vr\" #?!@AA #4!566,,V4f$4$44QHIFRSS"&--"<S+DGGQ76QRSZZafZrssQCDKKRWKcdd%dggq16QDELLSXLdee#A&Q"}(#{77KLR<%dggs;'66QEFMMTYMeffq!1

_cekezez  |A  fB  DN  PZ  \b  dk  l  	mr*   c                j    V P                  4        V P                  WW44       V P                  4        R # r   )r   r8  rO   )r&   r  r  r9   rF  s   &&&&&r'   r}  portRecords.modify  s"    

d73r*   c           	        \        V P                  4      w  rV^ 8  d   \        \        R4      4      hV P	                  4        V F  p\        V4      p\        V4      p\        V4      p\        V4      pV: RV: 2pV P                  W4      w  rrgV^ 8  d   \        \        R4      V,          4      h\        V P                  V	4      pV^ 8  d   \        \        R4      V,          4      h\        V	4       Wg8X  d   TpV P                  P                  RV: R\        P                  ! V4      : 24       K  	  V P!                  4        R# )r   zCould not list the portsr,   rN  zCould not delete the port %sresrc=port op=delete lport=r"  N)semanage_port_list_localr   r   r	   r   semanage_port_get_protosemanage_port_get_proto_strsemanage_port_get_lowsemanage_port_get_highr%  semanage_port_del_localr1  r   rI   r   r3  rO   )r&   r   plistr  r  	proto_strr  r  port_strrd  r  s   &          r'   r   portRecords.deleteall  s   .tww76Q9:;;

D+D1E3E:I'-C)$/D"%t,H&*mmH&H#QAv #B!Ch!NOO(!4BAv #A!BX!MNN"1%{JJ!!hX^XmXmnwXx"yz' * 	r*   c                   V P                  W4      w  r4rV\        V P                  V4      w  rxV^ 8  d%   \        \	        R4      P                  W!R7      4      hV'       g%   \        \	        R4      P                  W!R7      4      h\        V P                  V4      w  rxV^ 8  d%   \        \	        R4      P                  W!R7      4      hV'       g%   \        \	        R4      P                  W!R7      4      h\        V P                  V4      pV^ 8  d%   \        \	        R4      P                  W!R7      4      h\        V4       V P                  P                  RV: R\        P                  ! V4      : 24       R# )	r   r<  r  rC  z;Port {proto}/{port} is defined in policy, cannot be deletedz$Could not delete port {proto}/{port}rK  r"  N)r%  r=  r   r   r	   r  semanage_port_exists_localrQ  r1  r   rI   r   r3  r>  s	   &&&      r'   r  portRecords.__delete  s0   "&--"<S+DGGQ76QRSZZafZrssQCDKKRWKcdd1$''1=6QRSZZafZrssQ\]ddkpd|}}$TWWa06QEFMMTYMeffq!

$PVPePefkPlmnr*   c                h    V P                  4        V P                  W4       V P                  4        R # r   )r   _portRecords__deleterO   )r&   r  r  s   &&&r'   r  portRecords.delete  s     

d"r*   c                   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   FW  p\        V4      p\        V4      p\        V4      p\        V4      p\        V4      p	\        V4      p
\        V4      pWg3W*W3&   KY  	  V# )r   Could not list ports)rL  r   rR  semanage_port_listr   r	   rE  semanage_context_get_typesemanage_context_get_mlsrM  rN  rO  rP  )r&   r   r  r   r  r4  ctypelevelr  rS  r  r  s   &&          r'   r   portRecords.get_all  s    7@R1$'':R6Q5677JJD'-C-c2E,S1E+D1E3E:I'-C)$/D-2NE()  r*   c                6   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   F  p\        V4      p\        V4      p\        V4      p\        V4      p\        V4      p	\        V4      p
Wh3VP                  4       9  d   . W&V3&   W8X  d#   W&V3,          P                  RV	,          4       K  W&V3,          P                  RW3,          4       K  	  V# )r   r]  z%dz%d-%d)rL  r   rR  r^  r   r	   rE  r_  rM  rN  rO  rP  r  r1   )r&   r   r  r   r  r4  ra  r  rS  r  r  s   &&         r'   get_all_by_typeportRecords.get_all_by_type!  s    7@R1$'':R6Q5677JJD'-C-c2E+D1E3E:I'-C)$/D!5,.i(){i()00<i()00C;1FG  r*   c                   . pV P                  R 4      p\        VP                  4       4       F  pV^ ,          V^,          8X  d
   V^ ,          MV^ ,          : RV^,          : 2pW#,          ^,          '       dE   VP                  RW#,          ^ ,          : RW#,          ^,          : RV^,          : RV: 24       K  VP                  RW#,          ^ ,          : RV^,          : RV: 24       K  	  V# )Tr,   -a -t r  z' -p r_    -p r  r&   r   r  rd  r  s   &    r'   r   portRecords.customized9  s    T"

%AQ41Q4<1Q4!ad-CDx{{UXa[[RSTURVRVX\]^QqTT4HI & r*   c           	        V P                  V4      p\        V4      ^ 8X  d   R# \        VP                  4       4      pV'       d5   \	        \        R4      :R R\        R4      :R R\        R4      : R24       V FZ  pR	V,          pVR
W5,          ^ ,          ,          ,          pW5,          R,           F  pVRV,          ,          pK  	  \	        V4       K\  	  R# )r   NzSELinux Port Typer  r_   Proto8Port Numberr   z%-30s %-8s %srP  , %s)re  r   r3  r  r   r	   r&   r   r   r  r  r   rb  r   s   &&&     r'   r   portRecords.listD  s    $$Y/u:?ejjl#q)<'=qz1]K[\]A!#C4%(1+%%CXb\\vz! "#J r*   rR  r  r   r   r  )rS   rT   rU   rV   r  r(   r%  r9  r	  r7  r8  r}  r   rZ  r  r   re  r   r   rW   rX   rY   s   @r'   r  r  -  s[     K'@8ht(mT
<o,
(0	 r*   r  c                      a  ] tR tRt o . tRR ltR tR tR tR t	R t
R	 tR
 tR tR tRR ltRR ltR tRR ltRtV tR# )ibpkeyRecordsiS  Nc                    \         P                  W4        \        \        \        P
                  ! V P                  4      4      R .R7      p\        R VP                  4        4       4      V n	        R#     R# ; i)ibpkey_typeattrsc              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r5   .0r   s   & r'   	<genexpr>)ibpkeyRecords.__init__.<locals>.<genexpr>[  s     %Bkc!ffk   N)
r   r(   r   r   r   get_store_policyr   r3  resultsr  r&   r   qs   && r'   r(   ibpkeyRecords.__init__W  s\      ,	-(A(A$**(MNWdVefA%%Baiik%BBD	   AA3 3A8c                   VR 8X  d   \        \        R4      4      hVP                  R4      p\        V4      ^8X  d   \	        V^ ,          ^ 4      ;rEM&\	        V^ ,          ^ 4      p\	        V^,          ^ 4      pVR8  d   \        \        R4      4      h\        V P                  W%V4      w  rgV^ 8  d%   \        \        R4      P                  W!R7      4      hWrWT3# )r
   zSubnet Prefix is requiredr,   r  zInvalid Pkeyz1Could not create a key for {subnet_prefix}/{pkey}subnet_prefixpkey)r   r	   r  r   r  semanage_ibpkey_key_creater   r  )r&   r  r  pkeysr  r  r   rd  s   &&&     r'   r  ibpkeyRecords.__genkey_  s    BQ:;<<

3u:?U1Xq))D3eAh"CuQx#D%<Q~.//,TWWm$O6QRSZZivZ  C  D  D#,,r*   c                   \         ^8X  d   VR8X  d   RpM\        V4      pVR8X  d   \        \        R4      4      h\        P
                  ! V4      pW@P                  9  d   \        \        R4      V,          4      hV P                  W4      w  rRrg\        V P                  4      w  rV^ 8  d%   \        \        R4      P                  W!R7      4      h\        V P                  W4       \        WV4       \        V P                  4      w  rV^ 8  d%   \        \        R4      P                  W!R7      4      h\        V P                  V
R4      pV^ 8  d%   \        \        R	4      P                  W!R7      4      h\        V P                  V
R
4      pV^ 8  d%   \        \        R4      P                  W!R7      4      h\!        V P                  W4      pV^ 8  d%   \        \        R4      P                  W!R7      4      h\         ^8X  dI   VR8w  dB   \#        V P                  W4      pV^ 8  d%   \        \        R4      P                  W!R7      4      h\%        V P                  W4      pV^ 8  d%   \        \        R4      P                  W!R7      4      h\'        V P                  WY4      pV^ 8  d%   \        \        R4      P                  W!R7      4      h\)        V
4       \+        V4       \-        V	4       R# )re   r
   r  r  )Type %s is invalid, must be a ibpkey typez2Could not create ibpkey for {subnet_prefix}/{pkey}r  z3Could not create context for {subnet_prefix}/{pkey}r   z?Could not set user in ibpkey context for {subnet_prefix}/{pkey}r!  z?Could not set role in ibpkey context for {subnet_prefix}/{pkey}z?Could not set type in ibpkey context for {subnet_prefix}/{pkey}zECould not set mls fields in ibpkey context for {subnet_prefix}/{pkey}z7Could not set ibpkey context for {subnet_prefix}/{pkey}z+Could not add ibpkey {subnet_prefix}/{pkey}N)r   r   r   r	   r   r$  r  _ibpkeyRecords__genkeysemanage_ibpkey_creater   r  !semanage_ibpkey_set_subnet_prefixsemanage_ibpkey_set_ranger)  r*  r+  r,  r-  semanage_ibpkey_set_consemanage_ibpkey_modify_localr0  semanage_ibpkey_key_freesemanage_ibpkey_free)r&   r  r  r9   r?  rd  r  r  r   r   r4  s   &&&&&      r'   rf  ibpkeyRecords.__addr  s   Q"}%g.2:Q1233**40'''QJKdRSS(,d(J%3(16QST[[jw[  D  E  E)$''1D!!$/+DGG4	6QTU\\kx\  E  F  F&twwZ@6Q`ahh  xEh  Q  R  R&twwZ@6Q`ahh  xEh  Q  R  R&tww:6Q`ahh  xEh  Q  R  Ragm)$''3@BAv #j!k!r!r  BO!r  "[  \  \$TWWa56QXY``o|`  I  J  J)$''186QLMTTcpT|}}c" #Qr*   c                   V P                  4        V P                  W4      '       d8   \        \        R 4      P	                  W!R7      4       V P                  WW44       MV P                  WW44       V P                  4        R# )z@ibpkey {subnet_prefix}/{pkey} already defined, modifying insteadr  N)r   _ibpkeyRecords__existsr   r	   r  _ibpkeyRecords__modify_ibpkeyRecords__addrO   )r&   r  r  r9   r?  s   &&&&&r'   r	  ibpkeyRecords.add  sb    

==--!VW^^mz^  G  HMM$w=JJtG:r*   c                    V P                  W4      w  r2rE\        V P                  V4      w  rgV^ 8  d%   \        \	        R4      P                  W!R7      4      h\        V4       V# )r   ;Could not check if ibpkey {subnet_prefix}/{pkey} is definedr  )r  semanage_ibpkey_existsr   r   r	   formnatr  r&   r  r  rd  r  r  r   r  s   &&&     r'   rs  ibpkeyRecords.__exists  sh    (,d(J%3-dggq96Q\]ee  uBe  N  O  O #r*   c                   VR 8X  d;   VR 8X  d4   \         ^8X  d   \        \        R4      4      h\        \        R4      4      h\        P                  ! V4      pV'       d,   W@P
                  9  d   \        \        R4      V,          4      hV P                  W4      w  rRrg\        V P                  V4      w  rV^ 8  d%   \        \        R4      P                  W!R7      4      hV	'       g%   \        \        R4      P                  W!R7      4      h\        V P                  V4      w  rV^ 8  d%   \        \        R4      P                  W!R7      4      h\        V
4      p\         ^8X  d(   VR 8w  d!   \        V P                  V\        V4      4       VR 8w  d   \        V P                  W4       \        V P                  WZ4      pV^ 8  d%   \        \        R4      P                  W!R7      4      h\!        V4       \#        V
4       R	# )
r
   rA  rB  r  r  r  ,ibpkey {subnet_prefix}/{pkey} is not definedz-Could not query ibpkey {subnet_prefix}/{pkey}z.Could not modify ibpkey {subnet_prefix}/{pkey}N)r   r   r	   r   r$  r  r  r  r   r  semanage_ibpkey_querysemanage_ibpkey_get_conr-  r   r,  r  r  r  )r&   r  r  r9   rF  rd  r  r  r   r  r   r4  s   &&&&&       r'   rz  ibpkeyRecords.__modify  s   b=Vr\" #?!@AA #4!566,,V4f$4$44QJKfTUU(,d(J%3-dggq96Q\]dd  tAd  M  N  NQMNUUdqU}~~'36QNOVVerV~%a(agm$TWWc;w3GHR<%dggs;)$''186QOPWWfsW  A  A #Qr*   c                j    V P                  4        V P                  WW44       V P                  4        R # r   )r   r  rO   )r&   r  r  r9   rF  s   &&&&&r'   r}  ibpkeyRecords.modify  s"    

d7;r*   c                   \        V P                  4      w  rV^ 8  d   \        \        R4      4      hV P	                  4        V F  p\        V P                  V4      w  r\        V4      p\        V4      pV: RV: 2pV P                  Wt4      w  rrVV^ 8  d   \        \        R4      V,          4      h\        V P                  V4      pV^ 8  d   \        \        R4      V,          4      h\        V4       K  	  V P                  4        R# )r   zCould not list the ibpkeysr,   rN  zCould not delete the ibpkey %sN)semanage_ibpkey_list_localr   r   r	   r   !semanage_ibpkey_get_subnet_prefixsemanage_ibpkey_get_lowsemanage_ibpkey_get_highr  semanage_ibpkey_del_localr  rO   )	r&   r   rR  ibpkeyr  r  r  pkey_strrd  s	   &        r'   r   ibpkeyRecords.deleteall  s    096Q;<==

F"CDGGV"TR)&1C+F3D"%t,H,0MM(,R)QsAv #B!Ch!NOO*477A6BAv #C!Dx!OPP$Q'  	r*   c                   V P                  W4      w  r2rE\        V P                  V4      w  rgV^ 8  d%   \        \	        R4      P                  W!R7      4      hV'       g%   \        \	        R4      P                  W!R7      4      h\        V P                  V4      w  rgV^ 8  d%   \        \	        R4      P                  W!R7      4      hV'       g%   \        \	        R4      P                  W!R7      4      h\        V P                  V4      pV^ 8  d%   \        \	        R4      P                  W!R7      4      h\        V4       R# )r   r  r  r  zEibpkey {subnet_prefix}/{pkey} is defined in policy, cannot be deletedz.Could not delete ibpkey {subnet_prefix}/{pkey}N)	r  r  r   r   r	   r  semanage_ibpkey_exists_localr  r  r  s   &&&     r'   r  ibpkeyRecords.__delete  s9   (,d(J%3-dggq96Q\]dd  tAd  M  N  NQMNUUdqU}~~3DGGQ?6Q\]dd  tAd  M  N  NQfgnn  ~Kn  W  X  X&tww26QOPWWfsW  A  A #r*   c                h    V P                  4        V P                  W4       V P                  4        R # r   )r   _ibpkeyRecords__deleterO   )r&   r  r  s   &&&r'   r  ibpkeyRecords.delete  s     

d*r*   c                   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   Fb  p\        V4      p\        V4      pVR8X  d   K"  \        V4      p\        V P                  V4      w  r8\        V4      p	\        V4      p
Wg3W)W3&   Kd  	  V# )r   Could not list ibpkeysreserved_ibpkey_t)r  r   rR  semanage_ibpkey_listr   r	   r  r_  r`  r  r  r  )r&   r   r  r   r  r4  ra  rb  r  r  r  s   &&         r'   r   ibpkeyRecords.get_all  s    9$''BR3DGG<R6Q7899jjF)&1C-c2E++,S1E"CDGGV"TR)&1C+F3D16E,- ! r*   c                :   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   F  p\        V4      p\        V4      p\        V P                  V4      w  r7\        V4      p\        V4      p	Wg3VP                  4       9  d   . W&V3&   W8X  d#   W&V3,          P                  RV,          4       K  W&V3,          P                  RW3,          4       K  	  V# )r   r  0x%xz	0x%x-0x%x)r  r   rR  r  r   r	   r  r_  r  r  r  r  r1   )
r&   r   r  r   r  r4  ra  r  r  r  s
   &&        r'   re  ibpkeyRecords.get_all_by_type-  s    9$''BR3DGG<R6Q7899jjF)&1C-c2E"CDGGV"TR)&1C+F3D%UZZ\902m,-{m,-44Vc\Bm,-44[C;5NO ! r*   c                   . pV P                  R 4      p\        VP                  4       4       F  pV^ ,          V^,          8X  d
   V^ ,          MV^ ,          : RV^,          : 2pW#,          ^,          '       dE   VP                  RW#,          ^ ,          : RW#,          ^,          : RV^,          : RV: 24       K  VP                  RW#,          ^ ,          : RV^,          : RV: 24       K  	  V# )Tr,   rh  r  z' -x r_   z -x r  rj  s   &    r'   r   ibpkeyRecords.customizedD  s    T"

%AQ41Q4<1Q4!ad-CDx{{UXa[[RSTURVRVX\]^QqTT4HI & r*   c           	        V P                  V4      pVP                  4       p\        V4      ^ 8X  d   R# V'       d5   \        \	        R4      :R R\	        R4      :R R\	        R4      : R24       \        V4       FZ  pR	V,          pVR
W5,          ^ ,          ,          ,          pW5,          R,           F  pVRV,          ,          pK  	  \        V4       K\  	  R# )r   NzSELinux IB Pkey Typer  r_   Subnet_Prefix18zPkey Numberr   %-30s %-18s rp  rP  rq  re  r  r   r   r	   r3  rr  s   &&&     r'   r   ibpkeyRecords.listP  s    $$Y/zz|t9>*@(A1_CUWXYfWghiA 1$C4%(1+%%CXb\\vz! "#J r*   rt  r   r   r  )rS   rT   rU   rV   r  r(   r  r  r	  r  r  r}  r   r  r  r   re  r   r   rW   rX   rY   s   @r'   rv  rv  S  sW     K-&6 p$ L
.$(
*.
 r*   rv  c                      a  ] tR tRt o . tRR ltR tR tR tR t	R t
R	 tR
 tR tR tRR ltRR ltR tRR ltRtV tR# )ibendportRecordsi_  Nc                    \         P                  W4        \        \        \        P
                  ! V P                  4      4      R .R7      p\        R VP                  4        4       4      V n	        R#     R# ; i)ibendport_typery  c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r|  r}  s   & r'   r  ,ibendportRecords.__init__.<locals>.<genexpr>g  s     "?;a3q66;r  N)
r   r(   r   r   r   r  r   setr  r  r  s   && r'   r(   ibendportRecords.__init__c  s\      ,	-(A(A$**(MNWgVhiA""?199;"??D	r  c                    VR 8X  d   \        \        R4      4      h\        V4      pV^8  g   V^8  d   \        \        R4      4      h\        V P                  W#4      w  rEV^ 8  d%   \        \        R4      P                  W!R7      4      hWRV3# )r
   zIB device name is requiredzInvalid Port Numberz=Could not create a key for ibendport {ibdev_name}/{ibendport}
ibdev_name	ibendport)r   r	   r  semanage_ibendport_key_creater   r  )r&   r  r  r  r   rd  s   &&&   r'   r  ibendportRecords.__genkeyk  s    Q;<==9~#:Q4566/J6Q^_ffr|f  S  T  Tt$$r*   c                   \         ^8X  d   VR8X  d   RpM\        V4      pVR8X  d   \        \        R4      4      h\        P
                  ! V4      pW@P                  9  d   \        \        R4      V,          4      hV P                  W4      w  rQp\        V P                  4      w  rxV^ 8  d%   \        \        R4      P                  W&R7      4      h\        V P                  W4       \        W4       \        V P                  4      w  ryV^ 8  d%   \        \        R4      P                  W&R7      4      h\        V P                  V	R4      pV^ 8  d%   \        \        R	4      P                  W&R7      4      h\        V P                  V	R
4      pV^ 8  d%   \        \        R4      P                  W&R7      4      h\!        V P                  W4      pV^ 8  d%   \        \        R4      P                  W&R7      4      h\         ^8X  dI   VR8w  dB   \#        V P                  W4      pV^ 8  d%   \        \        R4      P                  W&R7      4      h\%        V P                  W4      pV^ 8  d%   \        \        R4      P                  W&R7      4      h\'        V P                  WX4      pV^ 8  d%   \        \        R4      P                  W&R7      4      h\)        V	4       \+        V4       \-        V4       R# )re   r
   r  r  -Type %s is invalid, must be an ibendport typez2Could not create ibendport for {ibdev_name}/{port}r  r  z/Could not create context for {ibendport}/{port}r   z?Could not set user in ibendport context for {ibdev_name}/{port}r!  z?Could not set role in ibendport context for {ibdev_name}/{port}z?Could not set type in ibendport context for {ibdev_name}/{port}zECould not set mls fields in ibendport context for {ibdev_name}/{port}z7Could not set ibendport context for {ibdev_name}/{port}z+Could not add ibendport {ibdev_name}/{port}N)r   r   r   r	   r   r$  r  _ibendportRecords__genkeysemanage_ibendport_creater   r  !semanage_ibendport_set_ibdev_namesemanage_ibendport_set_portr)  r*  r+  r,  r-  semanage_ibendport_set_consemanage_ibendport_modify_localr0  semanage_ibendport_key_freesemanage_ibendport_free)
r&   r  r  r9   r?  rd  r  r   r   r4  s
   &&&&&     r'   rf  ibendportRecords.__addy  s   Q"}%g.2:Q1233**40'''QNORVVWW#}}YCt+DGG46QST[[gq[}~~)$''1A#A,+DGG4	6QPQXXdnXz{{&twwZ@6Q`ahht~h  K  L  L&twwZ@6Q`ahht~h  K  L  L&tww:6Q`ahht~h  K  L  Lagm)$''3@BAv #j!k!r!r  I!r  "U  V  V'86QXY``lv`  C  D  D,TWWa;6QLMTT`jTvwwc"#A&"r*   c                   V P                  4        V P                  W4      '       d=   \        \        R 4      P	                  V\
        R7      4       V P                  WW44       MV P                  WW44       V P                  4        R# )z@ibendport {ibdev_name}/{port} already defined, modifying insteadr  N)	r   _ibendportRecords__existsr   r	   r  r  _ibendportRecords__modify_ibendportRecords__addrO   )r&   r  r  r9   r?  s   &&&&&r'   r	  ibendportRecords.add  se    

==//!VW^^jt{^  A  BMM)?JJyg<r*   c                    V P                  W4      w  r1p\        V P                  V4      w  rVV^ 8  d%   \        \	        R4      P                  W$R7      4      h\        V4       V# )r   z;Could not check if ibendport {ibdev_name}/{port} is definedr  )r  semanage_ibendport_existsr   r   r	   r  r  r&   r  r  rd  r  r   r  s   &&&    r'   rs  ibendportRecords.__exists  sd    #}}YCt0!<6Q\]ddpzd  G  H  H#A&r*   c                   VR 8X  d;   VR 8X  d4   \         ^8X  d   \        \        R4      4      h\        \        R4      4      h\        P                  ! V4      pV'       d,   W@P
                  9  d   \        \        R4      V,          4      hV P                  W4      w  rRp\        V P                  V4      w  rxV^ 8  d%   \        \        R4      P                  W!R7      4      hV'       g%   \        \        R4      P                  W!R7      4      h\        V P                  V4      w  ryV^ 8  d%   \        \        R4      P                  W!R7      4      h\        V	4      p
\         ^8X  d(   VR 8w  d!   \        V P                  V
\        V4      4       VR 8w  d   \        V P                  W4       \        V P                  WY4      pV^ 8  d%   \        \        R4      P                  W!R7      4      h\!        V4       \#        V	4       R	# )
r
   rA  rB  r  @Could not check if ibendport {ibdev_name}/{ibendport} is definedr  1ibendport {ibdev_name}/{ibendport} is not definedz2Could not query ibendport {ibdev_name}/{ibendport}z3Could not modify ibendport {ibdev_name}/{ibendport}N)r   r   r	   r   r$  r  r  r  r   r  semanage_ibendport_querysemanage_ibendport_get_conr-  r   r,  r  r  r  )r&   r  r  r9   rF  rd  r  r   r  r   r4  s   &&&&&      r'   rz  ibendportRecords.__modify  s   b=Vr\" #?!@AA #4!566,,V4f$4$44QNORXXYY $i D0!<6Qabiiui  V  W  WQRSZZfpZ  G  H  H*477A66QST[[gq[  H  I  I(+agm$TWWc;w3GHR<%dggs;,TWWa;6QTU\\hr\  I  J  J#A&"r*   c                j    V P                  4        V P                  WW44       V P                  4        R # r   )r   r  rO   )r&   r  r  r9   rF  s   &&&&&r'   r}  ibendportRecords.modify  s"    

iW=r*   c                ,   \        V P                  4      w  rV^ 8  d   \        \        R4      4      hV P	                  4        V F  p\        V P                  V4      w  r\        V4      pV P                  \        V4      V4      w  rdpV^ 8  d%   \        \        R4      P                  WER7      4      h\        V P                  V4      pV^ 8  d%   \        \        R4      P                  WER7      4      h\        V4       K  	  V P                  4        R# )r   zCould not list the ibendportsz.Could not create a key for {ibdev_name}/{port}r  z2Could not delete the ibendport {ibdev_name}/{port}N)semanage_ibendport_list_localr   r   r	   r   !semanage_ibendport_get_ibdev_namesemanage_ibendport_get_portr  r5   r  semanage_ibendport_del_localr  rO   )r&   r   rR  r  r  r  rd  s   &      r'   r   ibendportRecords.deleteall  s    3DGG<6Q>?@@

I@)TR.y9D$(MM#d)Z$H!QDAv #S!T![![gq![!}~~-dggq9BAv #W!X!_!_ku!_  "B  C  C'*  	r*   c                   V P                  W4      w  r2p\        V P                  V4      w  rVV^ 8  d%   \        \	        R4      P                  W!R7      4      hV'       g%   \        \	        R4      P                  W!R7      4      h\        V P                  V4      w  rVV^ 8  d%   \        \	        R4      P                  W!R7      4      hV'       g%   \        \	        R4      P                  W!R7      4      h\        V P                  V4      pV^ 8  d%   \        \	        R4      P                  W!R7      4      h\        V4       R# )r   r  r  r  zJibendport {ibdev_name}/{ibendport} is defined in policy, cannot be deletedz3Could not delete ibendport {ibdev_name}/{ibendport}N)	r  r  r   r   r	   r  semanage_ibendport_exists_localr  r  r  s   &&&    r'   r  ibendportRecords.__delete  s=    $i D0!<6Qabiiui  V  W  WQRSZZfpZ  G  H  H6twwB6Qabiiui  V  W  WQklss  @Js  `  a  a)$''156QTU\\hr\  I  J  J#A&r*   c                h    V P                  4        V P                  W4       V P                  4        R # r   )r   _ibendportRecords__deleterO   )r&   r  r  s   &&&r'   r  ibendportRecords.delete  s     

i,r*   c                   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   FW  p\        V4      p\        V4      pVR8X  d   K"  \        V4      p\        V P                  V4      w  r8\        V4      p	Wg3W)V3&   KY  	  V# )r   Could not list ibendportsreserved_ibendport_t)r  r   rR  semanage_ibendport_listr   r	   r  r_  r`  r  r  )
r&   r   r  r   r  r4  ra  rb  r  r  s
   &&        r'   r   ibendportRecords.get_all  s    <TWWER6tww?R6Q:;<<I,Y7C-c2E..,S1E@)TR.y9D).E$% $ r*   c                   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   Fx  p\        V4      p\        V4      p\        V P                  V4      w  r7\        V4      pWg3VP                  4       9  d   . W&V3&   W&V3,          P                  RV,          4       Kz  	  V# )r   r  r  )r  r   rR  r  r   r	   r  r_  r  r  r  r1   )	r&   r   r  r   r  r4  ra  r  r  s	   &&       r'   re   ibendportRecords.get_all_by_type0  s    <TWWER6tww?R6Q:;<<I,Y7C-c2E@)TR.y9D"%**,6-/j)**%&--ftm< $ r*   c                   . pV P                  R 4      p\        VP                  4       4       F  pW#,          ^,          '       dL   VP                  RW#,          ^ ,          : RW#,          ^,          : RV^,          : RV^ ,          : 24       Kc  VP                  RW#,          ^ ,          : RV^,          : RV^ ,          : 24       K  	  V# )Trh  r  z' -z r_   z -z r  r  s   &   r'   r   ibendportRecords.customizedC  s    T"

%Ax{{UXa[[RSTURVRVXYZ[X\]^QqTT1Q4HI	 &
 r*   c           	        V P                  V4      pVP                  4       p\        V4      ^ 8X  d   R# V'       d5   \        \	        R4      :R R\	        R4      :R R\	        R4      : R24       \        V4       FZ  pR	V,          pVR
W5,          ^ ,          ,          ,          pW5,          R,           F  pVRV,          ,          pK  	  \        V4       K\  	  R# )r   NzSELinux IB End Port Typer  r_   zIB Device Namer  ro  r   r  rp  rP  rq  r  rr  s   &&&     r'   r   ibendportRecords.listN  s    $$Y/zz|t9>*D(EqIYGZ\]^k\lmnA 1$C4%(1+%%CXb\\vz! "#J r*   rt  r   r   r  )rS   rT   rU   rV   r  r(   r  r  r	  r  r  r}  r   r   r  r   re  r   r   rW   rX   rY   s   @r'   r  r  _  sW     K%5#n$#L
*'(
(&	 r*   r  c                   ~   a  ] tR tRt o . tRR ltR tR tR tR t	R t
R	 tR
 tR tR tRR ltR tRR ltRtV tR# )nodeRecordsi]  Nc                    \         P                  W4       R R.V n         \        \        \        P
                  ! \        P                  R4      4      ^ ,          R,          4      V n        R#   \         d     R# i ; i)ipv4ipv6	node_typer  N)	r   r(   protocolr   r   r7  r  r  r  r   s   &&r'   r(   nodeRecords.__init__a  sb      ,(	#Dx7I7I;)W$XYZ$[\c$deD 		s   A
A, ,A;:A;c                6   TpTpR pVR 8X  d   \        \        R4      4      h\        V4      ^ 8X  g   V^ ,          R8X  dZ   \        P                  ! W,           4      p\        VP                  4      p\        VP                  4      pRVP                  ,          p V P                  P                  V4      p \        P                  ! T4      pYEYh3#    \        \        R4      4      h; i   TR8X  d   \        P                  p L8\        \        R4      4      h; i)r
   zNode Address is requiredr  zipv%dzUnknown or missing protocolr  )r   r	   r   	ipaddress
ip_networkr5   network_addressnetmaskversionr  indexr   r3  IPPROTO_IPIP)	r&   addrmaskr  newaddrnewmasknewprotocolr   audit_protocols	   &&&&     r'   validatenodeRecords.validatei  s    2:Q9:;; t9>T!W^$$T[1A!++,G!))nG*H	?----h7K
	C#228<N <<	?Q<=>>	C
 F"!'!4!4 #@!ABBs   C 6C) C&)DDc                   V P                  WV4      w  rr6\        ^8X  d   VR8X  d   RpM\        V4      pVR8X  d   \        \	        R4      4      h\
        P                  ! V4      pWPP                  9  d   \        \	        R4      V,          4      h\        V P                  WV4      w  rxV^ 8  d   \        \	        R4      V,          4      h\        V P                  4      w  ryV^ 8  d   \        \	        R4      V,          4      h\        W4       \        V P                  WV4      p\        V P                  4      w  rzV^ 8  d   \        \	        R4      V,          4      h\        V P                  WV4      pV^ 8  d   \        \	        R4      V,          4      h\        V P                  V
R	4      pV^ 8  d   \        \	        R
4      V,          4      h\!        V P                  V
R4      pV^ 8  d   \        \	        R4      V,          4      h\#        V P                  W4      pV^ 8  d   \        \	        R4      V,          4      h\        ^8X  d@   VR8w  d9   \%        V P                  W4      pV^ 8  d   \        \	        R4      V,          4      h\'        V P                  W4      pV^ 8  d   \        \	        R4      V,          4      h\)        V P                  W4      pV^ 8  d   \        \	        R4      V,          4      h\+        V
4       \-        V4       \/        V	4       V P0                  P3                  RV: RV: RV: RR	: RR: RV: RV: 24       R# )re   r
   r  zSELinux node type is required'Type %s is invalid, must be a node typeCould not create key for %szCould not create addr for %sCould not create context for %szCould not set mask for %sr   z)Could not set user in addr context for %sr!  z)Could not set role in addr context for %sz)Could not set type in addr context for %sz/Could not set mls fields in addr context for %sz!Could not set addr context for %szCould not add addr %szresrc=node op=add laddr=	 netmask=r"  r#  r  N)r#  r   r   r   r	   r   r$  r  semanage_node_key_creater   semanage_node_createsemanage_node_set_protosemanage_node_set_addrr)  semanage_node_set_maskr*  r+  r,  r-  semanage_node_set_consemanage_node_modify_localr0  semanage_node_key_freesemanage_node_freer   rI   )r&   r  r  r  r9   ra  audit_protor   rd  noder4  s   &&&&&&     r'   rf  nodeRecords.__add  s   )-t5)I&EQ"}%g.B;Q>?@@++E2(((QHIEQRR*477DF6Q<=DEE)$''2
6Q=>EFF,#DGGT$?+DGG4	6Q@ADHII#DGGT$?6Q:;dBCC&twwZ@6QJKdRSS&twwZ@6QJKdRSS&tww;6QJKdRSSagm)$''3@BAv #T!UX\!\]]"477D66QBCdJKK'96Q67$>??c"q!4 

gkmqs~  AK  MW  Y^  `g  h  	ir*   c                    V P                  4        V P                  WV4      '       d0   \        \        R 4      V,          4       V P	                  WW4V4       MV P                  WW4V4       V P                  4        R# )z*Addr %s already defined, modifying insteadN)r   _nodeRecords__existsr   r	   _nodeRecords__modify_nodeRecords__addrO   )r&   r  r  r  r9   ra  s   &&&&&&r'   r	  nodeRecords.add  sX    

==U++!@ADHIMM$ee<JJt559r*   c                0   V P                  WV4      w  rr4\        V P                  WV4      w  rVV^ 8  d   \        \	        R4      V,          4      h\        V P                  V4      w  rWV^ 8  d   \        \	        R4      V,          4      h\        V4       V# )r   r'  %Could not check if addr %s is defined)r#  r*  r   r   r	   semanage_node_existsr1  r&   r  r  r  r3  r   rd  r  s   &&&&    r'   rs  nodeRecords.__exists  s    )-t5)I&E*477DF6Q<=DEE+DGGQ76QFG$NOOq!r*   c                h   V P                  WV4      w  rr6VR 8X  d   VR 8X  d   \        \        R4      4      h\        P                  ! V4      pV'       d,   WPP
                  9  d   \        \        R4      V,          4      h\        V P                  WV4      w  rxV^ 8  d   \        \        R4      V,          4      h\        V P                  V4      w  ryV^ 8  d   \        \        R4      V,          4      hV	'       g   \        \        R4      V,          4      h\        V P                  V4      w  rzV^ 8  d   \        \        R4      V,          4      h\        V
4      p\        ^8X  d(   VR 8w  d!   \        V P                  V\        V4      4       VR 8w  d   \        V P                  W4       \        V P                  W4      pV^ 8  d   \        \        R4      V,          4      h\!        V4       \#        V
4       V P$                  P'                  RV: R	V: R
V: RR: RR: RV: RV: 24       R# )r
   rA  r&  r'  r<  Addr %s is not definedzCould not query addr %szCould not modify addr %szresrc=node op=modify laddr=r)  r"  r#  r   r  r!  N)r#  r   r	   r   r$  r  r*  r   r=  semanage_node_querysemanage_node_get_conr   r-  r   r,  r0  r1  r2  r   rI   )r&   r  r  r  r9   rF  r3  r   rd  r  r4  r4  s   &&&&&&      r'   rz  nodeRecords.__modify  s   )-t5)I&Eb=Vr\Q;<==,,V4f$4$44QHIFRSS*477DF6Q<=DEE+DGGQ76QFG$NOOQ784?@@(!4
6Q89D@AA#D)agm$TWWc;w3GHR<%dggs;'96Q9:TABBq!4 

jnpt  wB  DN  PZ  \b  dk  l  	mr*   c                l    V P                  4        V P                  WW4V4       V P                  4        R # r   )r   r8  rO   )r&   r  r  r  r9   rF  s   &&&&&&r'   r}  nodeRecords.modify  s$    

d%&9r*   c                   V P                  WV4      w  rr4\        V P                  WV4      w  rVV^ 8  d   \        \	        R4      V,          4      h\        V P                  V4      w  rWV^ 8  d   \        \	        R4      V,          4      hV'       g   \        \	        R4      V,          4      h\        V P                  V4      w  rWV^ 8  d   \        \	        R4      V,          4      hV'       g   \        \	        R4      V,          4      h\        V P                  V4      pV^ 8  d   \        \	        R4      V,          4      h\        V4       V P                  P                  RV: RV: RV: 24       R	# )
r   r'  r<  rA  z/Addr %s is defined in policy, cannot be deletedzCould not delete addr %szresrc=node op=delete laddr=r)  r"  N)r#  r*  r   r   r	   r=  semanage_node_exists_localsemanage_node_del_localr1  r   rI   r>  s   &&&&    r'   r  nodeRecords.__delete  s*   )-t5)I&E*477DF6Q<=DEE+DGGQ76QFG$NOOQ784?@@1$''1=6QFG$NOOQPQTXXYY$TWWa06Q9:TABBq!

UY[_almnr*   c                j    V P                  4        V P                  WV4       V P                  4        R # r   )r   _nodeRecords__deleterO   )r&   r  r  r  s   &&&&r'   r  nodeRecords.delete,  s"    

d%(r*   c           	        \        V P                  4      w  rV^ 8  d   \        \        R4      4      hV P	                  4        V Ff  pV P                  \        V P                  V4      ^,          \        V P                  V4      ^,          V P                  \        V4      ,          4       Kh  	  V P                  4        R# )r   z!Could not deleteall node mappingsN)semanage_node_list_localr   r   r	   r   rL  semanage_node_get_addrsemanage_node_get_maskr  semanage_node_get_protorO   )r&   r   nlistr4  s   &   r'   r   nodeRecords.deleteall1  s    .tww76QBCDD

DMM0$?BDZ[_[b[bdhDijkDlnrn{n{  }T  UY  }Z  o[  \ r*   c                   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   F  p\        V4      p\        V P                  V4      p\        V P                  V4      pV P                  \        V4      ,          p\        V4      \        V4      \        V4      \        V4      3W&^,          V^,          V3&   K  	  V# )r   zCould not list addrs)rO  r   ilistsemanage_node_listr   r	   rC  rP  rQ  r  rR  semanage_context_get_usersemanage_context_get_roler_  r`  )	r&   r   r  r   r4  r4  r  r  r  s	   &&       r'   r   nodeRecords.get_all;  s    7@R1$'':R6Q5677JJD'-C)$''48D)$''48DMM"9$"?@E0I#0NPijmPn  qJ  KN  qO  Qi  jm  Qn  0oE7DGU+,  r*   c                   . pV P                  R 4      p\        VP                  4       4       F  pW#,          ^,          '       dW   VP                  RV^,          : RV^,          : RW#,          ^,          : RW#,          ^,          : RV^ ,          : 2
4       Kn  VP                  RV^,          : RV^,          : RW#,          ^,          : RV^ ,          : 24       K  	  V# )Tz-a -M ri   -t r  r  r_   r  r  s   &   r'   r   nodeRecords.customizedM  s    T"

%Ax{{addAaDD%(ST++W\W_`aWbWbdefgdhijaddAaDD%(1++qQRtTU	 &
 r*   c                   V P                  V4      p\        V4      ^ 8X  d   R# \        VP                  4       4      pV'       d    \	        R:R RR:R RR:R RR:R R	24       \
        '       d   V F  pR
pV F  pVR,           \        V4      ,           pK  	  \	        V^ ,          :R RV^,          :R RV^,          :R RW5,          ^ ,          : RW5,          ^,          : RW5,          ^,          : R\        W5,          ^,          R4      : R24       K  	  R# V Fe  p\	        V^ ,          :R RV^,          :R RV^,          :R RW5,          ^ ,          : RW5,          ^,          : RW5,          ^,          : R24       Kg  	  R# )r   Nz
IP Addressr  r_   NetmaskProtocolr   Contextr   r
   	r  F)r   r   r3  r  r   r   r5   r   )r&   r   r   r  r  rd  valfieldss   &&&     r'   r   nodeRecords.listW  sF   Y'u:?ejjl#|Y
T]^_>F*s6{2C  1qttQqTT58TU;;X]X`abXcXcejemnoepepr{  }B  }E  FG  }H  JO  sP  Q  R	  addAaDD!A$$QRUZU]^_U`U`bgbjklbmbmno r*   )rV  r  r  r   r   r  )rS   rT   rU   rV   r  r(   r#  r9  r	  r7  r8  r}  rL  r  r   r   r   r   rW   rX   rY   s   @r'   r  r  ]  sY     K =D@iD&mP
o6
$p pr*   r  c                   t   a  ] tR tRt o RR ltR tR tR tR tR t	R	 t
R
 tR tRR ltR tRR ltRtV tR# )interfaceRecordsij  Nc                0    \         P                  W4       R # r   r   r   s   &&r'   r(   interfaceRecords.__init__l  r   r*   c                   \         ^8X  d   VR8X  d   RpM\        V4      pVR8X  d   \        \        R4      4      h\	        V P
                  V4      w  rEV^ 8  d   \        \        R4      V,          4      h\        V P
                  4      w  rFV^ 8  d   \        \        R4      V,          4      h\        V P
                  Wa4      p\        V P
                  4      w  rGV^ 8  d   \        \        R4      V,          4      h\        V P
                  VR4      pV^ 8  d   \        \        R4      V,          4      h\        V P
                  VR	4      pV^ 8  d   \        \        R
4      V,          4      h\        V P
                  Ws4      pV^ 8  d   \        \        R4      V,          4      h\         ^8X  d@   VR8w  d9   \        V P
                  Wr4      pV^ 8  d   \        \        R4      V,          4      h\        V P
                  Wg4      pV^ 8  d   \        \        R4      V,          4      h\        V P
                  Wg4      pV^ 8  d   \        \        R4      V,          4      h\        V P
                  WV4      pV^ 8  d   \        \        R4      V,          4      h\!        V4       \#        V4       \%        V4       V P&                  P)                  RV: RR: RR	: RV: RV: 2
4       R# )re   r
   r  SELinux Type is requiredr'  z!Could not create interface for %sr(  r   z.Could not set user in interface context for %sr!  z.Could not set role in interface context for %sz.Could not set type in interface context for %sz4Could not set mls fields in interface context for %sz&Could not set interface context for %sz$Could not set message context for %szCould not add interface %szresrc=interface op=add netif=r#  r  N)r   r   r   r	   semanage_iface_key_creater   semanage_iface_createsemanage_iface_set_namer)  r*  r+  r,  r-  semanage_iface_set_ifconsemanage_iface_set_msgconsemanage_iface_modify_localr0  semanage_iface_key_freesemanage_iface_freer   rI   )r&   	interfacer9   ra  r   rd  ifacer4  s   &&&&    r'   rf  interfaceRecords.__addo  sj   Q"}%g.B;Q9:;;+DGGY?6Q<=	IJJ+DGG46QBCiOPP$TWWe?+DGG4	6Q@AIMNN&twwZ@6QOPS\\]]&twwZ@6QOPS\\]]&tww;6QOPS\\]]agm)$''3@BAv #Y!Z]f!fgg%dggu:6QGH9TUU&tww;6QEFRSS(!;6Q;<yHIIc""E"

Xacmoy  |A  CJ  K  	Lr*   c                    V P                  4        V P                  V4      '       d/   \        \        R 4      V,          4       V P	                  WV4       MV P                  WV4       V P                  4        R# )z/Interface %s already defined, modifying insteadN)r   _interfaceRecords__existsr   r	   _interfaceRecords__modify_interfaceRecords__addrO   )r&   rt  r9   ra  s   &&&&r'   r	  interfaceRecords.add  sR    

==##!EFRSMM)e4JJy51r*   c                   \        V P                  V4      w  r#V^ 8  d   \        \        R4      V,          4      h\	        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      h\        V4       V# )r   r'  *Could not check if interface %s is defined)rl  r   r   r	   semanage_iface_existsrr  r&   rt  r   rd  r  s   &&   r'   rs  interfaceRecords.__exists  sm    +DGGY?6Q<=	IJJ,TWWa86QKLyXYY"r*   c                   VR 8X  d   VR 8X  d   \        \        R4      4      h\        V P                  V4      w  rEV^ 8  d   \        \        R4      V,          4      h\	        V P                  V4      w  rFV^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h\        V P                  V4      w  rGV^ 8  d   \        \        R4      V,          4      h\        V4      p\        ^8X  d(   VR 8w  d!   \        V P                  V\        V4      4       VR 8w  d   \        V P                  W4       \        V P                  WW4      pV^ 8  d   \        \        R4      V,          4      h\        V4       \        V4       V P                  P                  RV: RR	: R
R: R
V: R
V: 2
4       R# )r
   rA  r'  r}  Interface %s is not definedzCould not query interface %szCould not modify interface %sz resrc=interface op=modify netif=r#  r   r  r!  N)r   r	   rl  r   r~  semanage_iface_querysemanage_iface_get_ifconr   r-  r   r,  rq  rr  rs  r   rI   )	r&   rt  r9   rF  r   rd  r  ru  r4  s	   &&&&     r'   rz  interfaceRecords.__modify  su   b=Vr\Q;<==+DGGY?6Q<=	IJJ,TWWa86QKLyXYYQ<=	IJJ*477A66Q=>JKK&u-agm$TWWc;w3GHR<%dggs;(!;6Q>?)KLL"E"

[dfpr|  E  GN  O  	Pr*   c                j    V P                  4        V P                  WV4       V P                  4        R # r   )r   ry  rO   )r&   rt  r9   rF  s   &&&&r'   r}  interfaceRecords.modify  s"    

i&1r*   c                   \        V P                  V4      w  r#V^ 8  d   \        \        R4      V,          4      h\	        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h\        V P                  V4      w  r$V^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h\        V P                  V4      pV^ 8  d   \        \        R4      V,          4      h\        V4       V P                  P                  RV,          4       R# )r   r'  r}  r  z4Interface %s is defined in policy, cannot be deletedzCould not delete interface %sz"resrc=interface op=delete netif=%sN)
rl  r   r   r	   r~  semanage_iface_exists_localsemanage_iface_del_localrr  r   rI   r  s   &&   r'   r  interfaceRecords.__delete  s   +DGGY?6Q<=	IJJ,TWWa86QKLyXYYQ<=	IJJ2477A>6QKLyXYYQUVYbbcc%dggq16Q>?)KLL"

BYNOr*   c                h    V P                  4        V P                  V4       V P                  4        R # r   )r   _interfaceRecords__deleterO   )r&   rt  s   &&r'   r  interfaceRecords.delete  s     

i r*   c                    \        V P                  4      w  rV^ 8  d   \        \        R4      4      hV P	                  4        V F  pV P                  \        V4      4       K  	  V P                  4        R# )r   z(Could not delete all interface  mappingsN)semanage_iface_list_localr   r   r	   r   r  semanage_iface_get_namerO   )r&   r   r  r   s   &   r'   r   interfaceRecords.deleteall	  sX    /86QIJKK

AMM1!45 r*   c                j   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   FD  p\        V4      p\        V4      \        V4      \        V4      \        V4      3V\        V4      &   KF  	  V# )r   zCould not list interfaces)r  r   rV  semanage_iface_listr   r	   r  rX  rY  r_  r`  r  )r&   r   r  r   rt  r4  s   &&    r'   r   interfaceRecords.get_all	  s    8AR2477;R6Q:;<<I*95C9RSV9WYrsvYw  zS  TW  zX  Zr  sv  Zw  9xE))45 $ r*   c           	     T   . pV P                  R 4      p\        VP                  4       4       Fw  pW#,          ^,          '       d:   VP                  RW#,          ^,          : RW#,          ^,          : RV: 24       KQ  VP                  RW#,          ^,          : RV: 24       Ky  	  V# )Trh  r  r  r_   r  r  s   &   r'   r   interfaceRecords.customized	  r  r*   c                \   V P                  V4      p\        V4      ^ 8X  d   R# \        VP                  4       4      pV'       d'   \	        \        R4      :R R\        R4      : R24       \        '       dj   V Fa  p\	        V:R RW5,          ^ ,          : RW5,          ^,          : RW5,          ^,          : R\        W5,          ^,          R4      : R2
4       Kc  	  R# V FF  p\	        V:R RW5,          ^ ,          : RW5,          ^,          : RW5,          ^,          : R24       KH  	  R# )	r   NzSELinux Interfacer  r_   ra  r   r  F)r   r   r3  r  r   r	   r   r   r  s   &&&   r'   r   interfaceRecords.list&	  s    Y'u:?ejjl#!$7"8!I,GH>a!ehqkk58TU;;XabgbjklbmotXuvw  1ehqkk58A;;QRTU r*   )rV  r   r   r  )rS   rT   rU   rV   r(   rz  r	  rx  ry  r}  r  r  r   r   r   r   rW   rX   rY   s   @r'   rg  rg  j  sM     -8Lt
 PD
P2
V Vr*   rg  c                      a  ] tR tRt o . tRR ltR tR tR tRR lt	R t
RR	 ltRR
 ltR tR tR tR tR tR tRR ltR tRR ltRtV tR# )fcontextRecordsi6	  Nc           
        \         P                  W4        \        \        \        P                  ! \        P
                  R 4      4      ^ ,          R,          4      V n        V ;P                  \        \        \        P                  ! \        P
                  R4      4      ^ ,          R,          4      ,          un        / V n        / V n	        RV n
         \        \        P                  ! 4       R4      pVP                  4        F^  pVP                  4       p\!        V4      ^ 8X  d   K%  VP#                  R4      '       d   K>  VP%                  4       w  rEWPP                  V&   K`  	  VP'                  4         \        \        P*                  ! 4       R4      pVP                  4        F^  pVP                  4       p\!        V4      ^ 8X  d   K%  VP#                  R4      '       d   K>  VP%                  4       w  rEWPP                  V&   K`  	  VP'                  4        R#   \         d     ELii ; i  \(         d     Li ; i  \(         d     R# i ; i)	file_typer  device_nodeFr  #N)r   r(   r   r   r7  r  r  r  equiv
equiv_dist	equal_indr  r   selinux_file_context_subs_path	readlinesstripr   r0  r  r  IOError#selinux_file_context_subs_dist_path)r&   r   r  r   target
substitutes   &&    r'   r(   fcontextRecords.__init__:	  s     ,	#Dx7I7I;)W$XYZ$[\c$deDT(--8J8JM*Z%[\]%^_f%g hh 
	g<<>DB\\^GGIq6Q;<<$$%&WWY"%/

6" $ HHJ	gAACSIB\\^GGIq6Q;<<$$%&WWY"*4' $ HHJ;  		"  		  		sD   B&H A*H* >6H* 5A*H;  6H; H'&H'*H87H8;I
	I
c                (   V P                   '       d   \        P                  ! 4       pR V,          p\        VR4      pV P                  P                  4        F-  pVP                  V: RV P                  V,          : R24       K/  	  VP                  4         \        P                  ! V\        P                  ! V4      \        P                  ,          4       \        P                  ! Y!4       RT n         \        P                  V 4       R#     L8; i)z%s.tmpwr_   r   FN)r  r   r  r  r  r  writer  r  chmodstatST_MODErenamer   rO   )r&   	subs_filetmpfiler  r  s   &    r'   rO   fcontextRecords.commit`	  s    >>>>>@I*Ggs#B**//+fdjj.@.@AB ,HHJ"'')"4T\\"BC IIg)"DNt$	s   A D Dc           
         V P                  4        VR 8w  d*   VR,          R 8X  d   \        \        R4      V,          4      hVR 8w  d*   VR,          R 8X  d   \        \        R4      V,          4      hWP                  P	                  4       9   d   \        \        R4      V,          4       W P                  V&   RV n        V P                  P                  R\        P                  ! RV^ 4      : R\        P                  ! RV^ 4      : 24       V P                  4        R	# V P                  V4       V P                  V P                  3 FM  pV FD  pVP                  VR ,           4      '       g   K#  \        \        R
4      WW4,          3,          4      h	  KO  	  V P                  P                  R\        P                  ! RV^ 4      : R\        P                  ! RV^ 4      : 24       W P                  V&   RV n        V P                  4        R	# )r  z=Target %s is not valid. Target is not allowed to end with '/'zESubstitute %s is not valid. Substitute is not allowed to end with '/'z:Equivalence class for %s already exists, modifying insteadTresrc=fcontext op=modify-equal sglobr_   tglobNz4File spec %s conflicts with equivalency rule '%s %s'zresrc=fcontext op=add-equal )r   r   r	   r  r  r   r  r   rI   r    audit_encode_nv_stringrO   r#  r  r0  )r&   r  r  fdictr   s   &&&  r'   	add_equalfcontextRecords.add_equalp	  s   

S=VBZ3.Q^_bhhiiB3!6QfgjttuuZZ__&&!PQTZZ[!+JJv!DNJJ!!ELhLhiprxz{L|  D  [  [  \c  eo  qr  s  #t  uKKMfjj$//2E<<--$Q']%^bhmrmuav%vww  3
 	

UEaEabikqstEuw|  xT  xT  U\  ^h  jk  xl  m  	n'

6r*   c           
        V P                  4        WP                  P                  4       9  d   \        \	        R 4      V,          4      hW P                  V&   RV n        V P                  P                  R\        P                  ! RV^ 4      : R\        P                  ! RV^ 4      : 24       V P                  4        R# )z'Equivalence class for %s does not existTr  r  r_   r  N)r   r  r  r   r	   r  r   rI   r    r  rO   )r&   r  r  s   &&&r'   modify_equalfcontextRecords.modify_equal	  s    

**QHIFRSS'

6

HdHdelntvwHxz  {W  {W  X_  ak  mn  {o  p  	qr*   c                   \        V P                  4      w  r4V^ 8  d   \        \        R4      V,          4      hVR8X  d   Rp\	        V P                  WB4      pV^ 8  d   \        \        R4      V,          4      h\        V P                  VR4      pV^ 8  d   \        \        R4      V,          4      h\        ^8X  d:   \        V P                  VR4      pV^ 8  d   \        \        R4      V,          4      hV# )	r   r(  r
   r   z)Could not set user in file context for %sr!  z)Could not set role in file context for %sr  /Could not set mls fields in file context for %s)r)  r   r   r	   r*  r+  r   r-  )r&   r  r  r   r4  s   &&&  r'   	createconfcontextRecords.createcon	  s    +DGG4	6Q@AFJKKR<F&tww<6QJKfTUU&twwZ@6QJKfTUUQ)$''3=BAv #T!UX^!^__
r*   c           	        VR 8X  g   VP                  R4      ^ 8  d   \        \        R4      4      hVP                  R4      R8w  d   \        \        R4      4      hV P                  V P                  3 Fl  pV Fc  pVP                  VR,           4      '       g   K#  \        P                  ! W2V,          V4      p\        \        R4      WW#,          V3,          4      h	  Kn  	  R# )	r
   r   zInvalid file specificationr_   z)File specification can not include spacesr  zMFile spec %s conflicts with equivalency rule '%s %s'; Try adding '%s' insteadNr  )findr   r	   r  r  r0  rw   sub)r&   r  r  r   r   s   &&   r'   r#  fcontextRecords.validate	  s    R<6;;t,1Q;<==;;sr!QJKLLjj$//2E$$QW--q(F3A$Q'v%w  |B  GL  GO  QR  {S  &S  T  T  3r*   c                   V P                  V4       \        ^8X  d   \        V4      pVR8X  d   \        \	        R4      4      hVR8w  dB   \
        P                  ! V4      pW P                  9  d   \        \	        R4      V,          4      h\        V P                  V\        V,          4      w  rgV^ 8  d   \        \	        R4      V,          4      h\        V P                  4      w  rhV^ 8  d   \        \	        R4      V,          4      h\        V P                  W4      pVR8w  d   V P                  W4      p	\        V P                  W4      pV^ 8  d   \        \	        R4      V,          4      h\        ^8X  d@   VR8w  d9   \        V P                  W4      pV^ 8  d   \        \	        R4      V,          4      h\!        V P                  W4      pV^ 8  d   \        \	        R	4      V,          4      h\#        V\        V,          4       \%        V P                  Wx4      pV^ 8  d   \        \	        R
4      V,          4      hVR8w  d   \'        X	4       \)        V4       \+        V4       V'       g   RpV P,                  P/                  R\0        P2                  ! RV^ 4      : R\4        V,          : RV: RR: RV: RV: 24       R# )re   r
   rk  <<none>>1Type %s is invalid, must be a file or device typer'  z$Could not create file context for %sz)Could not set type in file context for %sr  !Could not set file context for %sz!Could not add file context for %sr   zresrc=fcontext op=add r   ftype=r#  r  r!  N)r#  r   r   r   r	   r   r$  r  semanage_fcontext_key_creater   
file_typessemanage_fcontext_createsemanage_fcontext_set_exprr  r,  r-  semanage_fcontext_set_consemanage_fcontext_set_typesemanage_fcontext_modify_localr0  semanage_fcontext_key_freesemanage_fcontext_freer   rI   r    r  ftype_to_audit)
r&   r  r?  ftyper9   r  r   rd  fcontextr4  s
   &&&&&&    r'   rf  fcontextRecords.__add	  si   fQ!'*G2:Q9:;;:..t4D+++ #V!WZ^!^__.tww
5@QR6Q<=FGG1$'':6QEFOPP'B:..0C*477C>BAv #N!ORX!XYY!#'R--dggsD6$Q'X%Y\b%bcc*477HBBAv #F!G&!PQQ"8Z->?+DGGQA6QBCfLMM:!#&"1%x(F

Z_ZvZvw~  AG  IJ  [K  M[  \a  Mb  Mb  dj  lv  x|  ~E  F  	Gr*   c                    V P                  4        V P                  W4      '       d0   \        \        R 4      V,          4       V P	                  WW4V4       MV P                  WW4V4       V P                  4        R# )z6File context for %s already defined, modifying insteadN)r   _fcontextRecords__existsr   r	   _fcontextRecords__modify_fcontextRecords__addrO   )r&   r  r?  r  r9   r  s   &&&&&&r'   r	  fcontextRecords.add	  sW    

==''!LMPVVWMM&?JJvUV<r*   c                   \        V P                  V\        V,          4      w  r4V^ 8  d   \        \	        R4      V,          4      h\        V P                  V4      w  r5V^ 8  d   \        \	        R4      V,          4      hV'       g;   \        V P                  V4      w  r5V^ 8  d   \        \	        R4      V,          4      h\        V4       V# )r   r'  1Could not check if file context for %s is defined)r  r   r  r   r	   semanage_fcontext_existssemanage_fcontext_exists_localr  r&   r  r  r   rd  r  s   &&&   r'   rs  fcontextRecords.__exists	  s    .tww
5@QR6Q<=FGG/;6QRSV\\]]9$''1ELRAv #V!WZ`!`aa"1%r*   c                D   VR 8X  d#   VR 8X  d   VR 8X  d   \        \        R4      4      hVR9  dB   \        P                  ! V4      pW P                  9  d   \        \        R4      V,          4      hV P                  V4       \        V P                  V\        V,          4      w  rgV^ 8  d   \        \        R4      V,          4      h\        V P                  V4      w  rhV^ 8  d   \        \        R4      V,          4      hV'       d    \        V P                  V4      w  riMv\        V P                  V4      w  rhV^ 8  d   \        \        R4      V,          4      hV'       g   \        \        R4      V,          4      h \        V P                  V4      w  riVR8w  d   \        V	4      p
V
f   V P                  V4      p
\         ^8X  d(   VR 8w  d!   \#        V P                  V
\%        V4      4       VR 8w  d   \'        V P                  W4       VR 8w  d   \)        V P                  W4       \+        V P                  W4      pV^ 8  d   \        \        R	4      V,          4      hM9\+        V P                  V	R4      pV^ 8  d   \        \        R	4      V,          4      h\-        V P                  Wy4      pV^ 8  d   \        \        R
4      V,          4      h\/        V4       \1        V	4       V'       g   RpV P2                  P5                  R\6        P8                  ! RV^ 4      : R\:        V,          : RV: RR: RV: RV: 24       R#   \         d    \        \        R4      T,          4      hi ; i  \         d    \        \        R4      T,          4      hi ; i)r
   z"Requires setype, serange or seuserr  r  rN  r  z#Could not query file context for %s"File context for %s is not definedNr  z$Could not modify file context for %sr   zresrc=fcontext op=modify r  r  r#  r  r!  )r
   r  )r   r	   r   r$  r  r#  r  r   r  r  semanage_fcontext_queryOSErrorr  semanage_fcontext_query_localsemanage_fcontext_get_conr  r   r-  r   r*  r,  r  r  r  r  r   rI   r    r  r  )r&   r  rF  r  r9   r  r   rd  r  r  r4  s   &&&&&&     r'   rz  fcontextRecords.__modify	
  s8   b=Vr\flQCDEE**008F--- #V!WZ`!`aaf.tww
5@QR6Q>?&HII/;6QRSV\\]]T!8!!DX :$''1ELRAv #V!WZ`!`aa #G!H6!QRRT!>tww!J Z+H5C{nnV,!#'R-(#{77KL|)$''3?|)$''3?*477HBBAv #F!G&!PQQ  +477HdCBAv #F!G&!PQQ+DGGQA6QEFOPP"1%x(F

]b]y]y  {B  DJ  LM  ^N  P^  _d  Pe  Pe  gm  oy  {A  CJ  K  	L[  T #H!IF!RSST  T #H!IF!RSSTs   M M8 'M58'Nc                l    V P                  4        V P                  WW4V4       V P                  4        R # r   )r   r  rO   )r&   r  rF  r  r9   r  s   &&&&&&r'   r}  fcontextRecords.modifyL
  s$    

fef=r*   c           	        \        V P                  4      w  rV^ 8  d   \        \        R4      4      hV P	                  4        V F  p\        V4      p\        V4      p\        V4      p\        V P                  V\        V,          4      w  rV^ 8  d   \        \        R4      V,          4      h\        V P                  V4      pV^ 8  d   \        \        R4      V,          4      h\        V4       V P                  P                  R\        P                  ! RV^ 4      : R\         \"        V,          ,          : 24       K  	  / V n        RV n        V P)                  4        R# )	r   z Could not list the file contextsrN  z$Could not delete the file context %sresrc=fcontext op=delete r  r  TN)semanage_fcontext_list_localr   r   r	   r   semanage_fcontext_get_exprsemanage_fcontext_get_typesemanage_fcontext_get_type_strr  r  semanage_fcontext_del_localr  r   rI   r    r  r  file_type_str_to_optionr  r  rO   )r&   r   flistr  r  r  	ftype_strrd  s   &       r'   r   fcontextRecords.deleteallQ
  s/   2477;6QABCC

H/9F.x8E6u=I2477FJyDYZGRAv #B!Cf!LMM,TWWa8BAv #I!JV!STT&q)JJ!!ELhLhiprxz{L|  M  Ne  fo  Np  q  #r  s  
r*   c                   WP                   P                  4       9   d]   V P                   P                  V4       R V n        V P                  P                  R\        P                  ! RV^ 4      ,          4       R# \        V P                  V\        V,          4      w  r4V^ 8  d   \        \        R4      V,          4      h\        V P                  V4      w  r5V^ 8  d   \        \        R4      V,          4      hV'       gy   \        V P                  V4      w  r5V^ 8  d   \        \        R4      V,          4      hV'       d   \        \        R4      V,          4      h\        \        R4      V,          4      h\        V P                  V4      pV^ 8  d   \        \        R4      V,          4      h\!        V4       V P                  P                  R	\        P                  ! RV^ 4      : R
\"        V,          : 24       R# )Tz!resrc=fcontext op=delete-equal %sr  NrN  r  z;File context for %s is defined in policy, cannot be deletedr  z$Could not delete file context for %sr  r  )r  r  popr  r   rI   r    r  r  r   r  r   r	   r  r  r  r  r  r  s   &&&   r'   r  fcontextRecords.__deletek
  s   ZZ__&&JJNN6"!DNJJ!!"EIeIefmouwxIy"z{.tww
5@QR6Q>?&HII5dggqA6QRSV\\]]3DGGQ?LRAv #V!WZ`!`aa #`!adj!jkk #G!H6!QRR(!46QEFOPP"1%

HdHdelntvwHx  {I  JO  {P  Q  	Rr*   c                h    V P                  4        V P                  W4       V P                  4        R # r   )r   _fcontextRecords__deleterO   )r&   r  r  s   &&&r'   r  fcontextRecords.delete
  s     

f$r*   c                   V'       d   \        V P                  4      w  q n        M\        V P                  4      w  q n        V^ 8  d   \	        \        R4      4      h\        V P                  4      w  r#V^ 8  d   \	        \        R4      4      h\        V P                  4      w  r$V^ 8  d   \	        \        R4      4      hV ;P                  V,          un        V ;P                  V,          un        / pV P                   Fl  p\        V4      p\        V4      p\        V4      p	\        V4      p
V
'       d1   \        V
4      \        V
4      \        V
4      \        V
4      3WWV	3&   Kg  WWy3&   Kn  	  V# )r   zCould not list file contextsz1Could not list file contexts for home directoriesz"Could not list local file contexts)r  r   r  semanage_fcontext_listr   r	   semanage_fcontext_list_homedirsr  r  r  r  rX  rY  r_  r`  )r&   r   r   
fchomedirsfclocalr  r  exprr  r  r4  s   &&         r'   r   fcontextRecords.get_all
  sK   ;DGGDR5dgg>RAv #A!BCC>twwGRAv #V!WXX8AMRAv #G!HIIJJ*$JJJ'!J

H-h7D.x8E6u=I+H5C,Ec,JLefiLj  mF  GJ  mK  Me  fi  Mj  ,kY'(+.t'( # r*   c                   . pV P                  R 4      pVP                  4        F  pW#,          '       g   K  W#,          ^,          '       dX   VP                  R\        V^,          ,          : RW#,          ^,          : RW#,          ^,          : RV^ ,          : R2	4       K  VP                  R\        V^,          ,          : RW#,          ^,          : RV^ ,          : R24       K  	  \	        V P
                  4      '       dL   V P
                  P                  4        F-  pVP                  RV P
                  V,          : RV: 24       K/  	  V# )	Tz-a -f r\  r  z' ''z 'z-a -e r_   )r   r  r1   r  r   r  )r&   r   	fcon_dictrd  r  s   &    r'   r   fcontextRecords.customized
  s   LL&	!A||<??HH>UVWXYVZ>[>[]f]ijk]l]lnwnz{|n}n}  @A  BC  @D  @D  E  FHH6MaPQd6S6SU^UabcUdUdfghifjfjkl " tzz??**//+$**V*<*<fEF ,r*   c                L   V P                  V4      p\        V4      ^ 8w  Ed   V'       d5   \        \        R4      :R R\        R4      :R R\        R4      : R24       V'       d   VP	                  4       pM\        VP	                  4       4      pV EF  pW5,          '       d   \        '       dt   \        V^ ,          :R RV^,          :R RW5,          ^ ,          : RW5,          ^,          : RW5,          ^,          : R\        W5,          ^,          R	4      : R24       K  \        V^ ,          :R RV^,          :R RW5,          ^ ,          : RW5,          ^,          : RW5,          ^,          : R2
4       K  \        V^ ,          :R RV^,          :R R
24       EK  	  \        V P                  4      '       di   V'       ga   V'       d   \        \        R4      4       V P                  P	                  4        F&  p\        V: RV P                  V,          : 24       K(  	  \        V P                  4      '       dc   V'       d   \        \        R4      4       V P                  P	                  4        F&  p\        V: RV P                  V,          : 24       K(  	  R# R# )r   zSELinux fcontext50r_   r?  r  ra  r   r  Fz	 <<None>>z,
SELinux Distribution fcontext Equivalence 
z = z%
SELinux Local fcontext Equivalence 
N)
r   r   r   r	   r  r3  r   r   r  r  )r&   r   r   r	  fkeysrd  r  s   &&&    r'   r   fcontextRecords.list
  s   LL+	y>QA.@,A1V9aPYl[\!(y~~/0<<%~AaDD!A$$	UVYbYefgYhYhjsjvwxjyjy  |E  FO  FR  ST  FU  W\  |]  ^  _1qttY\RS__V_VbcdVeVegpgstugvgvwxAaDD!A$$?@  t!LMN"oo224Fvtv/FGH 5tzz??aABC**//+64::f+=>? ,	 r*   )r  r  r  r  r  r   )r   )r
   r
   r   r   r  )rS   rT   rU   rV   r  r(   rO   r  r  r  r#  r  r	  r  r  r}  r   r  r  r   r   r   rW   rX   rY   s   @r'   r  r  6	  sp     K$L% :	,	T4Gl"ALF
4RB
@@ @r*   r  c                   x   a  ] tR tRt o RR ltR tRR ltR tR tR t	R	 t
RR
 ltR tR tR tRR ltRtV tR# )booleanRecordsi
  Nc                   \         P                  W4       / V n        ^V P                  R&   ^ V P                  R&   ^V P                  R&   ^ V P                  R&   ^V P                  R&   ^ V P                  R&    \        P                  ! 4       w  q n        \        P                  ! 4       w  r#T P                  R8X  g   T P                  T8X  d
   R	T n        R# R
T n        R#    . T n        Rp LA; i)re   TRUEFALSEONOFF10Nr
   TF)	r   r(   dictr   security_get_boolean_namescurrent_booleansr   r   modify_local)r&   r   r   ptypes   &&  r'   r(   booleanRecords.__init__
  s      ,			&		'		$		%		#		#	(/(J(J(L%B%557IB
 ::tzzU2 $D %D	$&D!Es   83C C,c                <   \         P                  ! V4      p\        V P                  V4      w  r4V^ 8  d   \	        \        R4      V,          4      h\        V P                  V4      w  r5V^ 8  d   \	        \        R4      V,          4      hV'       g   \	        \        R4      V,          4      h\        V P                  V4      w  r6V^ 8  d   \	        \        R4      V,          4      hVP                  4       V P                  9   d,   \        W`P                  VP                  4       ,          4       MB\	        \        R4      RP                  V P                  P                  4       4      ,          4      hV P                  '       dI   WP                  9   d9   \        V P                  WF4      pV^ 8  d   \	        \        R4      V,          4      h\!        V P                  WF4      pV^ 8  d   \	        \        R4      V,          4      h\#        V4       \%        V4       R	# )
r   rN  (Could not check if boolean %s is definedBoolean %s is not definedzCould not query file context %sz0You must specify one of the following values: %sz, (Could not set active value of boolean %szCould not modify boolean %sN)r   selinux_boolean_subsemanage_bool_key_creater   r   r	   semanage_bool_existssemanage_bool_queryupperr  semanage_bool_set_valuerF  r  r  r  semanage_bool_set_activesemanage_bool_modify_localsemanage_bool_key_freesemanage_bool_free)r&   r7   valuer   rd  r  r   s   &&&    r'   __modbooleanRecords.__mod
  s   **40*477D96Q>?$FGG+DGGQ76QIJTQRRQ:;dBCC%dggq16Q@ADHII;;=DII%#Ayy'?@QQRUYU^U^_c_h_h_m_m_oUppqq)>)>!>)$''18BAv #M!NQU!UVV'66Q<=DEEq!1r*   c           	     *   V P                  4        V'       d   \        V4      pVP                  4       P                  R 4       Fg  pVP	                  4       p\        V4      ^ 8X  d   K%   VP                  R4      w  rgT P                  TP	                  4       TP	                  4       4       Ki  	  VP                  4        MV P                  W4       V P                  4        R#   \         d&    \        \        R4      P                  YR7      4      hi ; i)r   =z&Bad format {filename}: Record {record})filenamerecordN)r   r  r  r  r  r   r   r	   r  _booleanRecords__modr  rO   )r&   r7   r,  use_filer  r   boolnamerc  s   &&&&    r'   r}  booleanRecords.modify  s    

dBWWY__T*GGIq6Q;r$%GGCLMH 

8>>+SYY[9 + HHJJJt# " r$Q'O%P%W%Wae%W%pqqrs   )C""0Dc                   \         P                  ! V4      p\        V P                  V4      w  r#V^ 8  d   \	        \        R4      V,          4      h\        V P                  V4      w  r$V^ 8  d   \	        \        R4      V,          4      hV'       g   \	        \        R4      V,          4      h\        V P                  V4      w  r$V^ 8  d   \	        \        R4      V,          4      hV'       g   \	        \        R4      V,          4      h\        V P                  V4      pV^ 8  d   \	        \        R4      V,          4      h\        V4       R# )r   rN  r  r   z2Boolean %s is defined in policy, cannot be deletedzCould not delete boolean %sN)
r   r"  r#  r   r   r	   r$  semanage_bool_exists_localsemanage_bool_del_localr*  rr  s   &&   r'   r  booleanRecords.__delete,  s   **40*477D96Q>?$FGG+DGGQ76QIJTQRRQ:;dBCC1$''1=6QIJTQRRQSTW[[\\$TWWa06Q<=DEEq!r*   c                    V P                  4        V P                  V4       V P                  4        V P                  4        V P                  V4       V P                  4        R # r   )r   _booleanRecords__deleterO   _booleanRecords__reset_valuer&   r7   s   &&r'   r  booleanRecords.deleteD  sB    

d
 	

4 r*   c                   . p\        V P                  4      w  q n        V^ 8  d   \        \	        R4      4      hV P                  4        V P                   F0  p\        V4      pVP                  V4       V P                  V4       K2  	  V P                  4        V P                  4        V F  pV P                  V4       K  	  V P                  4        R# )r   Could not list booleansN)semanage_bool_list_localr   blistr   r	   r   semanage_bool_get_namer1   r<  rO   r=  )r&   deletedr   booleanr7   s   &    r'   r   booleanRecords.deleteallP  s    3DGG<Z6Q89::

zzG)'2DNN4 MM$ "
 	
 	

Gw'  	r*   c                   \         P                  ! V4      p\        V P                  V4      w  r#V^ 8  d   \	        \        R4      V,          4      h\        V P                  V4      w  r$V^ 8  d   \	        \        R4      V,          4      h\        V\        V4      4       \        V P                  W44      pV^ 8  d   \	        \        R4      V,          4      h\        V4       \        V4       R# )r   rN  zCould not query boolean %sr!  N)r   r"  r#  r   r   r	   r%  r'  semanage_bool_get_valuer(  r*  r+  )r&   r7   r   rd  r   s   &&   r'   __reset_valuebooleanRecords.__reset_valuem  s    **40*477D96Q>?$FGG%dggq16Q;<tCDD#:1#=>%dggq46QIJTQRRq!1r*   c                x   / pV'       d   \        V P                  4      w  q0n        M\        V P                  4      w  q0n        V^ 8  d   \	        \        R4      4      hV P                   F  p. p\        V4      pVP                  \        V4      4       V P                  '       d\   W`P                  9   dL   VP                  \        P                  ! V4      4       VP                  \        P                  ! V4      4       M0VP                  V^ ,          4       VP                  V^ ,          4       WRV&   K  	  V# )r   rA  )rB  r   rC  semanage_bool_listr   r	   rD  r1   rI  r  r  r   security_get_boolean_pendingsecurity_get_boolean_active)r&   r   r  r   rF  r,  r7   s   &&     r'   r   booleanRecords.get_all  s    7@R1$'':R6Q89::zzGE)'2DLL09:   T-B-B%BWAA$GHW@@FGU1X&U1X&$K " r*   c                Z    \         P                  ! V4      p\        P                  ! V4      # r   )r   r"  r   boolean_descr>  s   &&r'   get_descbooleanRecords.get_desc  s#    **40$$T**r*   c                Z    \         P                  ! V4      p\        P                  ! V4      # r   )r   r"  r   boolean_categoryr>  s   &&r'   get_categorybooleanRecords.get_category  s#    **40((..r*   c                    . pV P                  R 4      p\        VP                  4       4       F9  pW#,          '       g   K  VP                  RW#,          ^,          : RV: 24       K;  	  V# )Tz-m -r_   r  r  s   &   r'   r   booleanRecords.customized  sQ    T"

%AxxQ78 & r*   c                   \        R 4      \        R4      3pV'       dc   V P                  V4      p\        VP                  4       4       F2  pWV,          '       g   K  \	        V: RWV,          ^,          : 24       K4  	  R# V P                  V4      p\        V4      ^ 8X  d   R# V'       dA   \	        \        R4      :R R\        R4      : R\        R	4      : R\        R
4      : R24       \        VP                  4       4       Fg  pWV,          '       g   K  \	        V:R RWEV,          ^,          ,          :R RWEV,          ^ ,          ,          :R RV P                  V4      : 24       Ki  	  R# )r#  r"  r0  NzSELinux booleanr  r_   Statez  DefaultDescriptionr   z (r   r.   z>5z)  )r	   r   r3  r  r   r   rS  )r&   r   r   r4  on_offr  rd  s   &&&&   r'   r   booleanRecords.list  s    E(AdG$LL+EEJJL)88Q45 * Y'u:?+<)=qz1Y<YZ[hYijk

%Axx6(1+3F3FUVxXY{H[H[]a]j]jkl]mno &r*   )rC  r  r  r  r   )NFr   )TFF)rS   rT   rU   rV   r(   r3  r}  r<  r  r   r=  r   rS  rW  r   r   rW   rX   rY   s   @r'   r  r  
  sH     &,>("0
:(.+/p pr*   r  r   )re   )>rY  rW  r   r  rw   r3   r  r   rF   PROGNAMEr   setools.policyrepr   setools.typequeryr   r  gettextkwargsversion_infotranslationr   r	   builtinsr5   __dict__ImportError__builtin__r   rf   r  SEMANAGE_FCONTEXT_ALLSEMANAGE_FCONTEXT_REGSEMANAGE_FCONTEXT_DIRSEMANAGE_FCONTEXT_CHARSEMANAGE_FCONTEXT_BLOCKSEMANAGE_FCONTEXT_SOCKSEMANAGE_FCONTEXT_LINKSEMANAGE_FCONTEXT_PIPEr  r  r    audit_closer!   r   r  ri   r   r   r   r   r   r  r)  rI  rT  r  rv  r  r  rg  r  r  rk   r*   r'   <module>ru     sR  .  
  	 	 
     + ' ,F
$ yH 	#1	#	# "	#A 	
		A 
&
2/
; '
32
> (
4 '
3(
4 /
; '
3)
4 !7
 (
3*
4 4
> )
3)
4 -
8 (
3)
4 (
34
? (
3)
4 1
< &)3&-s)3#S*C'.  ewvuvyvx!K<	e&&()#& #&R +"$f fRh&O h&V
_ 
@ @FF8? F8RM5_ M5`d/ dL	JO JX| ||Jp/ JpZIV IVXh@o h@VWp_ WpcU,,!$# ,$+S!,x 	 "<!< !<"<s<   AG9 #/H7 9H4<HH1,H40H11H47II