Change python binding for restorecon to check if the context matches.
If it does do not reset
This commit is contained in:
parent
5cb2893d59
commit
0921286973
@ -275,3 +275,19 @@ index 710396a..9a3fc14 100644
|
||||
hidden_proto(matchpathcon_init_prefix)
|
||||
hidden_proto(selinux_users_path)
|
||||
hidden_proto(selinux_usersconf_path);
|
||||
diff --git a/libselinux/src/selinuxswig_python.i b/libselinux/src/selinuxswig_python.i
|
||||
index daf8314..359bd02 100644
|
||||
--- a/libselinux/src/selinuxswig_python.i
|
||||
+++ b/libselinux/src/selinuxswig_python.i
|
||||
@@ -22,7 +22,10 @@ def restorecon(path, recursive=False):
|
||||
status, context = matchpathcon(path, mode)
|
||||
|
||||
if status == 0:
|
||||
- lsetfilecon(path, context)
|
||||
+ status, oldcontext = lgetfilecon(path)
|
||||
+ if context != oldcontext:
|
||||
+ lsetfilecon(path, context)
|
||||
+
|
||||
if recursive:
|
||||
os.path.walk(path, lambda arg, dirname, fnames:
|
||||
map(restorecon, [os.path.join(dirname, fname)
|
||||
|
@ -7,7 +7,7 @@
|
||||
Summary: SELinux library and simple utilities
|
||||
Name: libselinux
|
||||
Version: 2.1.7
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: Public Domain
|
||||
Group: System Environment/Libraries
|
||||
Source: %{name}-%{version}.tgz
|
||||
@ -231,7 +231,12 @@ rm -rf %{buildroot}
|
||||
%{ruby_sitearch}/selinux.so
|
||||
|
||||
%changelog
|
||||
* Tue Nov 29 2011 Dan Walsh <dwalsh@redhat.com> - 2.1.7-2
|
||||
- Change python binding for restorecon to check if the context matches.
|
||||
- If it does do not reset
|
||||
|
||||
* Fri Nov 4 2011 Dan Walsh <dwalsh@redhat.com> - 2.1.7-1
|
||||
- Upgrade to upstream
|
||||
* Makefiles: syntax, convert all ${VAR} to $(VAR)
|
||||
* load_policy: handle selinux=0 and /sys/fs/selinux not exist
|
||||
* regenerate .pc on VERSION change
|
||||
|
Loading…
Reference in New Issue
Block a user