Skip to contentSkip to conversation

libsepol: fix version comparison when writing policies

PATCH In review Darrel Goeddel 4 participants 4 messages Oct 24, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol: fix version comparison when writing policies

Fix a version comparison that prohibits the "old style" range transition rules from being written for a version 5 base policy.

---

libsepol/src/write.c +0 -0
diff -ruNp --exclude=.svn selinux-base/libsepol/src/write.c selinux/libsepol/src/write.c
@@ -1641,7 +1641,7 @@ int policydb_write(policydb_t * p, struc
	if ((p->policyvers >= POLICYDB_VERSION_MLS
	     && p->policy_type == POLICY_KERN)
	    || (p->policyvers >= MOD_POLICYDB_VERSION_MLS
-		&& p->policyvers < MOD_POLICYDB_VERSION_MLS
+		&& p->policyvers < MOD_POLICYDB_VERSION_RANGETRANS
		&& p->policy_type == POLICY_BASE)) {
		if (range_write(p, fp)) {
			return POLICYDB_ERROR;
Signature · 6 lines
Darrel

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Darrel Goeddel

Fix a version comparison that prohibits the "old style" range transition rules from being written for a version 5 base policy.

---

diff -ruNp --exclude=.svn selinux-base/libsepol/src/write.c selinux/libsepol/src/write.c

libsepol/src/write.c int policydb_write(policydb_t * p, struc · line 1647

Quoted 8 lines
libsepol/src/write.c +1 -1
@@ -1641,7 +1641,7 @@ int policydb_write(policydb_t * p, struc
 	if ((p->policyvers >= POLICYDB_VERSION_MLS
 	     && p->policy_type == POLICY_KERN)
 	    || (p->policyvers >= MOD_POLICYDB_VERSION_MLS
-		&& p->policyvers < MOD_POLICYDB_VERSION_MLS
+		&& p->policyvers < MOD_POLICYDB_VERSION_RANGETRANS
 		&& p->policy_type == POLICY_BASE)) {
 		if (range_write(p, fp)) {
 			return POLICYDB_ERROR;
Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Darrel Goeddel

Fix a version comparison that prohibits the "old style" range transition rules from being written for a version 5 base policy.

---

Quoted 15 lines

libsepol/src/write.c int policydb_write(policydb_t * p, struc · line 1647

Quoted 12 lines

diff -ruNp --exclude=.svn selinux-base/libsepol/src/write.c selinux/libsepol/src/write.c

libsepol/src/write.c +1 -1
@@ -1641,7 +1641,7 @@ int policydb_write(policydb_t * p, struc
 	if ((p->policyvers >= POLICYDB_VERSION_MLS
 	     && p->policy_type == POLICY_KERN)
 	    || (p->policyvers >= MOD_POLICYDB_VERSION_MLS
-		&& p->policyvers < MOD_POLICYDB_VERSION_MLS
+		&& p->policyvers < MOD_POLICYDB_VERSION_RANGETRANS
 		&& p->policy_type == POLICY_BASE)) {
 		if (range_write(p, fp)) {
 			return POLICYDB_ERROR;

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 23 lines · Joshua Brindle
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Darrel Goeddel

Fix a version comparison that prohibits the "old style" range transition rules from being written for a version 5 base policy.

---

Quoted 15 lines

libsepol/src/write.c int policydb_write(policydb_t * p, struc · line 1647

Quoted 12 lines

diff -ruNp --exclude=.svn selinux-base/libsepol/src/write.c selinux/libsepol/src/write.c

libsepol/src/write.c +1 -1
@@ -1641,7 +1641,7 @@ int policydb_write(policydb_t * p, struc
 	if ((p->policyvers >= POLICYDB_VERSION_MLS
 	     && p->policy_type == POLICY_KERN)
 	    || (p->policyvers >= MOD_POLICYDB_VERSION_MLS
-		&& p->policyvers < MOD_POLICYDB_VERSION_MLS
+		&& p->policyvers < MOD_POLICYDB_VERSION_RANGETRANS
 		&& p->policy_type == POLICY_BASE)) {
 		if (range_write(p, fp)) {
 			return POLICYDB_ERROR;
Quoted 3 lines

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.