a èZ` ã @ sd d dl Z e jdddZej Zd dlT d dlmZ d dlZd dlT d dlZd dlZG dd„ deƒZ dS ) é Nzsetroubleshoot-pluginsT)Zfallback)Ú*)ÚPluginc @ sT e Zd ZedƒZdZedƒZdd„ ZedƒZdd„ Z ed ƒZ d Zdd„ Zd d„ Z dS )ÚpluginzN SELinux is preventing $SOURCE_PATH "$ACCESS" access to $TARGET_PATH. z/sbin/restorecon $SOURCE_PATHz† You can restore the default system context to this file by executing the restorecon command. restorecon '$SOURCE_PATH'. c C s t dƒ|d S )Nam SELinux denied access requested by $SOURCE. $SOURCE_PATH may be mislabeled. $SOURCE_PATH default SELinux type is %s, but its current type is $SOURCE_TYPE. Changing this file back to the default type may fix your problem.
This file could have been mislabeled either by user error, or if an normally confined application was run under the wrong domain.
However, this might also indicate a bug in SELinux because the file should not have been labeled with this type.
If you believe this is a bug, please file a bug report against this package.
é )Ú_©ÚselfÚavcÚargs© r ú6/usr/share/setroubleshoot/plugins/restorecon_source.pyÚget_problem_description, s
ózplugin.get_problem_descriptionzGIf you want to fix the label.
$SOURCE_PATH default label should be %s.c C s | j |d S )Nr )Úif_textr r r r Úget_if_text> s zplugin.get_if_textzyou can run restorecon.z"# /sbin/restorecon -v $SOURCE_PATHc C s0 t | t¡ | d¡ d| _d| _tdƒ| _d S )Néd ZgreenTzRestore
Context)r Ú__init__Ú__name__Zset_priorityÚlevelZfixabler Zbutton_text)r r r r r D s
zplugin.__init__c C s¨ |j s
d S |jd u rd S |jd dkr*d S zft |j d¡t¡d }| d¡d }t |j d¡¡d }| d¡d }||krŽ| d|f¡W S W n t y¢ Y n0 d S )Nr ú/ú"r ú:é )
Zquery_environmentZspathÚselinuxZmatchpathconÚstripÚS_IFREGÚsplitZ
getfileconZreportÚOSError)r r ZmconZ mcon_typeZgconZ gcon_typer r r ÚanalyzeK s
zplugin.analyzeN)r Ú
__module__Ú__qualname__r ZsummaryZfix_cmdZfix_descriptionr
r r Z then_textZdo_textr r r r r r r s r )
ÚgettextZtranslationr Zsetroubleshoot.utilZsetroubleshoot.Pluginr ÚosÚstatr r r r r r Ú