RE: shadow 4.0.18.1: useradd -g broken (patch incl.)
"Brandon Peirce" <[email protected]> Tue, 19 Sep 2006 01:11:10 +0200
| Newsgroups | gmane.linux.pld.shadow.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------=_NextPart_000_6189_2e24_3921
Content-Type: text/plain; format=flowed
I wrote:
>Hello,
>
>The fix from http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=198920
>seems
>to have completely broken the -g option of useradd. (src/usradd.c $Id:
>1.100)
The indents in the patch got lost in the cut & paste - sorry :(
Patch resent as attachment.
Brandon
------=_NextPart_000_6189_2e24_3921
Content-Type: text/x-patch; name="shadow-4.0.18.1-useradd-g.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="shadow-4.0.18.1-useradd-g.patch"
--- shadow-4.0.18.1/src/useradd.c 2006-07-28 19:42:48.000000000 +0200
+++ src0/src/useradd.c 2006-09-18 21:14:36.000000000 +0200
@@ -203,11 +203,14 @@
long gid;
char *errptr;
+ errno = 0;
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') {
+ if (errno == ERANGE || gid < 0) {
+ return (struct group*) NULL;
+ } else {
+ return getgrgid (gid);
+ }
}
return getgrnam (grname);
}
------=_NextPart_000_6189_2e24_3921
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline