2006-01-18 18:55:09 +00:00
|
|
|
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat policycoreutils-1.29.8/scripts/chcat
|
2006-01-18 17:43:23 +00:00
|
|
|
--- nsapolicycoreutils/scripts/chcat 2006-01-18 11:12:43.000000000 -0500
|
2006-01-18 18:55:09 +00:00
|
|
|
+++ policycoreutils-1.29.8/scripts/chcat 2006-01-18 13:52:39.000000000 -0500
|
|
|
|
@@ -281,6 +281,7 @@
|
2006-01-18 17:43:23 +00:00
|
|
|
print "Usage %s -d File ..." % sys.argv[0]
|
|
|
|
print "Usage %s -l -d user ..." % sys.argv[0]
|
|
|
|
print "Usage %s -L" % sys.argv[0]
|
|
|
|
+ print "Usage %s -L -l user" % sys.argv[0]
|
|
|
|
print "Use -- to end option list. For example"
|
|
|
|
print "chcat -- -CompanyConfidential /docs/businessplan.odt"
|
|
|
|
print "chcat -l +CompanyConfidential juser"
|
2006-01-18 18:55:09 +00:00
|
|
|
@@ -298,12 +299,8 @@
|
|
|
|
return 0
|
|
|
|
|
|
|
|
def listusercats(users):
|
|
|
|
- seusers = seobject.loginRecords().get_all()
|
|
|
|
for u in users:
|
|
|
|
- if u in seusers.keys():
|
|
|
|
- cats=seobject.translate(seusers[u][1])
|
|
|
|
- else:
|
|
|
|
- cats=seobject.translate(seusers["__default__"][1])
|
|
|
|
+ cats=seobject.translate(selinux.getseuserbyname(u)[2])
|
|
|
|
cats=cats.split("-")
|
|
|
|
if len(cats) > 1 and cats[1] != "s0":
|
|
|
|
print "%s: %s" % (u, cats[1])
|
|
|
|
@@ -350,10 +347,17 @@
|
2006-01-18 17:43:23 +00:00
|
|
|
if delete_ind:
|
|
|
|
sys.exit(chcat_replace(["s0"], ["s0"], cmds, login_ind))
|
|
|
|
|
|
|
|
+ if login_ind:
|
|
|
|
+ if len(cmds) >= 1:
|
|
|
|
+ for u in cmds:
|
|
|
|
+ try:
|
|
|
|
+ pwd.getpwnam(u)
|
|
|
|
+ except KeyError, e:
|
|
|
|
+ error( "User %s does not exist" % u)
|
|
|
|
+ else:
|
|
|
|
+ cmds.append(os.getlogin())
|
|
|
|
if list_ind:
|
|
|
|
if login_ind:
|
|
|
|
- if len(cmds) < 1:
|
|
|
|
- usage()
|
|
|
|
sys.exit(listusercats(cmds))
|
|
|
|
else:
|
|
|
|
if len(cmds) > 0:
|
2006-01-18 18:55:09 +00:00
|
|
|
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/seobject.py policycoreutils-1.29.8/semanage/seobject.py
|
2006-01-18 17:43:23 +00:00
|
|
|
--- nsapolicycoreutils/semanage/seobject.py 2006-01-18 11:12:43.000000000 -0500
|
2006-01-18 18:55:09 +00:00
|
|
|
+++ policycoreutils-1.29.8/semanage/seobject.py 2006-01-18 13:26:43.000000000 -0500
|
2006-01-18 17:43:23 +00:00
|
|
|
@@ -421,11 +421,11 @@
|
2006-01-14 06:50:34 +00:00
|
|
|
|
2006-01-18 17:43:23 +00:00
|
|
|
rc = semanage_port_modify_local(self.sh, k, p)
|
2006-01-14 06:50:34 +00:00
|
|
|
if rc < 0:
|
2006-01-18 17:43:23 +00:00
|
|
|
- raise ValueError("Failed to add port %s/%s" % (proto, port))
|
|
|
|
+ raise ValueError("Failed to modify port %s/%s" % (proto, port))
|
|
|
|
|
|
|
|
rc = semanage_commit(self.sh)
|
2006-01-14 06:50:34 +00:00
|
|
|
if rc < 0:
|
2006-01-18 17:43:23 +00:00
|
|
|
- raise ValueError("Failed to add port %s/%s" % (proto, port))
|
|
|
|
+ raise ValueError("Failed to modify port %s/%s" % (proto, port))
|
2006-01-14 06:50:34 +00:00
|
|
|
|
|
|
|
def modify(self, port, proto, serange, setype):
|
|
|
|
if serange == "" and setype == "":
|
2006-01-18 17:43:23 +00:00
|
|
|
@@ -458,7 +458,7 @@
|
2006-01-14 06:50:34 +00:00
|
|
|
|
2006-01-18 17:43:23 +00:00
|
|
|
rc = semanage_commit(self.sh)
|
2006-01-14 06:50:34 +00:00
|
|
|
if rc < 0:
|
2006-01-18 17:43:23 +00:00
|
|
|
- raise ValueError("Failed to add port %s/%s" % (proto, port))
|
2006-01-14 06:50:34 +00:00
|
|
|
+ raise ValueError("Failed to modify port %s/%s" % (proto, port))
|
|
|
|
|
|
|
|
def delete(self, port, proto):
|
|
|
|
( k, proto_d, low, high ) = self.__genkey(port, proto)
|
2006-01-18 17:43:23 +00:00
|
|
|
@@ -491,22 +491,44 @@
|
2006-01-14 06:50:34 +00:00
|
|
|
for idx in range(self.psize):
|
|
|
|
u = semanage_port_by_idx(self.plist, idx)
|
|
|
|
con = semanage_port_get_con(u)
|
2006-01-18 17:43:23 +00:00
|
|
|
- name = semanage_context_get_type(con)
|
|
|
|
+ type = semanage_context_get_type(con)
|
|
|
|
+ if type == "reserved_port_t":
|
|
|
|
+ continue
|
|
|
|
+ level = semanage_context_get_mls(con)
|
|
|
|
proto=semanage_port_get_proto_str(u)
|
|
|
|
low=semanage_port_get_low(u)
|
|
|
|
high = semanage_port_get_high(u)
|
|
|
|
- if (name, proto) not in dict.keys():
|
|
|
|
- dict[(name,proto)]=[]
|
|
|
|
+ dict[(low, high)]=(type, proto, level)
|
|
|
|
+ return dict
|
|
|
|
+
|
|
|
|
+ def get_all_by_type(self):
|
|
|
|
+ dict={}
|
|
|
|
+ (rc, self.plist, self.psize) = semanage_port_list(self.sh)
|
2006-01-10 17:12:58 +00:00
|
|
|
+ if rc < 0:
|
2006-01-18 17:43:23 +00:00
|
|
|
+ raise ValueError("Could not list ports")
|
2006-01-14 06:50:34 +00:00
|
|
|
+
|
2006-01-18 17:43:23 +00:00
|
|
|
+ for idx in range(self.psize):
|
|
|
|
+ u = semanage_port_by_idx(self.plist, idx)
|
|
|
|
+ con = semanage_port_get_con(u)
|
|
|
|
+ type = semanage_context_get_type(con)
|
|
|
|
+ if type == "reserved_port_t":
|
|
|
|
+ continue
|
|
|
|
+ level = semanage_context_get_mls(con)
|
|
|
|
+ proto=semanage_port_get_proto_str(u)
|
|
|
|
+ low=semanage_port_get_low(u)
|
|
|
|
+ high = semanage_port_get_high(u)
|
|
|
|
+ if (type, proto) not in dict.keys():
|
|
|
|
+ dict[(type,proto)]=[]
|
|
|
|
if low == high:
|
|
|
|
- dict[(name,proto)].append("%d" % low)
|
|
|
|
+ dict[(type,proto)].append("%d" % low)
|
2006-01-15 15:31:28 +00:00
|
|
|
else:
|
2006-01-18 17:43:23 +00:00
|
|
|
- dict[(name,proto)].append("%d-%d" % (low, high))
|
|
|
|
+ dict[(type,proto)].append("%d-%d" % (low, high))
|
2006-01-14 06:50:34 +00:00
|
|
|
return dict
|
2006-01-18 17:43:23 +00:00
|
|
|
|
2006-01-14 06:50:34 +00:00
|
|
|
def list(self, heading=1):
|
|
|
|
if heading:
|
2006-01-18 17:43:23 +00:00
|
|
|
- print "%-30s %-8s %s\n" % ("SELinux Port Name", "Proto", "Port Number")
|
|
|
|
- dict=self.get_all()
|
|
|
|
+ print "%-30s %-8s %s\n" % ("SELinux Port Type", "Proto", "Port Number")
|
|
|
|
+ dict=self.get_all_by_type()
|
2006-01-14 06:50:34 +00:00
|
|
|
keys=dict.keys()
|
2006-01-18 17:43:23 +00:00
|
|
|
keys.sort()
|
|
|
|
for i in keys:
|
2006-01-18 18:55:09 +00:00
|
|
|
diff --exclude-from=exclude -N -u -r nsapolicycoreutils/setsebool/setsebool.c policycoreutils-1.29.8/setsebool/setsebool.c
|
|
|
|
--- nsapolicycoreutils/setsebool/setsebool.c 2006-01-04 13:07:46.000000000 -0500
|
|
|
|
+++ policycoreutils-1.29.8/setsebool/setsebool.c 2006-01-18 13:27:42.000000000 -0500
|
|
|
|
@@ -130,7 +130,7 @@
|
|
|
|
|
|
|
|
for (j = 0; j < boolcnt; j++) {
|
|
|
|
|
|
|
|
- if (semanage_bool_create(handle, &boolean) < 0)
|
|
|
|
+ if (semanage_bool_create(handle, &boolean) < 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
if (semanage_bool_set_name(handle, boolean, boollist[j].name) < 0)
|
|
|
|
@@ -144,9 +144,10 @@
|
|
|
|
if (permanent && semanage_bool_modify_local(handle, bool_key, boolean) < 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
- if (semanage_bool_set_active(handle, bool_key, boolean) < 0)
|
|
|
|
+ if (semanage_bool_set_active(handle, bool_key, boolean) < 0) {
|
|
|
|
+ fprintf(stderr, "Could not change boolean %s\n", boollist[j].name);
|
|
|
|
goto err;
|
|
|
|
-
|
|
|
|
+ }
|
|
|
|
semanage_bool_key_free(bool_key);
|
|
|
|
semanage_bool_free(boolean);
|
|
|
|
bool_key = NULL;
|