- don't free user-supplied string (via -e)
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tue, 5 Aug 2008 14:33:37 +0000 (14:33 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tue, 5 Aug 2008 14:33:37 +0000 (14:33 -0000)
- fix helptext
(r23046 from trunk)

include/usage.h
loginutils/chpasswd.c

index ceac6d0afbf10e33cb53e37f6bbaf9e4312ca870..dcb6e344e77ff0438fd0deac7bdb379ac02115c6 100644 (file)
      "\n       -u      Unlock (re-enable) account" \
 
 #define chpasswd_trivial_usage \
-       USE_GETOPT_LONG("[--md5|--encrypt]") SKIP_GETOPT_LONG("[-m|-e]")
+       USE_GETOPT_LONG("[--md5|--encrypted]") SKIP_GETOPT_LONG("[-m|-e]")
 #define chpasswd_full_usage "\n\n" \
-       "Read user:password information from stdin\n" \
+       "Read user:password information from stdin " \
        "and update /etc/passwd accordingly.\n" \
      "\nOptions:" \
        USE_GETOPT_LONG( \
-     "\n       -e,--encrypt    Supplied passwords are in encrypted form" \
+     "\n       -e,--encrypted  Supplied passwords are in encrypted form" \
      "\n       -m,--md5        Use MD5 encryption instead of DES" \
        ) \
        SKIP_GETOPT_LONG( \
index 7308596ad0e38657f25d099f20ad33ffa9e10048..7908ef1a8d6d4cb1d7829278dde7edf2ec61ad4b 100644 (file)
@@ -65,8 +65,8 @@ int chpasswd_main(int argc ATTRIBUTE_UNUSED, char **argv)
                        bb_info_msg("Password for '%s' changed", name);
                logmode = LOGMODE_STDIO;
                free(name);
-               free(pass);
+               if (!(opt & OPT_ENC))
+                       free(pass);
        }
-
-       return 0;
+       return EXIT_SUCCESS;
 }