policycoreutils/policycoreutils-rhat.patch

226 lines
7.3 KiB
Diff
Raw Normal View History

diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/genhomedircon policycoreutils-1.29.3/scripts/genhomedircon
--- nsapolicycoreutils/scripts/genhomedircon 2006-01-04 13:07:46.000000000 -0500
+++ policycoreutils-1.29.3/scripts/genhomedircon 2006-01-04 13:17:35.000000000 -0500
@@ -220,8 +220,9 @@
if len(u)==0 or u[0]=="#":
continue
user = u.split(":")
- if len(user) < 3:
+ if len(user) < 2:
continue
+
role=self.getOldRole(user[1])
self.adduser(udict, user[0], user[1], role)
fd.close()
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/semanage policycoreutils-1.29.3/semanage/semanage
--- nsapolicycoreutils/semanage/semanage 2006-01-04 13:07:46.000000000 -0500
+++ policycoreutils-1.29.3/semanage/semanage 2006-01-04 13:17:35.000000000 -0500
@@ -36,7 +36,7 @@
sename = "user_u"
(rc,k) = semanage_seuser_key_create(self.sh, name)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create a key for %s" % name)
(rc,exists) = semanage_seuser_exists(self.sh, k)
@@ -48,7 +48,7 @@
raise ValueError("Linux User %s does not exist" % name)
(rc,u) = semanage_seuser_create(self.sh)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create seuser for %s" % name)
semanage_seuser_set_name(self.sh, u, name)
@@ -56,12 +56,12 @@
semanage_seuser_set_sename(self.sh, u, sename)
semanage_begin_transaction(self.sh)
semanage_seuser_add(self.sh, k, u)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Failed to add SELinux user mapping")
def modify(self, name, sename = "", serange = ""):
(rc,k) = semanage_seuser_key_create(self.sh, name)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create a key for %s" % name)
if sename == "" and serange == "":
@@ -70,7 +70,7 @@
(rc,exists) = semanage_seuser_exists(self.sh, k)
if exists:
(rc,u) = semanage_seuser_query(self.sh, k)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not query seuser for %s" % name)
else:
raise ValueError("SELinux user %s mapping is not defined." % name)
@@ -81,13 +81,13 @@
semanage_seuser_set_sename(self.sh, u, sename)
semanage_begin_transaction(self.sh)
semanage_seuser_modify(self.sh, k, u)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Failed to modify SELinux user mapping")
def delete(self, name):
(rc,k) = semanage_seuser_key_create(self.sh, name)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create a key for %s" % name)
(rc,exists) = semanage_seuser_exists(self.sh, k)
@@ -95,7 +95,7 @@
raise ValueError("SELinux user %s mapping is not defined." % name)
semanage_begin_transaction(self.sh)
semanage_seuser_del(self.sh, k)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("SELinux User %s mapping not defined" % name)
def list(self,heading=1):
@@ -122,7 +122,7 @@
selevel = "s0"
(rc,k) = semanage_user_key_create(self.sh, name)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create a key for %s" % name)
(rc,exists) = semanage_user_exists_local(self.sh, k)
@@ -132,7 +132,7 @@
raise ValueError("SELinux user %s is already defined." % name)
(rc,u) = semanage_user_create(self.sh)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create login mapping for %s" % name)
semanage_user_set_name(self.sh, u, name)
@@ -141,12 +141,12 @@
semanage_user_set_mlsrange(self.sh, u, serange)
semanage_user_set_mlslevel(self.sh, u, selevel)
(rc,key) = semanage_user_key_extract(self.sh,u)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not extract key for %s" % name)
semanage_begin_transaction(self.sh)
semanage_user_add_local(self.sh, k, u)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Failed to add SELinux user")
def modify(self, name, roles = [], selevel = "", serange = ""):
@@ -154,7 +154,7 @@
raise ValueError("Requires, roles, level or range")
(rc,k) = semanage_user_key_create(self.sh, name)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create a key for %s" % name)
(rc,exists) = semanage_user_exists_local(self.sh, k)
@@ -166,24 +166,24 @@
(rc,u) = semanage_user_query(self.sh, k)
else:
raise ValueError("SELinux user %s mapping is not defined." % name)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not query user for %s" % name)
if serange != "":
semanage_user_set_mlsrange(self.sh, u, serange)
if selevel != "":
semanage_user_set_mlslevel(self.sh, u, selevel)
- if len(roles) != 0:
+ if len(roles) < 0:
for r in roles:
semanage_user_add_role(self.sh, u, r)
semanage_begin_transaction(self.sh)
semanage_user_modify_local(self.sh, k, u)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Failed to modify SELinux user")
def delete(self, name):
(rc,k) = semanage_user_key_create(self.sh, name)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not crpppeate a key for %s" % name)
(rc,exists) = semanage_user_exists_local(self.sh, k)
@@ -191,7 +191,7 @@
raise ValueError("user %s is not defined" % name)
semanage_begin_transaction(self.sh)
semanage_user_del_local(self.sh, k)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Login User %s not defined" % name)
def list(self, heading=1):
@@ -238,7 +238,7 @@
high=string.atoi(ports[1])
(rc,k) = semanage_port_key_create(self.sh, low, high, proto_d)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create a key for %s/%s" % (proto, port))
return ( k, proto_d, low, high )
@@ -260,13 +260,13 @@
raise ValueError("Port %s/%s already defined locally" % (proto, port))
(rc,p) = semanage_port_create(self.sh)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create port for %s/%s" % (proto, port))
semanage_port_set_proto(p, proto_d)
semanage_port_set_range(p, low, high)
(rc, con) = semanage_context_create(self.sh)
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not create context for %s/%s" % (proto, port))
semanage_context_set_user(self.sh, con, "system_u")
@@ -276,7 +276,7 @@
semanage_port_set_con(p, con)
semanage_begin_transaction(self.sh)
semanage_port_add_local(self.sh, k, p)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Failed to add port")
def modify(self, port, proto, serange, setype):
@@ -294,7 +294,7 @@
else:
raise ValueError("port %s/%s is not defined." % (proto,port))
- if rc != 0:
+ if rc < 0:
raise ValueError("Could not query port for %s/%s" % (proto, port))
con = semanage_port_get_con(p)
@@ -306,7 +306,7 @@
semanage_port_set_con(p, con)
semanage_begin_transaction(self.sh)
semanage_port_modify_local(self.sh, k, p)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Failed to add port")
def delete(self, port, proto):
@@ -317,7 +317,7 @@
semanage_begin_transaction(self.sh)
semanage_port_del_local(self.sh, k)
- if semanage_commit(self.sh) != 0:
+ if semanage_commit(self.sh) < 0:
raise ValueError("Port %s/%s not defined" % (proto,port))
def list(self, heading=1):