switch -u takes negative number

Peter Vrabec <[email protected]> Mon, 17 Jul 2006 15:25:53 +0200
Newsgroups gmane.linux.pld.shadow.general
Message-ID <[email protected]>
--MP_5.Gq2+obGJ4ozY81.q.e_E=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

could you look at:
http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=198920

and consider applying this patch.

thx.
--MP_5.Gq2+obGJ4ozY81.q.e_E=
Content-Type: text/x-patch; name=shadow-4.0.17-UID_GID.patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=shadow-4.0.17-UID_GID.patch

--- shadow-4.0.17/src/useradd.c.UID_GID	2006-06-22 13:30:32.000000000 +0200
+++ shadow-4.0.17/src/useradd.c	2006-07-17 15:11:49.000000000 +0200
@@ -204,7 +204,7 @@
 	char *ep;
 
 	gid = strtoul (name, &ep, 10);
-	if (*name != '\0' && *ep == '\0')	/* valid numeric GID */
+	if (errno != ERANGE && *name != '\0' && *ep == '\0' && *name != '-')	/* valid numeric GID */
 		return getgrgid (gid);
 
 	return getgrnam (name);
@@ -229,7 +229,7 @@
 	char *ep;
 
 	val = strtoul (cp, &ep, 10);
-	if (*cp != '\0' && *ep == '\0')	/* valid number */
+	if ( errno != ERANGE && *cp != '\0' && *ep == '\0' && *cp != '-') /* valid number */
 		return val;
 
 	fprintf (stderr, _("%s: invalid numeric argument '%s'\n"), Prog, cp);

--MP_5.Gq2+obGJ4ozY81.q.e_E=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline