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

function                                             old     new   delta
chpasswd_main                                        300     319     +19
packed_usage                                       24352   24344      -8
.rodata                                           122227  122195     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 19/-40)            Total: -21 bytes

include/usage.h
loginutils/chpasswd.c

index 1f9d5621d114c3f9c5648fb910c6c00f03dbd8d1..ae6d2bcb6bb780fe285f58156096f02337f1e6a5 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 25145fd1c670275967bbae234a3de0ad648fe1d7..c83d1dad78c5a3bc0dfad776de5b653382d758ca 100644 (file)
@@ -65,8 +65,8 @@ int chpasswd_main(int argc UNUSED_PARAM, 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;
 }