source: patches/shadow-4.0.18.1-fixes-1.patch@ c814e64

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

Updated Shadow Patch

  • Property mode set to 100644
File size: 28.6 KB
  • contrib/adduser.c

    Submitted By: Jim Gifford (patches at jg555 dot com)
    Date: 2007-09-04
    Initial Package Version: 4.0.18.1
    Origin: Mailing List
    Upstream Status: Submitted
    Description: Fixes Various Issues From Upstream
                 Adds compability for Samba Machine Names
    	     Corrects Grammer in Man Files
    	     Corrects Useradd issue
    	     Fixes useradd -G and -g
    	     Fix chpasswd and chgpasswd stack overflow
    
    diff -Naur shadow-4.0.18.1.orig/contrib/adduser.c shadow-4.0.18.1/contrib/adduser.c
    old new  
    169169  if (geteuid () != 0)
    170170    {
    171171      printf ("It seems you don't have access to add a new user.  Try\n");
    172       printf ("logging in as root or su root to gain super-user access.\n");
     172      printf ("logging in as root or su root to gain superuser access.\n");
    173173      exit (1);
    174174    }
    175175
  • contrib/groupmems.shar

    diff -Naur shadow-4.0.18.1.orig/contrib/groupmems.shar shadow-4.0.18.1/contrib/groupmems.shar
    old new  
    211211#define EXIT_SUCCESS            0       /* success */
    212212#define EXIT_USAGE              1       /* invalid command syntax */
    213213#define EXIT_GROUP_FILE         2       /* group file access problems */
    214 #define EXIT_NOT_ROOT           3       /* not super user  */
    215 #define EXIT_NOT_EROOT          4       /* not effective super user  */
     214#define EXIT_NOT_ROOT           3       /* not superuser  */
     215#define EXIT_NOT_EROOT          4       /* not effective superuser  */
    216216#define EXIT_NOT_PRIMARY        5       /* not primary owner of group  */
    217217#define EXIT_NOT_MEMBER         6       /* member of group does not exist */
    218218#define EXIT_MEMBER_EXISTS      7       /* member of group already exists */
     
    481481[\fB-g\fI group_name \fR]
    482482X.SH DESCRIPTION
    483483The \fBgroupmems\fR utility allows a user to administer his/her own
    484 group membership list without the requirement of super user privileges.
     484group membership list without the requirement of superuser privileges.
    485485The \fBgroupmems\fR utility is for systems that configure its users to
    486486be in their own name sake primary group (i.e., guest / guest).
    487487X.P
    488 Only the super user, as administrator, can use \fBgroupmems\fR to alter
     488Only the superuser, as administrator, can use \fBgroupmems\fR to alter
    489489the memberships of other groups.
    490490X.IP "\fB-a \fIuser_name\fR"
    491491Add a new user to the group membership list.
     
    496496X.IP "\fB-D\fR"
    497497Delete all users from the group membership list.
    498498X.IP "\fB-g \fIgroup_name\fR"
    499 The super user can specify which group membership list to modify.
     499The superuser can specify which group membership list to modify.
    500500X.SH SETUP
    501501The \fBgroupmems\fR executable should be in mode \fB2770\fR as user \fBroot\fR
    502502and in group \fBgroups\fR.   The system administrator can add users to
  • libmisc/chkname.c

    diff -Naur shadow-4.0.18.1.orig/libmisc/chkname.c shadow-4.0.18.1/libmisc/chkname.c
    old new  
    1818static int good_name (const char *name)
    1919{
    2020        /*
    21          * User/group names must match [a-z_][a-z0-9_-]*[$]
    22          */
    23         if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_'))
     21         * User/group names must match gnu e-regex:
     22         *    [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
     23         *
     24         * as a non-POSIX, extension, allow "$" as the last char for
     25         * sake of Samba 3.x "add machine script"
     26         */
     27        if (!*name || !((*name >= 'a' && *name <= 'z')
     28             || (*name >= 'A' && *name <= 'Z')
     29             || (*name >= '0' && *name <= '9')
     30             || *name == '_' || *name == '.'))
    2431                return 0;
    2532
    2633        while (*++name) {
    27                 if (!((*name >= 'a' && *name <= 'z') ||
    28                       (*name >= '0' && *name <= '9') ||
    29                       *name == '_' || *name == '-' ||
    30                       (*name == '$' && *(name + 1) == '\0')))
     34                if (!(  (*name >= 'a' && *name <= 'z')
     35                     || (*name >= 'A' && *name <= 'Z')
     36                     || (*name >= '0' && *name <= '9')
     37                     || *name == '_' || *name == '.' || *name == '-'
     38                     || (*name == '$' && *(name + 1) == '\0')))
    3139                        return 0;
    3240        }
    3341
     
    4351#endif
    4452
    4553        /*
    46          * User names are limited by whatever utmp can
    47          * handle (usually max 8 characters).
     54         * User names are limited by whatever utmp can handle.
    4855         */
    49         if (strlen (name) > sizeof (ut.ut_user))
     56        if (strlen(name) + 1 > sizeof(ut.ut_user))
    5057                return 0;
    5158
    5259        return good_name (name);
     
    5461
    5562int check_group_name (const char *name)
    5663{
    57         /*
    58          * Arbitrary limit for group names - max 16
    59          * characters (same as on HP-UX 10).
    60          */
    61         if (strlen (name) > 16)
     64#if HAVE_UTMPX_H
     65        struct utmpx ut;
     66#else
     67        struct utmp ut;
     68#endif
     69
     70        if (strlen(name) + 1 > sizeof(ut.ut_user))
    6271                return 0;
    6372
    6473        return good_name (name);
  • man/chfn.1.xml

    diff -Naur shadow-4.0.18.1.orig/man/chfn.1.xml shadow-4.0.18.1/man/chfn.1.xml
    old new  
    3232      </citerefentry> and similar programs. A normal user may only change
    3333      the fields for her own account, subject to the restrictions in
    3434      <filename>/etc/login.defs</filename>. (The default configuration is to
    35       prevent users from changing their fullname.) The super user may change
    36       any field for any account. Additionally, only the super user may use
     35      prevent users from changing their fullname.) The superuser may change
     36      any field for any account. Additionally, only the superuser may use
    3737      the <option>-o</option> option to change the undefined portions of the
    3838      GECOS field.
    3939    </para>
  • man/chsh.1.xml

    diff -Naur shadow-4.0.18.1.orig/man/chsh.1.xml shadow-4.0.18.1/man/chsh.1.xml
    old new  
    2828    <para>
    2929      <command>chsh</command> changes the user login shell. This determines
    3030      the name of the user's initial login command. A normal user may only
    31       change the login shell for her own account, the super user may change
     31      change the login shell for her own account, the superuser may change
    3232      the login shell for any account.
    3333    </para>
    3434
     
    7272    <para>
    7373      The only restriction placed on the login shell is that the command
    7474      name must be listed in <filename>/etc/shells</filename>, unless the
    75       invoker is the super-user, and then any value may be added. An
     75      invoker is the superuser, and then any value may be added. An
    7676      account with a restricted login shell may not change her login shell.
    7777      For this reason, placing <filename>/bin/rsh</filename> in
    7878      <filename>/etc/shells</filename> is discouraged since accidentally
  • man/groupadd.8

    diff -Naur shadow-4.0.18.1.orig/man/groupadd.8 shadow-4.0.18.1/man/groupadd.8
    old new  
    7070Shadow password suite configuration.
    7171.SH "CAVEATS"
    7272.PP
    73 Groupnames must begin with a lower case letter or an underscore, and only lower case letters, underscores, dashes, and dollar signs may follow. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]
    74 .PP
    75 Groupnames may only be up to 16 characters long.
     73Groupnames may only be up to 32 characters long.
    7674.PP
    7775If the groupname already exists in an external group database such as NIS,
    7876\fBgroupadd\fR
    7977will deny the group creation request.
    80 .PP
    81 Groupnames may only be up to 16 characters long.
    8278.SH "EXIT VALUES"
    8379.PP
    8480The
  • man/groupadd.8.xml

    diff -Naur shadow-4.0.18.1.orig/man/groupadd.8.xml shadow-4.0.18.1/man/groupadd.8.xml
    old new  
    2929  <refsect1 id='description'>
    3030    <title>DESCRIPTION</title>
    3131    <para>The <command>groupadd</command> command creates a new group
    32       account using the values specified on the command line and the default
     32      account using the values specified on the command line plus the default
    3333      values from the system. The new group will be entered into the system
    3434      files as needed.
    3535    </para>
     
    4747          <option>-f</option>
    4848        </term>
    4949        <listitem>
    50           <para>This option causes to just exit with success status if the
    51             specified group already exists. With <option>-g</option>, if
    52             specified GID already exists, other (unique) GID is chosen (i.e.
     50          <para>This option causes the command to simply exit with success
     51            status if the
     52            specified group already exists. When used with
     53            <option>-g</option>, and the
     54            specified GID already exists, another (unique) GID is chosen (i.e.
    5355            <option>-g</option> is turned off).
    5456          </para>
    5557        </listitem>
     
    101103        </term>
    102104        <listitem>
    103105          <para>
    104             This option permits to add group with non-unique GID.
     106            This option permits to add a group with a non-unique GID.
    105107          </para>
    106108        </listitem>
    107109      </varlistentry>
     
    138140       only lower case letters, underscores, dashes, and dollar signs may
    139141       follow. In regular expression terms: [a-z_][a-z0-9_-]*[$]
    140142     </para>
    141      <para>Groupnames may only be up to 16 characters long.</para>
    142 
    143143     <para>
    144144       If the groupname already exists in an external group database
    145145       such as NIS, <command>groupadd</command> will deny the group
    146146       creation request.
    147147     </para>
    148 
    149148     <para>Groupnames may only be up to 16 characters long.</para>
    150 
    151149   </refsect1>
    152150
    153151  <refsect1 id='exit_values'>
  • man/groupmems.8.xml

    diff -Naur shadow-4.0.18.1.orig/man/groupmems.8.xml shadow-4.0.18.1/man/groupmems.8.xml
    old new  
    2727    <title>DESCRIPTION</title>
    2828    <para>
    2929      The <command>groupmems</command> utility allows a user to administer
    30       his/her own group membership list without the requirement of super
    31       user privileges. The <command>groupmems</command> utility is for
     30      his/her own group membership list without the requirement of
     31      superuser privileges. The <command>groupmems</command> utility is for
    3232      systems that configure its users to be in their own name sake primary
    3333      group (i.e., guest / guest).
    3434    </para>
    3535
    36     <para>Only the super user, as administrator, can use
     36    <para>Only the superuser, as administrator, can use
    3737      <command>groupmems</command> to alter the memberships of other groups.
    3838    </para>
    3939  </refsect1>
     
    6666      <varlistentry>
    6767        <term><option>-g</option> <replaceable>group_name</replaceable></term>
    6868        <listitem>
    69           <para>The super user can specify which group membership
     69          <para>The superuser can specify which group membership
    7070            list to modify.
    7171          </para>
    7272        </listitem>
  • man/groupmod.8.xml

    diff -Naur shadow-4.0.18.1.orig/man/groupmod.8.xml shadow-4.0.18.1/man/groupmod.8.xml
    old new  
    4343        </term>
    4444        <listitem>
    4545          <para>
    46             Specify the new group ID for the <replaceable>GROUP</replaceable>.
    47             The numerical value of the <replaceable>GID</replaceable> must be
     46            The group ID of the given <replaceable>GROUP</replaceable> will be
     47            changed to <replaceable>GID</replaceable>.
     48            The value of <replaceable>GID</replaceable> must be
    4849            a non-negative decimal integer. This value must be unique, unless
    4950            the <option>-o</option> option is used. Values between 0 and 999
    50             are typically reserved for system groups. Any files which the old
    51             group ID is the file group ID must have the file group ID changed
     51            are typically reserved for system groups. Any files that have
     52            the old group ID and must continue to belong to
     53            <replaceable>GROUP</replaceable>, must have their group ID changed
    5254            manually.
    5355          </para>
    5456        </listitem>
     
    7779        </term>
    7880        <listitem>
    7981          <para>
    80             When used with the <option>-g</option> option allow to change the
    81             group <replaceable>GID</replaceable> to non-unique value.
     82            When used with the <option>-g</option> option, allow to change the
     83            group <replaceable>GID</replaceable> to a non-unique value.
    8284          </para>
    8385        </listitem>
    8486      </varlistentry>
  • man/login.1.xml

    diff -Naur shadow-4.0.18.1.orig/man/login.1.xml shadow-4.0.18.1/man/login.1.xml
    old new  
    184184    </para>
    185185
    186186    <para>
    187       As any program, <command>login</command> appearance could be faked.
    188       If non-trusted users have a physical access to the machine, an
     187      As with any program, <command>login</command>'s appearance can be faked.
     188      If non-trusted users have physical access to a machine, an
    189189      attacker could use this to obtain the password of the next person
    190       sitting in front of the machine. Under Linux, the SAK mecanism can be
    191       used by users to initiate of a trusted path and prevent this kind of
     190      coming to sit in front of the machine. Under Linux, the SAK mechanism can be
     191      used by users to initiate a trusted path and prevent this kind of
    192192      attack.
    193193    </para>
    194194
  • man/newusers.8.xml

    diff -Naur shadow-4.0.18.1.orig/man/newusers.8.xml shadow-4.0.18.1/man/newusers.8.xml
    old new  
    6060        </term>
    6161        <listitem>
    6262          <para>
    63             This field may be the name of an existing group, in which case
    64             the named user will be added as a member. If a non-existent
    65             numerical group is given, a new group will be created having
    66             this number.
     63            This field must contain the name (or number) of a group. The user
     64            will be added as a member to this group. When a non-existent
     65            group name or number is specified, a new group will be created.
     66            In the case of a non-existent group number, both the name and the
     67            number of the new group will be this number.
    6768          </para>
    6869        </listitem>
    6970      </varlistentry>
     
    7374        </term>
    7475        <listitem>
    7576          <para>
    76             This field will be checked for existence as a directory and a
    77             new directory with the same name will be created if it does not
     77            This field will be checked for existence as a directory, and a
     78            new directory with this name will be created if it does not
    7879            already exist. The ownership of the directory will be set to be
    7980            that of the user being created or updated.
    8081          </para>
  • man/passwd.1.xml

    diff -Naur shadow-4.0.18.1.orig/man/passwd.1.xml shadow-4.0.18.1/man/passwd.1.xml
    old new  
    2828    <para>
    2929      <command>passwd</command> changes passwords for user accounts.  A
    3030      normal user may only change the password for his/her own account, while
    31       the super user may change the password for any account.
     31      the superuser may change the password for any account.
    3232      <command>passwd</command> also changes account information, such as
    3333      the full name of the user, the user's login shell, or his/her password
    3434      expiry date and interval.
     
    4040        The user is first prompted for his/her old password, if one is
    4141        present. This password is then encrypted and compared against the
    4242        stored password. The user has only one chance to enter the correct
    43         password. The super user is permitted to bypass this step so that
     43        password. The superuser is permitted to bypass this step so that
    4444        forgotten passwords may be changed.
    4545      </para>
    4646
  • man/shadow.3.xml

    diff -Naur shadow-4.0.18.1.orig/man/shadow.3.xml shadow-4.0.18.1/man/shadow.3.xml
    old new  
    163163  <refsect1 id='caveats'>
    164164    <title>CAVEATS</title>
    165165    <para>
    166       These routines may only be used by the super user as access to the
     166      These routines may only be used by the superuser as access to the
    167167      shadow password file is restricted.
    168168    </para>
    169169  </refsect1>
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/man/su.1.xml shadow-4.0.18.1/man/su.1.xml
    old new  
    88  </refmeta>
    99  <refnamediv id='name'>
    1010    <refname>su</refname>
    11     <refpurpose>change user ID or become super-user</refpurpose>
     11    <refpurpose>change user ID or become superuser</refpurpose>
    1212  </refnamediv>
    1313  <refsynopsisdiv id='synopsis'>
    1414    <cmdsynopsis>
     
    3030      <command>su</command> is used to become another user during a login
    3131      session. Invoked without a <option>username</option>,
    3232      <command>su</command> defaults to
    33       becoming the super user. The optional argument <option>-</option> may
     33      becoming the superuser. The optional argument <option>-</option> may
    3434      be used to provide an environment similar to what the user would
    3535      expect had the user logged in directly.
    3636    </para>
     
    5858      The current environment is passed to the new shell. The value of
    5959      <envar>$PATH</envar> is reset to <filename>/bin:/usr/bin</filename>
    6060      for normal users, or <filename>/sbin:/bin:/usr/sbin:/usr/bin</filename>
    61       for the super user. This may be changed with the
     61      for the superuser. This may be changed with the
    6262      <emphasis>ENV_PATH</emphasis> and <emphasis>ENV_SUPATH</emphasis>
    6363      definitions in <filename>/etc/login.defs</filename>.
    6464    </para>
     
    7878      <varlistentry>
    7979        <term>
    8080          <option>-c</option>, <option>--command</option>
    81           <replaceable>SHELL</replaceable>
     81          <replaceable>COMMAND</replaceable>
    8282        </term>
    8383        <listitem>
    8484          <para>
     
    112112        <listitem>
    113113          <para>The shell that will be invoked.</para>
    114114          <para>
    115             The invoked shell is choosen among (higest priority first):
     115            The invoked shell is chosen from (highest priority first):
    116116            <itemizedlist>
    117117              <listitem>
    118                 <para>The shell specified with --shell</para>
     118                <para>The shell specified with --shell.</para>
    119119              </listitem>
    120120              <listitem>
    121121                <para>
     
    141141          <para>
    142142            If the target user has a restricted shell (i.e. the shell field of
    143143            this user's entry in <filename>/etc/passwd</filename> is not
    144             specified in <filename>/etc/shell</filename>), then the
     144            listed in <filename>/etc/shell</filename>), then the
    145145            <option>--shell</option> option or the <envar>$SHELL</envar>
    146             environment variable won't be taken into account unless
    147             <command>su</command> is called by the root.
     146            environment variable won't be taken into account, unless
     147            <command>su</command> is called by root.
    148148          </para>
    149149        </listitem>
    150150      </varlistentry>
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/man/useradd.8 shadow-4.0.18.1/man/useradd.8
    old new  
    168168Similarly, if the username already exists in an external user database such as NIS,
    169169\fBuseradd\fR
    170170will deny the user account creation request.
    171 .PP
    172 Usernames must begin with a lower case letter or an underscore, and only lower case letters, underscores, dashes, and dollar signs may follow. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]
    173171.SH "FILES"
    174172.TP 3n
    175173\fI/etc/passwd\fR
  • man/useradd.8.xml

    diff -Naur shadow-4.0.18.1.orig/man/useradd.8.xml shadow-4.0.18.1/man/useradd.8.xml
    old new  
    3636      <para>
    3737        When invoked without the <option>-D</option> option, the
    3838        <command>useradd</command> command creates a new user account using
    39         the values specified on the command line and the default values from
    40         the system. Depending on command line options, the useradd command
     39        the values specified on the command line plus the default values from
     40        the system. Depending on command line options, the
     41        <command>useradd</command> command
    4142        will update system files and may also create the new user's home
    4243        directory and copy initial files.
    4344      </para>
     
    7879      </varlistentry>
    7980      <varlistentry>
    8081        <term>
     82          <option>-D</option>
     83        </term>
     84        <listitem>
     85          <para>
     86            See below, the subsection "Changing the default values".
     87          </para>
     88        </listitem>
     89      </varlistentry>
     90      <varlistentry>
     91        <term>
    8192          <option>-d</option>, <option>--home</option>
    8293          <replaceable>HOME_DIR</replaceable>
    8394        </term>
     
    256267    <refsect2 id='changing_the_default_values'>
    257268      <title>Changing the default values</title>
    258269      <para>
    259         When invoked with the <option>-D</option> option,
    260         <command>useradd</command> will either display the current default
    261         values, or update the default values from the command line. The
    262         valid options are
     270        When invoked with only the <option>-D</option> option,
     271        <command>useradd</command> will display the current default values.
     272        When invoked with <option>-D</option> plus other options,
     273        <command>useradd</command> will update the default values for the
     274        specified options. Valid default-changing options are:
    263275      </para>
    264276      <variablelist remap='IP'>
    265277        <varlistentry>
     
    269281          </term>
    270282          <listitem>
    271283            <para>
    272               The initial path prefix for a new user's home directory. The
     284              The path prefix for a new user's home directory. The
    273285              user's name will be affixed to the end of
    274               <replaceable>HOME_DIR</replaceable> to create the new
    275               directory name if the <option>-d</option> option is not used
     286              <replaceable>BASE_DIR</replaceable> to form the new user's
     287              home directory name, if the <option>-d</option> option is not used
    276288              when creating a new account.
    277289            </para>
    278290          </listitem>
     
    318330          </term>
    319331          <listitem>
    320332            <para>
    321               The name of the new user's login shell. The named program will
    322               be used for all future new user accounts.
     333              The name of a new user's login shell.
    323334            </para>
    324335          </listitem>
    325336        </varlistentry>
    326337      </variablelist>
    327338
    328       <para>
    329         If no options are specified, <command>useradd</command> displays the
    330         current default values.
    331       </para>
    332339    </refsect2>
    333340  </refsect1>
    334341
  • man/userdel.8.xml

    diff -Naur shadow-4.0.18.1.orig/man/userdel.8.xml shadow-4.0.18.1/man/userdel.8.xml
    old new  
    2424    <title>DESCRIPTION</title>
    2525    <para>
    2626      The <command>userdel</command> command modifies the system account
    27       files, deleting all entries that refer to <emphasis
    28       remap='I'>login_name</emphasis>. The named user must exist.
     27      files, deleting all entries that refer to the user name <emphasis
     28      remap='I'>LOGIN</emphasis>. The named user must exist.
    2929    </para>
    3030  </refsect1>
    3131
     
    4141        </term>
    4242        <listitem>
    4343          <para>
    44             This option forces the removal of the user, even if she is still
     44            This option forces the removal of the user account, even if the
     45            user is still
    4546            logged in. It also forces <command>userdel</command> to remove
    46             the user's home directory or her mail spool, even if another
     47            the user's home directory and mail spool, even if another
    4748            user uses the same home directory or if the mail spool is not
    4849            owned by the specified user.  If
    4950            <emphasis>USERGROUPS_ENAB</emphasis> is defined to <emphasis
  • man/usermod.8.xml

    diff -Naur shadow-4.0.18.1.orig/man/usermod.8.xml shadow-4.0.18.1/man/usermod.8.xml
    old new  
    127127            restrictions as the group given with the <option>-g</option>
    128128            option. If the user is currently a member of a group which is
    129129            not listed, the user will be removed from the group. This
    130             behaviour can be changed via <option>-a</option> option, which
    131             appends user to the current supplementary group list.
     130            behaviour can be changed via the <option>-a</option> option, which
     131            appends the user to the current supplementary group list.
    132132          </para>
    133133        </listitem>
    134134      </varlistentry>
     
    143143            remap='I'>LOGIN</emphasis> to <emphasis
    144144            remap='I'>NEW_LOGIN</emphasis>. Nothing else is changed. In
    145145            particular, the user's home directory name should probably be
    146             changed to reflect the new login name.
     146            changed manually to reflect the new login name.
    147147          </para>
    148148        </listitem>
    149149      </varlistentry>
  • src/chgpasswd.c

    diff -Naur shadow-4.0.18.1.orig/src/chgpasswd.c shadow-4.0.18.1/src/chgpasswd.c
    old new  
    243243                newpwd = cp;
    244244                if (!eflg) {
    245245                        if (md5flg) {
    246                                 char salt[12] = "$1$";
     246                                char tmp[12];
     247                                char salt[15] = "\0";
    247248
    248                                 strcat (salt, crypt_make_salt ());
     249                                strcpy( tmp, crypt_make_salt ());
     250                                if( !strncmp( tmp, "$1$", 3) )
     251                                        strcat( salt, "$1$");
     252                                strcat( salt, tmp);
    249253                                cp = pw_encrypt (newpwd, salt);
    250254                        } else
    251255                                cp = pw_encrypt (newpwd, crypt_make_salt ());
  • src/chpasswd.c

    diff -Naur shadow-4.0.18.1.orig/src/chpasswd.c shadow-4.0.18.1/src/chpasswd.c
    old new  
    239239                newpwd = cp;
    240240                if (!eflg) {
    241241                        if (md5flg) {
    242                                 char salt[12] = "$1$";
     242                                char tmp[12];
     243                                char salt[15] = "\0";
    243244
    244                                 strcat (salt, crypt_make_salt ());
     245                                strcpy( tmp, crypt_make_salt ());
     246                                if( !strncmp( tmp, "$1$", 3) )
     247                                        strcat( salt, "$1$");
     248                                strcat( salt, tmp);
    245249                                cp = pw_encrypt (newpwd, salt);
    246250                        } else
    247251                                cp = pw_encrypt (newpwd, crypt_make_salt ());
  • src/groupmems.c

    diff -Naur shadow-4.0.18.1.orig/src/groupmems.c shadow-4.0.18.1/src/groupmems.c
    old new  
    4747#define EXIT_SUCCESS            0       /* success */
    4848#define EXIT_USAGE              1       /* invalid command syntax */
    4949#define EXIT_GROUP_FILE         2       /* group file access problems */
    50 #define EXIT_NOT_ROOT           3       /* not super user  */
    51 #define EXIT_NOT_EROOT          4       /* not effective super user  */
     50#define EXIT_NOT_ROOT           3       /* not superuser  */
     51#define EXIT_NOT_EROOT          4       /* not effective superuser  */
    5252#define EXIT_NOT_PRIMARY        5       /* not primary owner of group  */
    5353#define EXIT_NOT_MEMBER         6       /* member of group does not exist */
    5454#define EXIT_MEMBER_EXISTS      7       /* member of group already exists */
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/useradd.c shadow-4.0.18.1/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, grname);
    210                 exit (E_BAD_ARG);
    211         }
    212         return getgrnam (grname);
     211        if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && gid >= 0)
     212                return getgrgid (gid);
     213        return getgrgid (gid);
    213214}
    214215
    215216static long get_number (const char *numstr)
  • shadow-4.0.18.1

    diff -Naur shadow-4.0.18.1.orig/src/usermod.c shadow-4.0.18.1/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);
    169         if (*errptr || errno == ERANGE || val < 0) {
    170                 fprintf (stderr, _("%s: invalid numeric argument '%s'\n"), Prog,
    171                          grname);
    172                 exit (E_BAD_ARG);
    173         }
    174         return getgrnam (grname);
     173        if (*grname != '\0' && *errptr == '\0' && errno != ERANGE && val >= 0)
     174                return getgrgid (val);
     175        return getgrgid (val);
    175176}
    176177
    177178/*
     
    908909                 */
    909910                int c;
    910911                static struct option long_options[] = {
    911                         {"append", required_argument, NULL, 'a'},
     912                        {"append", no_argument, NULL, 'a'},
    912913                        {"comment", required_argument, NULL, 'c'},
    913914                        {"home", required_argument, NULL, 'd'},
    914915                        {"expiredate", required_argument, NULL, 'e'},
Note: See TracBrowser for help on using the repository browser.