+
     6gZ  c                   s    ^ RI t ] P                  ! RRR7      t]P                   t^ RI5 ^ RIHt ^ RIt^ RI5 ^ RItRs	R t
. ROtR t^ RIt ! R	 R
]4      tR# )i    Nzsetroubleshoot-pluginsT)Zfallback)Z*)Pluginc                 s    \         '       gN   \        \        P                  ! 4       4      pVP	                  4       P                  R 4      s VP                  4        V \         9   # )Z
)customizable_typesZopenselinuxZselinux_customizable_types_pathZreadsplitZclose)ZtargetZfd   & //usr/share/setroubleshoot/plugins/restorecon.pycustomizabler       sE    '99;<WWY__T2

'''    c                 sT    \          F  pV P                  V4      '       g   K   R # 	  R# )TF)excluded_pathsZ
startswith)Ztarget_pathZpathr   r   excluded_pathr	   ,   s"    !!$'' r   c                   s   a  ] tR t^2t o ]! R4      tRt]! R4      tR t]! R4      t	R t
]! R4      tRtR tR	 tR
tV tR# )pluginzN
    SELinux is preventing $SOURCE_PATH "$ACCESS" access to $TARGET_PATH.
    z/sbin/restorecon $TARGET_PATHz
    You can restore the default system context to this file by executing the
    restorecon command.  restorecon '$TARGET_PATH', if this file is a directory,
    you can recursively restore using restorecon -R '$TARGET_PATH'.
    c                s4    \        R 4      V^,          ,          # )a  
    SELinux denied access requested by $SOURCE. $TARGET_PATH may
    be mislabeled.  $TARGET_PATH default SELinux type is
    <B>%s</B>, but its current type is <B>$TARGET_TYPE</B>. Changing
    this file back to the default type may fix your problem.
    <p>
    File contexts can be assigned to a file in the following ways.
    <ul>
        <li>Files created in a directory receive the file context of the parent directory by default.
        <li>The SELinux policy might override the default label inherited from the parent directory by
            specifying a process running in context A which creates a file in a directory labeled B
            will instead create the file with label C. An example of this would be the dhcp client running
            with the dhcpc_t type and creating a file in the directory /etc. This file would normally
            receive the etc_t type due to parental inheritance but instead the file
            is labeled with the net_conf_t type because the SELinux policy specifies this.
        <li>Users can change the file context on a file using tools such as chcon, or restorecon.
    </ul>
    This file could have been mislabeled either by user error, or if an normally confined application
    was run under the wrong domain.
    <p>
    However, this might also indicate a bug in SELinux because the file should not have been labeled
    with this type.
    <p>
    If you believe this is a bug, please file a bug report against this package.
    )_selfavcZargs   &&&r   get_problem_descriptionZplugin.get_problem_description?   s"      	0 71 	r   zGIf you want to fix the label. 
$TARGET_PATH default label should be %s.c                s6    V P                   V^,          ,          # )i   )if_textr   r   r   get_if_textZplugin.get_if_text\   s    ||d1g%%r   z"# /sbin/restorecon -v $TARGET_PATHc                s    \         P                  ! V \        4       V P                  ^d4       RV n        RV n        \        R4      V n        R# )id   ZgreenTzRestore
ContextN)r    __init____name__Zset_prioritylevelfixabler   button_text)r   s   &r   r   Zplugin.__init__d   s:    h'#
-.r   c                s   VP                   '       g   R # VP                  P                  R
9   d   R # VP                  P                  \        9  d   R # VP	                  R4      '       d   R # / p\
        VR&   \        VR&   \        VR&   \        VR&   \        VR&   VP                  VP                  4       4      '       Ed   VP                  f   R # VP                  R8X  d   R # VP                  ^ ,          R8w  d   R # \        VP                  4      '       d   R # \        VP                  P                  4      '       d   R #  \        P                   ! VP                  P#                  R4      W!P$                  ,          4      ^,          pVP'                  R	4      ^,          pWAP                  P                  8w  d   V P)                  ^ V34      #  R # R #   \*         d   p R p?R # R p?ii ; i)NZ	relabeltoZdirZfileZlnk_fileZchr_fileZblk_fileZ/Z"Z:)Zcifs_tZnfs_t)Zquery_environmentZtcontextZtypeZ
file_typesZall_accesses_are_inZS_IFDIRZS_IFREGZS_IFLNKZS_IFCHRZS_IFBLKZhas_tclass_inZkeysZtpathr	   r   r   ZmatchpathconZstripZtclassr   ZreportZOSError)r   r   Zrestorecon_filesZmconZ	mcon_typeZes   &&    r   analyzeZplugin.analyzek   s   $$$T<< 55d<<J.t"";//")#* '.$'.$'.$-22455yy yyCyy|s"4SYY''CLL--..++CIIOOC,@BRS]S]B^_`ab**S/!,	 1 11;;9~66 2
   s   BG G*%G*)r   r   r   Nzyou can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.)r   Z
__module__Z__qualname__Z__firstlineno__r   ZsummaryZfix_cmdZfix_descriptionr   r   r   Z	then_textZdo_textr   r   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r
   r
   2   sh       	G .G  	O6 Z[G&  v wI2G/ r   r
   )z/sys/z/proc/z/memfd:)ZgettextZtranslationr   Zsetroubleshoot.utilZsetroubleshoot.Pluginr    ZosZstatr   r   r   r   r	   r
   ) r   r   <module>r      sa   *  84H ! ( 	   ( 0
 TV Tr   