* Thu Jan 19 2006 Dan Walsh <dwalsh@redhat.com> 1.29.8-4
- Fixes for "add"-"modify" error messages - Fixes for chcat
This commit is contained in:
		
							parent
							
								
									3fe64b5cc9
								
							
						
					
					
						commit
						f8ffb4e460
					
				| @ -1,7 +1,43 @@ | |||||||
| diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat policycoreutils-1.29.8/scripts/chcat
 | diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat policycoreutils-1.29.8/scripts/chcat
 | ||||||
| --- nsapolicycoreutils/scripts/chcat	2006-01-18 11:12:43.000000000 -0500
 | --- nsapolicycoreutils/scripts/chcat	2006-01-18 11:12:43.000000000 -0500
 | ||||||
| +++ policycoreutils-1.29.8/scripts/chcat	2006-01-18 13:52:39.000000000 -0500
 | +++ policycoreutils-1.29.8/scripts/chcat	2006-01-19 09:41:13.000000000 -0500
 | ||||||
| @@ -281,6 +281,7 @@
 | @@ -25,11 +25,19 @@
 | ||||||
|  |  import commands, sys, os, pwd, string, getopt, re, selinux | ||||||
|  |  import seobject | ||||||
|  |   | ||||||
|  | +def verify_users(users):
 | ||||||
|  | +    for u in users:
 | ||||||
|  | +        try:
 | ||||||
|  | +            pwd.getpwnam(u)
 | ||||||
|  | +        except KeyError, e:
 | ||||||
|  | +            error( "User %s does not exist" % u)
 | ||||||
|  | +
 | ||||||
|  |  def chcat_user_add(orig, newcat, users): | ||||||
|  |      errors=0 | ||||||
|  |      logins = seobject.loginRecords() | ||||||
|  |      seusers=logins.get_all() | ||||||
|  |      add_ind=0 | ||||||
|  | +    verify_users(users)
 | ||||||
|  |      for u in users: | ||||||
|  |          if u in seusers.keys(): | ||||||
|  |              user=seusers[u] | ||||||
|  | @@ -98,6 +106,7 @@
 | ||||||
|  |      logins = seobject.loginRecords() | ||||||
|  |      seusers=logins.get_all() | ||||||
|  |      add_ind=0 | ||||||
|  | +    verify_users(users)
 | ||||||
|  |      for u in users: | ||||||
|  |          if u in seusers.keys(): | ||||||
|  |              user=seusers[u] | ||||||
|  | @@ -174,6 +183,7 @@
 | ||||||
|  |      logins = seobject.loginRecords() | ||||||
|  |      seusers=logins.get_all() | ||||||
|  |      add_ind=0 | ||||||
|  | +    verify_users(users)
 | ||||||
|  |      for u in users: | ||||||
|  |          if u in seusers.keys(): | ||||||
|  |              user=seusers[u] | ||||||
|  | @@ -281,6 +291,7 @@
 | ||||||
|  	print "Usage %s -d File ..." % sys.argv[0] |  	print "Usage %s -d File ..." % sys.argv[0] | ||||||
|  	print "Usage %s -l -d user ..." % sys.argv[0] |  	print "Usage %s -l -d user ..." % sys.argv[0] | ||||||
|  	print "Usage %s -L" % sys.argv[0] |  	print "Usage %s -L" % sys.argv[0] | ||||||
| @ -9,11 +45,17 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat policycore | |||||||
|          print "Use -- to end option list.  For example" |          print "Use -- to end option list.  For example" | ||||||
|          print "chcat -- -CompanyConfidential /docs/businessplan.odt" |          print "chcat -- -CompanyConfidential /docs/businessplan.odt" | ||||||
|          print "chcat -l +CompanyConfidential juser" |          print "chcat -l +CompanyConfidential juser" | ||||||
| @@ -298,12 +299,8 @@
 | @@ -297,13 +308,14 @@
 | ||||||
|  |      fd.close() | ||||||
|      return 0 |      return 0 | ||||||
|       |       | ||||||
|  | +
 | ||||||
|  def listusercats(users): |  def listusercats(users): | ||||||
| -    seusers = seobject.loginRecords().get_all()
 | -    seusers = seobject.loginRecords().get_all()
 | ||||||
