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

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5254209 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
  • shadow-4.0.18.2

    Submitted By: Jim Gifford (patches at jg555 dot com)
    Date: 2007-10-29
    Initial Package Version: 4.0.18.2
    Origin: Jim Gifford
    Upstream Status: Submitted
    Description: Fixes usersadd issue
     
    diff -Naur shadow-4.0.18.2.orig/src/useradd.c shadow-4.0.18.2/src/useradd.c
    old new  
    203203        long gid;
    204204        char *errptr;
    205205
     206        struct group* grp = getgrnam (grname);
     207        if (grp)
     208                return grp;
     209
    206210        gid = strtol (grname, &errptr, 10);
    207         if (*errptr || errno == ERANGE || gid < 0) {
    208                 fprintf (stderr,
    209                          _("%s: invalid numeric argument '%s'\n"), Prog,
    210                          grname);
    211                 exit (E_BAD_ARG);
    212         }
    213         return getgrnam (grname);
     211        if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0)
     212                return getgrgid (gid);
     213        return getgrgid (gid);
    214214}
    215215
    216216static long get_number (const char *numstr)
  • shadow-4.0.18.2

    diff -Naur shadow-4.0.18.2.orig/src/usermod.c shadow-4.0.18.2/src/usermod.c
    old new  
    165165        long val;
    166166        char *errptr;
    167167
     168        struct group* grp = getgrnam (grname);
     169        if (grp)
     170                return grp;
     171
    168172        val = strtol (grname, &errptr, 10);
    169173        if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && val >= 0)
    170174                return getgrgid (val);
    171         return getgrnam (grname);
     175        return getgrgid (val);
    172176}
    173177
    174178/*
Note: See TracBrowser for help on using the repository browser.