Submitted By: Jim Gifford (patches at jg555 dot com) Date: 2007-10-29 Initial Package Version: 4.0.18.2 Origin: Jim Gifford Upstream Status: Submitted Description: Fixes usersadd issue diff -Naur shadow-4.0.18.2.orig/src/useradd.c shadow-4.0.18.2/src/useradd.c --- shadow-4.0.18.2.orig/src/useradd.c 2007-10-07 07:36:51.000000000 -0700 +++ shadow-4.0.18.2/src/useradd.c 2007-10-30 02:32:55.000000000 -0700 @@ -203,6 +203,10 @@ long gid; char *errptr; + struct group* grp = getgrnam (grname); + if (grp) + return grp; + gid = strtol (grname, &errptr, 10); if (*errptr || errno == ERANGE || gid < 0) { fprintf (stderr, @@ -210,7 +214,7 @@ grname); exit (E_BAD_ARG); } - return getgrnam (grname); + return getgrgid (gid); } static long get_number (const char *numstr) diff -Naur shadow-4.0.18.2.orig/src/usermod.c shadow-4.0.18.2/src/usermod.c --- shadow-4.0.18.2.orig/src/usermod.c 2007-10-27 06:01:19.000000000 -0700 +++ shadow-4.0.18.2/src/usermod.c 2007-10-30 02:32:14.000000000 -0700 @@ -165,10 +165,14 @@ long val; char *errptr; + struct group* grp = getgrnam (grname); + if (grp) + return grp; + val = strtol (grname, &errptr, 10); if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && val >= 0) return getgrgid (val); - return getgrnam (grname); + return getgrgid (val); } /*