|  | +    if len(users) == 0:
 | ||||||
|  | +        users.append(os.getlogin())
 | ||||||
|  | +
 | ||||||
|  | +    verify_users(users)
 | ||||||
|      for u in users: |      for u in users: | ||||||
| -        if u in seusers.keys():
 | -        if u in seusers.keys():
 | ||||||
| -            cats=seobject.translate(seusers[u][1])
 | -            cats=seobject.translate(seusers[u][1])
 | ||||||
| @ -23,19 +65,8 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/scripts/chcat policycore | |||||||
|          cats=cats.split("-") |          cats=cats.split("-") | ||||||
|          if len(cats) > 1 and cats[1] != "s0": |          if len(cats) > 1 and cats[1] != "s0": | ||||||
|              print "%s: %s" % (u, cats[1]) |              print "%s: %s" % (u, cats[1]) | ||||||
| @@ -350,10 +347,17 @@
 | @@ -352,8 +364,6 @@
 | ||||||
|      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 list_ind: | ||||||
|          if login_ind: |          if login_ind: | ||||||
| -            if len(cmds) < 1:
 | -            if len(cmds) < 1:
 | ||||||
| @ -177,7 +208,7 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/semanage.8 poli | |||||||
|   |   | ||||||
| diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/seobject.py policycoreutils-1.29.8/semanage/seobject.py
 | diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/seobject.py policycoreutils-1.29.8/semanage/seobject.py
 | ||||||
| --- nsapolicycoreutils/semanage/seobject.py	2006-01-18 11:12:43.000000000 -0500
 | --- nsapolicycoreutils/semanage/seobject.py	2006-01-18 11:12:43.000000000 -0500
 | ||||||
| +++ policycoreutils-1.29.8/semanage/seobject.py	2006-01-18 17:03:01.000000000 -0500
 | +++ policycoreutils-1.29.8/semanage/seobject.py	2006-01-19 09:43:38.000000000 -0500
 | ||||||
| @@ -21,9 +21,18 @@
 | @@ -21,9 +21,18 @@
 | ||||||
|  # |  # | ||||||
|  #   |  #   | ||||||
| @ -281,20 +312,6 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/seobject.py pol | |||||||
|  class semanageRecords: |  class semanageRecords: | ||||||
|  	def __init__(self): |  	def __init__(self): | ||||||
|  		self.sh = semanage_handle_create() |  		self.sh = semanage_handle_create() | ||||||
| @@ -421,11 +506,11 @@
 |  | ||||||
|   |  | ||||||
|  		rc = semanage_port_modify_local(self.sh, k, p) |  | ||||||
|  		if rc < 0: |  | ||||||
| -			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) |  | ||||||
|  		if rc < 0: |  | ||||||
| -			raise ValueError("Failed to add port %s/%s" % (proto, port))
 |  | ||||||
| +			raise ValueError("Failed to modify port %s/%s" % (proto, port))
 |  | ||||||
|   |  | ||||||
|  	def modify(self, port, proto, serange, setype): |  | ||||||
|  		if serange == "" and setype == "": |  | ||||||
| @@ -458,7 +543,7 @@
 | @@ -458,7 +543,7 @@
 | ||||||
|   |   | ||||||
|  		rc = semanage_commit(self.sh) |  		rc = semanage_commit(self.sh) | ||||||
| @ -313,11 +330,9 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/seobject.py pol | |||||||
| +			if type == "reserved_port_t":
 | +			if type == "reserved_port_t":
 | ||||||
| +				continue
 | +				continue
 | ||||||
| +			level = semanage_context_get_mls(con)
 | +			level = semanage_context_get_mls(con)
 | ||||||
|  			proto=semanage_port_get_proto_str(u) | +			proto=semanage_port_get_proto_str(u)
 | ||||||
|  			low=semanage_port_get_low(u) | +			low=semanage_port_get_low(u)
 | ||||||
|  			high = semanage_port_get_high(u) | +			high = semanage_port_get_high(u)
 | ||||||
| -			if (name, proto) not in dict.keys():
 |  | ||||||
| -				dict[(name,proto)]=[]
 |  | ||||||
