Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/loginutils/chpasswd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 5  Line 5 
5   * Written for SLIND (from passwd.c) by Alexander Shishkin <virtuoso@slind.org>   * 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.   * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
7   */   */
   
8  #include "libbb.h"  #include "libbb.h"
9    
10  #if ENABLE_GETOPT_LONG  #if ENABLE_LONG_OPTS
11  static const char chpasswd_longopts[] ALIGN1 =  static const char chpasswd_longopts[] ALIGN1 =
12   "encrypted\0" No_argument "e"   "encrypted\0" No_argument "e"
13   "md5\0"       No_argument "m"   "md5\0"       No_argument "m"
# Line 30  int chpasswd_main(int argc UNUSED_PARAM, Line 29  int chpasswd_main(int argc UNUSED_PARAM,
29   bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);   bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
30    
31   opt_complementary = "m--e:e--m";   opt_complementary = "m--e:e--m";
32   USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;)   IF_LONG_OPTS(applet_long_options = chpasswd_longopts;)
33   opt = getopt32(argv, "em");   opt = getopt32(argv, "em");
34    
35   while ((name = xmalloc_fgetline(stdin)) != NULL) {   while ((name = xmalloc_fgetline(stdin)) != NULL) {
# Line 53  int chpasswd_main(int argc UNUSED_PARAM, Line 52  int chpasswd_main(int argc UNUSED_PARAM,
52   /* This is rather complex: if user is not found in /etc/shadow,   /* This is rather complex: if user is not found in /etc/shadow,
53   * we try to find & change his passwd in /etc/passwd */   * we try to find & change his passwd in /etc/passwd */
54  #if ENABLE_FEATURE_SHADOWPASSWDS  #if ENABLE_FEATURE_SHADOWPASSWDS
55   rc = update_passwd(bb_path_shadow_file, name, pass);   rc = update_passwd(bb_path_shadow_file, name, pass, NULL);
56   if (rc == 0) /* no lines updated, no errors detected */   if (rc == 0) /* no lines updated, no errors detected */
57  #endif  #endif
58   rc = update_passwd(bb_path_passwd_file, name, pass);   rc = update_passwd(bb_path_passwd_file, name, pass, NULL);
59   /* LOGMODE_BOTH logs to syslog also */   /* LOGMODE_BOTH logs to syslog also */
60   logmode = LOGMODE_BOTH;   logmode = LOGMODE_BOTH;
61   if (rc < 0)   if (rc < 0)

Legend:
Removed from v.983  
changed lines
  Added in v.984