[Pkg-shadow-devel] Bug#552006: Regression from etch

Martin von Wittich martin.von.wittich at iserv.eu
Fri Nov 6 16:10:12 UTC 2009


I diffed the useradd.c code from etch and lenny, and found the following
change:

 static struct group *getgr_nam_gid (const char *grname)
 {
        long gid;
        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);
-       }
-       return getgrnam (grname);
+       if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0)

+               return xgetgrgid (gid);
+       return xgetgrnam (grname);
 }

I believe that the actual bug is located in xgetgrnam which seems to be some
kind of wrapper for glibc's getgrnam. Apparently this wrapper does not work as
it should :/
Unfortunately my C and shadow knowledge is too limited to delve deeper into
this code; xgetgrnam seems to be created by some preprocessor black magic. I
really hope someone else looks into this, as we want to upgrade about 400
servers to lenny and this bug is keeping us from doing that.

--
Mit freundlichen Grüßen,

Martin von Wittich

IServ GmbH
Rebenring 33
38106 Braunschweig

Telefon:     0531 - 38 044 50
Fax:         0531 - 42 877 45
E-Mail:      martin.von.wittich at iserv.eu 
Internet:    www.iserv.eu





More information about the Pkg-shadow-devel mailing list