diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-12-17 03:22:11 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-12-17 03:22:11 +0000 |
commit | a6798efb14c384687cccf587134a43dcd5ba9faa (patch) | |
tree | 24a819827b19f4741cd10d094ca537390ee43778 | |
parent | f5a1362bd26675876376f20df6e00668cee3f285 (diff) | |
download | portage-a6798efb14c384687cccf587134a43dcd5ba9faa.tar.gz portage-a6798efb14c384687cccf587134a43dcd5ba9faa.tar.bz2 portage-a6798efb14c384687cccf587134a43dcd5ba9faa.zip |
Bug #286497 - Make setexec() warn/nonfatal in permissive mode. Thanks to
Chris PeBenito <pebenito@gentoo.org> for this patch. (trunk r15100)
svn path=/main/branches/2.1.7/; revision=15105
-rw-r--r-- | pym/portage/_selinux.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pym/portage/_selinux.py b/pym/portage/_selinux.py index d013fa969..5367afc9c 100644 --- a/pym/portage/_selinux.py +++ b/pym/portage/_selinux.py @@ -8,8 +8,10 @@ import os import shutil from portage import _encodings +from portage import _unicode_decode from portage import _unicode_encode from portage.localization import _ +from portage.util import writemsg import selinux from selinux import is_selinux_enabled @@ -70,7 +72,14 @@ def settype(newtype): def setexec(ctx="\n"): ctx = _unicode_encode(ctx, encoding=_encodings['content'], errors='strict') if selinux.setexeccon(ctx) < 0: - raise OSError(_("setexec: Failed setting exec() context \"%s\".") % ctx) + ctx = _unicode_decode(ctx, encoding=_encodings['content'], + errors='replace') + if selinux.security_getenforce() == 1: + raise OSError(_("Failed setting exec() context \"%s\".") % ctx) + else: + writemsg("!!! " + \ + _("Failed setting exec() context \"%s\".") % ctx, \ + noiselevel=-1) def setfscreate(ctx="\n"): ctx = _unicode_encode(ctx, |