From a4d0cd0a31f06ebefea4bd73b8e5872452583b58 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 5 Aug 2008 14:33:37 +0000 Subject: [PATCH] - don't free user-supplied string (via -e) - fix helptext (r23046 from trunk) --- include/usage.h | 6 +++--- loginutils/chpasswd.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/usage.h b/include/usage.h index ceac6d0af..dcb6e344e 100644 --- a/include/usage.h +++ b/include/usage.h @@ -2916,13 +2916,13 @@ "\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( \ diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index 7308596ad..7908ef1a8 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c @@ -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; } -- 2.25.1