2006-01-04 18:53:16 +00:00
|
|
|
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]=="#":
|
2005-12-24 00:36:40 +00:00
|
|
|
continue
|
|
|
|
user = u.split(":")
|
2006-01-04 18:53:16 +00:00
|
|
|
- if len(user) < 3:
|
|
|
|
+ if len(user) < 2:
|
2005-12-24 00:36:40 +00:00
|
|
|
continue
|
2006-01-04 18:53:16 +00:00
|
|
|
+
|
2005-12-24 00:36:40 +00:00
|
|
|
role=self.getOldRole(user[1])
|
|
|
|
self.adduser(udict, user[0], user[1], role)
|
2006-01-04 18:53:16 +00:00
|
|
|
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)
|
2005-12-27 15:08:31 +00:00
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
(rc,exists) = semanage_seuser_exists(self.sh, k)
|
|
|
|
@@ -48,7 +48,7 @@
|
2005-12-24 17:02:36 +00:00
|
|
|
raise ValueError("Linux User %s does not exist" % name)
|
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
(rc,u) = semanage_seuser_create(self.sh)
|
|
|
|
- if rc != 0:
|
|
|
|
+ if rc < 0:
|
|
|
|
raise ValueError("Could not create seuser for %s" % name)
|
|
|
|
|
2005-12-27 15:08:31 +00:00
|
|
|
semanage_seuser_set_name(self.sh, u, name)
|
2006-01-04 18:53:16 +00:00
|
|
|
@@ -56,12 +56,12 @@
|
2005-12-27 15:08:31 +00:00
|
|
|
semanage_seuser_set_sename(self.sh, u, sename)
|
2006-01-04 18:53:16 +00:00
|
|
|
semanage_begin_transaction(self.sh)
|
|
|
|
semanage_seuser_add(self.sh, k, u)
|
|
|
|
- if semanage_commit(self.sh) != 0:
|
|
|
|
+ if semanage_commit(self.sh) < 0:
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("Failed to add SELinux user mapping")
|
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
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")
|
2005-12-27 15:08:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
def delete(self, name):
|
2006-01-04 18:53:16 +00:00
|
|
|
(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 @@
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("SELinux user %s mapping is not defined." % name)
|
|
|
|
semanage_begin_transaction(self.sh)
|
|
|
|
semanage_seuser_del(self.sh, k)
|
2006-01-04 18:53:16 +00:00
|
|
|
- if semanage_commit(self.sh) != 0:
|
|
|
|
+ if semanage_commit(self.sh) < 0:
|
2006-01-02 13:08:02 +00:00
|
|
|
raise ValueError("SELinux User %s mapping not defined" % name)
|
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
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)
|
2005-12-27 15:08:31 +00:00
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
(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)
|
2005-12-27 15:08:31 +00:00
|
|
|
|
|
|
|
semanage_user_set_name(self.sh, u, name)
|
2006-01-04 18:53:16 +00:00
|
|
|
@@ -141,12 +141,12 @@
|
2006-01-02 13:08:02 +00:00
|
|
|
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)
|
2006-01-04 18:53:16 +00:00
|
|
|
- if rc != 0:
|
|
|
|
+ if rc < 0:
|
|
|
|
raise ValueError("Could not extract key for %s" % name)
|
|
|
|
|
2006-01-02 13:08:02 +00:00
|
|
|
semanage_begin_transaction(self.sh)
|
|
|
|
semanage_user_add_local(self.sh, k, u)
|
2006-01-04 18:53:16 +00:00
|
|
|
- if semanage_commit(self.sh) != 0:
|
|
|
|
+ if semanage_commit(self.sh) < 0:
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("Failed to add SELinux user")
|
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
def modify(self, name, roles = [], selevel = "", serange = ""):
|
|
|
|
@@ -154,7 +154,7 @@
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("Requires, roles, level or range")
|
2006-01-04 18:53:16 +00:00
|
|
|
|
|
|
|
(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)
|
|
|
|
|
2005-12-27 15:08:31 +00:00
|
|
|
if serange != "":
|
|
|
|
semanage_user_set_mlsrange(self.sh, u, serange)
|
2006-01-02 13:08:02 +00:00
|
|
|
if selevel != "":
|
2005-12-27 15:08:31 +00:00
|
|
|
semanage_user_set_mlslevel(self.sh, u, selevel)
|
2006-01-04 18:53:16 +00:00
|
|
|
- if len(roles) != 0:
|
|
|
|
+ if len(roles) < 0:
|
2005-12-27 15:08:31 +00:00
|
|
|
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)
|
2006-01-04 18:53:16 +00:00
|
|
|
- if semanage_commit(self.sh) != 0:
|
|
|
|
+ if semanage_commit(self.sh) < 0:
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("Failed to modify SELinux user")
|
|
|
|
|
|
|
|
def delete(self, name):
|
2006-01-04 18:53:16 +00:00
|
|
|
(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 @@
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("user %s is not defined" % name)
|
|
|
|
semanage_begin_transaction(self.sh)
|
2006-01-04 18:53:16 +00:00
|
|
|
semanage_user_del_local(self.sh, k)
|
|
|
|
- if semanage_commit(self.sh) != 0:
|
|
|
|
+ if semanage_commit(self.sh) < 0:
|
2006-01-02 13:08:02 +00:00
|
|
|
raise ValueError("Login User %s not defined" % name)
|
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
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)
|
2006-01-02 13:08:02 +00:00
|
|
|
semanage_begin_transaction(self.sh)
|
2006-01-04 18:53:16 +00:00
|
|
|
semanage_port_add_local(self.sh, k, p)
|
|
|
|
- if semanage_commit(self.sh) != 0:
|
|
|
|
+ if semanage_commit(self.sh) < 0:
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("Failed to add port")
|
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
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)
|
2006-01-02 13:08:02 +00:00
|
|
|
semanage_begin_transaction(self.sh)
|
2006-01-04 18:53:16 +00:00
|
|
|
semanage_port_modify_local(self.sh, k, p)
|
|
|
|
- if semanage_commit(self.sh) != 0:
|
|
|
|
+ if semanage_commit(self.sh) < 0:
|
2005-12-27 15:08:31 +00:00
|
|
|
raise ValueError("Failed to add port")
|
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
def delete(self, port, proto):
|
|
|
|
@@ -317,7 +317,7 @@
|
2005-12-27 15:08:31 +00:00
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
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))
|
2005-12-27 15:08:31 +00:00
|
|
|
|
2006-01-04 18:53:16 +00:00
|
|
|
def list(self, heading=1):
|