Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/loginutils/chpasswd.c

    r1765 r2725  
    44 *
    55 * Written for SLIND (from passwd.c) by Alexander Shishkin <virtuoso@slind.org>
    6  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    77 */
    8 
    98#include "libbb.h"
    109
    11 #if ENABLE_GETOPT_LONG
    12 #include <getopt.h>
    13 
     10#if ENABLE_LONG_OPTS
    1411static const char chpasswd_longopts[] ALIGN1 =
    1512    "encrypted\0" No_argument "e"
     
    1815#endif
    1916
    20 #define OPT_ENC     1
    21 #define OPT_MD5     2
     17#define OPT_ENC  1
     18#define OPT_MD5  2
    2219
    23 int chpasswd_main(int argc, char **argv);
    24 int chpasswd_main(int argc, char **argv)
     20int chpasswd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     21int chpasswd_main(int argc UNUSED_PARAM, char **argv)
    2522{
    2623    char *name, *pass;
     
    3330
    3431    opt_complementary = "m--e:e--m";
    35     USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;)
     32    IF_LONG_OPTS(applet_long_options = chpasswd_longopts;)
    3633    opt = getopt32(argv, "em");
    3734
    38     while ((name = xmalloc_getline(stdin)) != NULL) {
     35    while ((name = xmalloc_fgetline(stdin)) != NULL) {
    3936        pass = strchr(name, ':');
    4037        if (!pass)
     
    5047                rnd = crypt_make_salt(salt + 3, 4, rnd);
    5148            }
    52             pass = pw_encrypt(pass, salt);
     49            pass = pw_encrypt(pass, salt, 0);
    5350        }
    5451
     
    5653         * we try to find & change his passwd in /etc/passwd */
    5754#if ENABLE_FEATURE_SHADOWPASSWDS
    58         rc = update_passwd(bb_path_shadow_file, name, pass);
     55        rc = update_passwd(bb_path_shadow_file, name, pass, NULL);
    5956        if (rc == 0) /* no lines updated, no errors detected */
    6057#endif
    61             rc = update_passwd(bb_path_passwd_file, name, pass);
     58            rc = update_passwd(bb_path_passwd_file, name, pass, NULL);
    6259        /* LOGMODE_BOTH logs to syslog also */
    6360        logmode = LOGMODE_BOTH;
     
    6865        logmode = LOGMODE_STDIO;
    6966        free(name);
     67        if (!(opt & OPT_ENC))
     68            free(pass);
    7069    }
    71 
    72     return 0;
     70    return EXIT_SUCCESS;
    7371}
Note: See TracChangeset for help on using the changeset viewer.