# DIY Linux Patch Date: 2007-11-08 Author: Greg Schafer Origin: Modelled on the same upstream fix for usermod. Maker: Greg Schafer Upstream Status: Submitted, applied. Description: Fix -g problems in useradd. 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 14:36:51.000000000 +0000 +++ shadow-4.0.18.2/src/useradd.c 2007-11-08 06:33:32.433004367 +0000 @@ -204,12 +204,8 @@ char *errptr; gid = strtol (grname, &errptr, 10); - if (*errptr || errno == ERANGE || gid < 0) { - fprintf (stderr, - _("%s: invalid numeric argument '%s'\n"), Prog, - grname); - exit (E_BAD_ARG); - } + if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0) + return getgrgid (gid); return getgrnam (grname); }