* Wed Aug 1 2007 Dan Walsh <dwalsh@redhat.com> 2.0.22-13

- Speed up genhomedircon by an order of magnitude by compiling regex
- Allow semanage fcontext -a -t <<none>> /path to work
This commit is contained in:
Daniel J Walsh 2007-08-01 20:07:58 +00:00
parent b9cac613d7
commit 4ecb32d9da
2 changed files with 57 additions and 9 deletions

View File

@ -18,6 +18,17 @@ diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po
-mkdir -p $(MANDIR)/man1 -mkdir -p $(MANDIR)/man1
install -m 644 audit2allow.1 $(MANDIR)/man1/ install -m 644 audit2allow.1 $(MANDIR)/man1/
diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/ChangeLog policycoreutils-2.0.22/ChangeLog
--- nsapolicycoreutils/ChangeLog 2007-07-16 14:20:43.000000000 -0400
+++ policycoreutils-2.0.22/ChangeLog 2007-06-21 05:17:13.000000000 -0400
@@ -91,7 +91,6 @@
1.33.15 2007-01-17
* Merged unicode-to-string fix for seobject audit from Dan Walsh.
* Merged man page updates to make "apropos selinux" work from Dan Walsh.
-
1.33.14 2007-01-16
* Merged newrole man page patch from Michael Thompson.
diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/Makefile policycoreutils-2.0.22/Makefile diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/Makefile policycoreutils-2.0.22/Makefile
--- nsapolicycoreutils/Makefile 2007-07-16 14:20:43.000000000 -0400 --- nsapolicycoreutils/Makefile 2007-07-16 14:20:43.000000000 -0400
+++ policycoreutils-2.0.22/Makefile 2007-07-31 15:45:57.000000000 -0400 +++ policycoreutils-2.0.22/Makefile 2007-07-31 15:45:57.000000000 -0400
@ -125,13 +136,50 @@ diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po
# #
diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-2.0.22/scripts/genhomedircon diff --exclude-from=exclude --exclude=sepolgen-1.0.8 --exclude=gui --exclude=po -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-2.0.22/scripts/genhomedircon
--- nsapolicycoreutils/scripts/genhomedircon 2007-07-16 14:20:41.000000000 -0400 --- nsapolicycoreutils/scripts/genhomedircon 2007-07-16 14:20:41.000000000 -0400
+++ policycoreutils-2.0.22/scripts/genhomedircon 2007-07-31 15:45:57.000000000 -0400 +++ policycoreutils-2.0.22/scripts/genhomedircon 2007-08-01 16:03:41.000000000 -0400
@@ -302,7 +302,7 @@ @@ -139,7 +139,22 @@
self.default_user = "user_u"
regex = re.sub("\(\/\.\*\)\?", "", regex) self.default_prefix = "user"
regex = regex + "/*$" self.users = self.getUsers()
+ fd = open(self.getFileContextFile())
+ self.fclines=[]
+ for i in fd.readlines():
+ try:
+ regex = i.split()[0]
+ #match a trailing .+
+ regex = re.sub("\.+$", "", regex)
+ regex = re.sub("\.\*$", "", regex)
+ regex = re.sub("\(\/\.\*\)\?", "", regex)
+ regex = regex + "/*$"
+ self.fclines.append(re.compile(regex))
+ except:
+ continue
+ fd.close()
+
def getFileContextDir(self):
return self.selinuxdir+self.type+self.filecontextdir
@@ -289,20 +304,9 @@
return ret+"\n"
def checkExists(self, home):
- fd = open(self.getFileContextFile())
- for i in fd.readlines():
- if len(i) == 0:
- continue
+ for i in self.fclines:
try:
- regex = i.split()[0]
- #match a trailing .+
- regex = re.sub("\.+$", "", regex)
- regex = re.sub("\.\*$", "", regex)
- #strip a (/.*)? which matches anything trailing to a /*$ which matches trailing /'s
-
- regex = re.sub("\(\/\.\*\)\?", "", regex)
- regex = regex + "/*$"
- if re.search(regex,home, 0): - if re.search(regex,home, 0):
+ if re.match(regex,home): + if i.match(home):
return 1 return 1
except: except:
continue continue

View File

@ -6,7 +6,7 @@
Summary: SELinux policy core utilities Summary: SELinux policy core utilities
Name: policycoreutils Name: policycoreutils
Version: 2.0.22 Version: 2.0.22
Release: 12%{?dist} Release: 13%{?dist}
License: GPL License: GPL
Group: System Environment/Base Group: System Environment/Base
Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz Source: http://www.nsa.gov/selinux/archives/policycoreutils-%{version}.tgz
@ -192,10 +192,10 @@ if [ "$1" -ge "1" ]; then
fi fi
%changelog %changelog
* Wed Aug 1 2007 Dan Walsh <dwalsh@redhat.com> 2.0.22-12 * Wed Aug 1 2007 Dan Walsh <dwalsh@redhat.com> 2.0.22-13
- Speed up genhomedircon by an order of magnitude by compiling regex
- Allow semanage fcontext -a -t <<none>> /path to work - Allow semanage fcontext -a -t <<none>> /path to work
* Fri Jul 27 2007 Dan Walsh <dwalsh@redhat.com> 2.0.22-11 * Fri Jul 27 2007 Dan Walsh <dwalsh@redhat.com> 2.0.22-11
- Fixfiles update required to match new regex - Fixfiles update required to match new regex