source: patches/shadow-4.0.18.2-useradd_fix-2.patch@ 2d560a1

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

Updated shadow patch. Better Patch

  • Property mode set to 100644
File size: 1.3 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
[65850c02]10+++ shadow-4.0.18.2/src/useradd.c 2007-10-30 02:32:55.000000000 -0700
11@@ -203,6 +203,10 @@
[ed4cc3a]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);
[65850c02]20 if (*errptr || errno == ERANGE || gid < 0) {
21 fprintf (stderr,
22@@ -210,7 +214,7 @@
23 grname);
24 exit (E_BAD_ARG);
25 }
[ed4cc3a]26- return getgrnam (grname);
27+ return getgrgid (gid);
28 }
29
30 static long get_number (const char *numstr)
31diff -Naur shadow-4.0.18.2.orig/src/usermod.c shadow-4.0.18.2/src/usermod.c
32--- shadow-4.0.18.2.orig/src/usermod.c 2007-10-27 06:01:19.000000000 -0700
[65850c02]33+++ shadow-4.0.18.2/src/usermod.c 2007-10-30 02:32:14.000000000 -0700
[ed4cc3a]34@@ -165,10 +165,14 @@
35 long val;
36 char *errptr;
37
38+ struct group* grp = getgrnam (grname);
39+ if (grp)
40+ return grp;
41+
42 val = strtol (grname, &errptr, 10);
43 if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && val >= 0)
44 return getgrgid (val);
45- return getgrnam (grname);
46+ return getgrgid (val);
47 }
48
49 /*
Note: See TracBrowser for help on using the repository browser.