Skip to contentSkip to conversation

genhomedircon: fix find() return value usage

PATCH In review Todd C. Miller 3 participants 4 messages Aug 20, 2007 – Aug 23, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genhomedircon: fix find() return value usage

This patch fixes a bug in the genhomedircon python script that would ignore valid entries such as:

/tmp/\.exchange-USER(/.*)? system_u:object_r:ROLE_evolution_exchange_tmp_t:s0

With this fix the python genhomedircon and the C replacement produce equivalent output.

scripts/genhomedircon +1 -1
Index: policycoreutils/scripts/genhomedircon
===================================================================
@@ -272,7 +272,7 @@
 		ret = ""
 		fd = open(self.getHomeDirTemplate(), 'r')
 		for i in  fd.readlines():
-			if i.find("USER") == 1:
+			if i.find("USER") >= 0:
 				i = i.replace("USER", user)
 				i = i.replace("ROLE", prefix)
 				i = i.replace("system_u", sel_user)

--
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.

#1 lore raw
Quoted 9 lines · Todd C. Miller

This patch fixes a bug in the genhomedircon python script that would ignore valid entries such as:

/tmp/\.exchange-USER(/.*)? system_u:object_r:ROLE_evolution_exchange_tmp_t:s0

With this fix the python genhomedircon and the C replacement produce equivalent output.

Note that this is for the stable branch only, since it conflicts with the pending genhomedircon replacement patch for trunk. Does anyone object to this going into stable?

Quoted 17 lines

Index: policycoreutils/scripts/genhomedircon
===================================================================

scripts/genhomedircon +1 -2
@@ -272,7 +272,7 @@
 		ret = ""
 		fd = open(self.getHomeDirTemplate(), 'r')
 		for i in  fd.readlines():
-			if i.find("USER") == 1:
+			if i.find("USER") >= 0:
 				i = i.replace("USER", user)
 				i = i.replace("ROLE", prefix)
 				i = i.replace("system_u", sel_user)
 
--
Quoted 5 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.

--
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 · Joshua Brindle
Quoted 5 lines · Todd C. Miller

This patch fixes a bug in the genhomedircon python script that would ignore valid entries such as:

/tmp/\.exchange-USER(/.*)? system_u:object_r:ROLE_evolution_exchange_tmp_t:s0

Quoted 7 lines
Quoted 4 lines

With this fix the python genhomedircon and the C replacement produce equivalent output.

Note that this is for the stable branch only, since it conflicts with the pending genhomedircon replacement patch for trunk. Does anyone object to this going into stable?

I'll actually merge it to both trunk and stable - we should have a fixed version on both prior to merging the new functionality (if it ever works).

Quoted 30 lines
Quoted 18 lines

Index: policycoreutils/scripts/genhomedircon
===================================================================

scripts/genhomedircon +1 -2
@@ -272,7 +272,7 @@
 		ret = ""
 		fd = open(self.getHomeDirTemplate(), 'r')
 		for i in  fd.readlines():
-			if i.find("USER") == 1:
+			if i.find("USER") >= 0:
 				i = i.replace("USER", user)
 				i = i.replace("ROLE", prefix)
 				i = i.replace("system_u", sel_user)
 
--
Quoted 5 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.

--
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.

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.
#3 lore raw
In reply to Todd C. Miller
Quoted 16 lines · Todd C. Miller

This patch fixes a bug in the genhomedircon python script that would ignore valid entries such as:

/tmp/\.exchange-USER(/.*)? system_u:object_r:ROLE_evolution_exchange_tmp_t:s0

With this fix the python genhomedircon and the C replacement produce equivalent output.

Index: policycoreutils/scripts/genhomedircon
===================================================================

scripts/genhomedircon line 278

Quoted 8 lines
scripts/genhomedircon +1 -1
@@ -272,7 +272,7 @@
 		ret = ""
 		fd = open(self.getHomeDirTemplate(), 'r')
 		for i in  fd.readlines():
-			if i.find("USER") == 1:
+			if i.find("USER") >= 0:
 				i = i.replace("USER", user)
 				i = i.replace("ROLE", prefix)
 				i = i.replace("system_u", sel_user)

Thanks, merged to stable and trunk.

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.