source: patches/shadow-4.0.18.2-useradd_fix-1.patch@ ed4cc3a

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since ed4cc3a was ed4cc3a, checked in by Jim Gifford <clfs@…>, 17 years ago

Added useradd_fix patch to shadow

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[ed4cc3a]1Submitted By: Jim Gifford (patches at jg555 dot com)
2Date: 2007-10-29
3Initial Package Version: 4.0.18.2
4Origin: Jim Gifford
5Upstream Status: Submitted
6Description: Fixes usersadd issue
7
8diff -Naur shadow-4.0.18.2.orig/src/useradd.c shadow-4.0.18.2/src/useradd.c
9--- shadow-4.0.18.2.orig/src/useradd.c 2007-10-07 07:36:51.000000000 -0700
10+++ shadow-4.0.18.2/src/useradd.c 2007-10-29 23:33:26.000000000 -0700
11@@ -203,14 +203,14 @@
12 long gid;
13 char *errptr;
14
15+ struct group* grp = getgrnam (grname);
16+ if (grp)
17+ return grp;
18+
19 gid = strtol (grname, &errptr, 10);
20- if (*errptr || errno == ERANGE || gid < 0) {
21- fprintf (stderr,
22- _("%s: invalid numeric argument '%s'\n"), Prog,
23- grname);
24- exit (E_BAD_ARG);
25- }
26- return getgrnam (grname);
27+ if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0)
28+ return getgrgid (gid);
29+ return getgrgid (gid);
30 }
31
32 static long get_number (const char *numstr)
33diff -Naur shadow-4.0.18.2.orig/src/usermod.c shadow-4.0.18.2/src/usermod.c
34--- shadow-4.0.18.2.orig/src/usermod.c 2007-10-27 06:01:19.000000000 -0700
35+++ shadow-4.0.18.2/src/usermod.c 2007-10-29 23:34:42.000000000 -0700
36@@ -165,10 +165,14 @@
37 long val;
38 char *errptr;
39
40+ struct group* grp = getgrnam (grname);
41+ if (grp)
42+ return grp;
43+
44 val = strtol (grname, &errptr, 10);
45 if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && val >= 0)
46 return getgrgid (val);
47- return getgrnam (grname);
48+ return getgrgid (val);
49 }
50
51 /*
52
Note: See TracBrowser for help on using the repository browser.