| +			dict[(low, high)]=(type, proto, level)
 | +			dict[(low, high)]=(type, proto, level)
 | ||||||
| +		return dict
 | +		return dict
 | ||||||
| +
 | +
 | ||||||
| @ -334,9 +349,11 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/seobject.py pol | |||||||
| +			if type == "reserved_port_t":
 | +			if type == "reserved_port_t":
 | ||||||
| +				continue
 | +				continue
 | ||||||
| +			level = semanage_context_get_mls(con)
 | +			level = semanage_context_get_mls(con)
 | ||||||
| +			proto=semanage_port_get_proto_str(u)
 |  			proto=semanage_port_get_proto_str(u) | ||||||
| +			low=semanage_port_get_low(u)
 |  			low=semanage_port_get_low(u) | ||||||
| +			high = semanage_port_get_high(u)
 |  			high = semanage_port_get_high(u) | ||||||
|  | -			if (name, proto) not in dict.keys():
 | ||||||
|  | -				dict[(name,proto)]=[]
 | ||||||
| +			if (type, proto) not in dict.keys():
 | +			if (type, proto) not in dict.keys():
 | ||||||
| +				dict[(type,proto)]=[]
 | +				dict[(type,proto)]=[]
 | ||||||
|  			if low == high: |  			if low == high: | ||||||
| @ -356,6 +373,24 @@ diff --exclude-from=exclude -N -u -r nsapolicycoreutils/semanage/seobject.py pol | |||||||
|  		keys=dict.keys() |  		keys=dict.keys() | ||||||
|  		keys.sort() |  		keys.sort() | ||||||
|  		for i in keys: |  		for i in keys: | ||||||
|  | @@ -614,7 +721,7 @@
 | ||||||
|  |  		 | ||||||
|  |  		rc = semanage_commit(self.sh) | ||||||
|  |  		if rc < 0: | ||||||
|  | -			raise ValueError("Failed to add interface %s" % interface)
 | ||||||
|  | +			raise ValueError("Failed to modify interface %s" % interface)
 | ||||||
|  |   | ||||||
|  |  	def delete(self, interface): | ||||||
|  |  		(rc,k) = semanage_iface_key_create(self.sh, interface) | ||||||
|  | @@ -779,7 +886,7 @@
 | ||||||
|  |   | ||||||
|  |  		rc = semanage_commit(self.sh) | ||||||
|  |  		if rc < 0: | ||||||
|  | -			raise ValueError("Failed to add file context for %s" % target)
 | ||||||
|  | +			raise ValueError("Failed to modify file context for %s" % target)
 | ||||||
|  |  		 | ||||||
|  |  	def delete(self, target, ftype): | ||||||
|  |  		(rc,k) = semanage_fcontext_key_create(self.sh, target, self.file_types[ftype]) | ||||||
| diff --exclude-from=exclude -N -u -r nsapolicycoreutils/setsebool/setsebool.c policycoreutils-1.29.8/setsebool/setsebool.c
 | 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
 | --- 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
 | +++ policycoreutils-1.29.8/setsebool/setsebool.c	2006-01-18 13:27:42.000000000 -0500
 | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ | |||||||
| Summary: SELinux policy core utilities. | Summary: SELinux policy core utilities. | ||||||
| Name: policycoreutils | Name: policycoreutils | ||||||
| Version: 1.29.8 | Version: 1.29.8 | ||||||
| Release: 3 | Release: 4 | ||||||
| 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 | ||||||
| @ -97,6 +97,10 @@ rm -rf ${RPM_BUILD_ROOT} | |||||||
| %{_libdir}/python2.4/site-packages/seobject.py* | %{_libdir}/python2.4/site-packages/seobject.py* | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Thu Jan 19 2006 Dan Walsh <dwalsh@redhat.com> 1.29.8-4 | ||||||
|  | - Fixes for "add"-"modify" error messages | ||||||
|  | - Fixes for chcat | ||||||
|  | 
 | ||||||
| * Wed Jan 18 2006 Dan Walsh <dwalsh@redhat.com> 1.29.8-3 | * Wed Jan 18 2006 Dan Walsh <dwalsh@redhat.com> 1.29.8-3 | ||||||
| - Add management of translation file to semaange and seobject | - Add management of translation file to semaange and seobject | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user