[Pkg-shadow-commits] sid/debian/patches 406_good_name.dpatch,1.1,1.2

Alexander Gattin pkg-shadow-devel@lists.alioth.debian.org
Sun, 08 May 2005 14:47:16 +0000


Update of /cvsroot/pkg-shadow/sid/debian/patches
In directory haydn:/tmp/cvs-serv1341/patches

Modified Files:
	406_good_name.dpatch 
Log Message:
fixed good_name to accept only user/group names matching "^[^-:\n][^:\n]*$", closes: #264879

Index: 406_good_name.dpatch
===================================================================
RCS file: /cvsroot/pkg-shadow/sid/debian/patches/406_good_name.dpatch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 406_good_name.dpatch	8 May 2005 13:01:37 -0000	1.1
+++ 406_good_name.dpatch	8 May 2005 14:47:14 -0000	1.2
@@ -4,8 +4,9 @@
 ## All lines beginning with `## DP:' are a description of the patch.
 ##
 ## DP: Relaxed usernames/groupnames checking patch.
-## DP: Allows to use any char inside user/grouname except ':' and '\0' ('-'
-## DP: cannot only be used as the leading character).
+## DP: Allows any non-empty user/grounames that don't contain ':' and '\n'
+## DP: characters and don't start with '-'. This patch is more restrictive
+## DP: than original Karl's version. closes: #264879
 ## DP: 
 ## DP: Comments from Karl Ramm (shadow 1:4.0.3-9, 20 Aug 2003 02:06:50 -0400):
 ## DP: 
@@ -33,10 +34,9 @@
 exit 0
 
 @DPATCH@
-
-diff -Nru shadow-4.0.3/libmisc/chkname.c shadow-4.0.3_30.4/libmisc/chkname.c
---- shadow-4.0.3/libmisc/chkname.c	2002-01-10 14:04:34.000000000 +0100
-+++ shadow-4.0.3_30.4/libmisc/chkname.c	2004-11-02 22:17:35.000000000 +0100
+diff -urNad shadow-4.0.3/libmisc/chkname.c /tmp/dpep.aDA3oY/shadow-4.0.3/libmisc/chkname.c
+--- shadow-4.0.3/libmisc/chkname.c	2002-01-10 15:04:34.000000000 +0200
++++ /tmp/dpep.aDA3oY/shadow-4.0.3/libmisc/chkname.c	2005-05-08 16:41:10.000000000 +0300
 @@ -21,6 +21,7 @@
  static int
  good_name(const char *name)
@@ -45,17 +45,20 @@
  	/*
  	 * User/group names must match [a-z_][a-z0-9_-]*
  	 */
-@@ -34,6 +35,13 @@
+@@ -34,6 +35,16 @@
  		    (*name == '$' && *(name+1) == NULL)))
  			return 0;
  	}
 +#endif
-+	/* seeing no sufficiently good reason for the above... */
-+	if (*name == '-')
-+		return 1;
-+	while (*++name)
-+		if (*name == ':')
-+			return 1;
++	/*
++	 * Allow more relaxed user/group names in Debian -- ^[^-:\n][^:\n]*$
++	 */
++	if (!*name || *name == '-')
++		return 0;
++	do
++		if (*name == ':' || *name == '\n')
++			return 0;
++	while (*++name);
  
  	return 1;
  }