- Fix restorecon python code

This commit is contained in:
Daniel J Walsh 2009-01-06 15:44:49 +00:00
parent 49eae3b63b
commit c1e059f764
2 changed files with 6 additions and 3 deletions

View File

@ -110,7 +110,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux.py libselinux-2.0
+
+def restorecon(path, recursive=False):
+ """ Restore SELinux context on a given path """
+ mode = os.stat(path)[stat.ST_MODE]
+ mode = os.lstat(path)[stat.ST_MODE]
+ status, context = matchpathcon(path, mode)
+ if status == 0:
+ lsetfilecon(path, context)
@ -153,7 +153,7 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_python.i libs
+
+def restorecon(path, recursive=False):
+ """ Restore SELinux context on a given path """
+ mode = os.stat(path)[stat.ST_MODE]
+ mode = os.lstat(path)[stat.ST_MODE]
+ status, context = matchpathcon(path, mode)
+ if status == 0:
+ lsetfilecon(path, context)

View File

@ -5,7 +5,7 @@
Summary: SELinux library and simple utilities
Name: libselinux
Version: 2.0.77
Release: 1%{?dist}
Release: 2%{?dist}
License: Public Domain
Group: System Environment/Libraries
Source: http://www.nsa.gov/selinux/archives/%{name}-%{version}.tgz
@ -164,6 +164,9 @@ exit 0
%{ruby_sitearch}/selinux.so
%changelog
* Tue Jan 6 2009 Dan Walsh <dwalsh@redhat.com> - 2.0.77-2
- Fix restorecon python code
* Tue Jan 6 2009 Dan Walsh <dwalsh@redhat.com> - 2.0.77-1
- Update to upstream