diff --git a/ChangeLog b/ChangeLog index 2b56733d..50193bdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-11-10 Nicolas François + + * NEWS, src/useradd.c: allow non numerical group identifier to be + specified with useradd's -g option. Applied Debian patch + 397_non_numerical_identifier. Thanks also to Greg Schafer + . + 2007-10-28 Nicolas François * configure.in: Prepare the next release: 4.0.18.2. The gettext diff --git a/NEWS b/NEWS index 0288a723..69f16c5a 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ $Id: NEWS,v 1.492 2007/02/01 20:49:25 kloczek Exp $ +shadow-4.0.18.1 -> shadow-4.0.18.2 UNRELEASED + +*** general: +- useradd: Allow non numerical group identifier to be specified with + useradd's -g option. Applied Debian patch 397_non_numerical_identifier. + Thanks also to Greg Schafer . + shadow-4.0.18.1 -> shadow-4.0.18.2 28-10-2007 *** general: diff --git a/src/useradd.c b/src/useradd.c index b47475d9..eebe8e3d 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -204,12 +204,8 @@ static struct group *getgr_nam_gid (const char *grname) 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); }