summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2017-01-20 19:47:49 +0100
committerDenys Vlasenko2017-01-20 19:47:49 +0100
commit9731ca7611e19827702eb8c690fb6c3b37403319 (patch)
tree703d8fbaf75e872fca83ca1e57e830eaeff1aace
parent38972a8df1df970a5878bbd7fc5ef6259f1168ab (diff)
downloadbusybox-9731ca7611e19827702eb8c690fb6c3b37403319.zip
busybox-9731ca7611e19827702eb8c690fb6c3b37403319.tar.gz
password utils: improve --help, make DEFAULT_PASSWD_ALGO visible if CHPASSWD
Was: $ cryptpw --help ... Print crypt(3) hashed PASSWORD -P,--password-fd=N Read password from fd N -m,--method=TYPE Encryption method -S,--salt=SALT User: "What methods exist? which one os default?" Now: Print crypt(3) hashed PASSWORD -P,--password-fd N Read password from fd N -m,--method TYPE des,md5,sha256/512 (default des) -S,--salt SALT Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/usage.src.h8
-rw-r--r--loginutils/chpasswd.c12
-rw-r--r--loginutils/cryptpw.c8
-rw-r--r--loginutils/passwd.c2
4 files changed, 19 insertions, 11 deletions
diff --git a/include/usage.src.h b/include/usage.src.h
index 78beccf..00369df 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -14,6 +14,14 @@
#define NOUSAGE_STR "\b"
+#if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA
+# define CRYPT_METHODS_HELP_STR "des,md5,sha256/512" \
+ " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")"
+#else
+# define CRYPT_METHODS_HELP_STR "des,md5" \
+ " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")"
+#endif
+
INSERT
#define busybox_notes_usage \
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c
index 2d268be..baafd35 100644
--- a/loginutils/chpasswd.c
+++ b/loginutils/chpasswd.c
@@ -13,9 +13,9 @@
//config: and uses this information to update a group of existing users.
//config:
//config:config FEATURE_DEFAULT_PASSWD_ALGO
-//config: string "Default password encryption method (passwd -a, cryptpw -m parameter)"
+//config: string "Default encryption method (passwd -a, cryptpw -m, chpasswd -c ALG)"
//config: default "des"
-//config: depends on PASSWD || CRYPTPW
+//config: depends on PASSWD || CRYPTPW || CHPASSWD
//config: help
//config: Possible choices are "d[es]", "m[d5]", "s[ha256]" or "sha512".
@@ -29,13 +29,13 @@
//usage: "Read user:password from stdin and update /etc/passwd\n"
//usage: IF_LONG_OPTS(
//usage: "\n -e,--encrypted Supplied passwords are in encrypted form"
-//usage: "\n -m,--md5 Use MD5 encryption instead of DES"
-//usage: "\n -c,--crypt-method Use the specified method to encrypt the passwords"
+//usage: "\n -m,--md5 Eencrypt using md5, not des"
+//usage: "\n -c,--crypt-method ALG "CRYPT_METHODS_HELP_STR
//usage: )
//usage: IF_NOT_LONG_OPTS(
//usage: "\n -e Supplied passwords are in encrypted form"
-//usage: "\n -m Use MD5 encryption instead of DES"
-//usage: "\n -c Use the specified method to encrypt the passwords"
+//usage: "\n -m Eencrypt using md5, not des"
+//usage: "\n -c ALG "CRYPT_METHODS_HELP_STR
//usage: )
#include "libbb.h"
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index d630231..696e169 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -37,15 +37,15 @@
//usage:#define cryptpw_full_usage "\n\n"
//usage: "Print crypt(3) hashed PASSWORD\n"
//usage: IF_LONG_OPTS(
-//usage: "\n -P,--password-fd=N Read password from fd N"
+//usage: "\n -P,--password-fd N Read password from fd N"
/* //usage: "\n -s,--stdin Use stdin; like -P0" */
-//usage: "\n -m,--method=TYPE Encryption method"
-//usage: "\n -S,--salt=SALT"
+//usage: "\n -m,--method TYPE "CRYPT_METHODS_HELP_STR
+//usage: "\n -S,--salt SALT"
//usage: )
//usage: IF_NOT_LONG_OPTS(
//usage: "\n -P N Read password from fd N"
/* //usage: "\n -s Use stdin; like -P0" */
-//usage: "\n -m TYPE Encryption method TYPE"
+//usage: "\n -m TYPE "CRYPT_METHODS_HELP_STR
//usage: "\n -S SALT"
//usage: )
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index 52b66ca..b7b7423 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -32,7 +32,7 @@
//usage:#define passwd_full_usage "\n\n"
//usage: "Change USER's password (default: current user)"
//usage: "\n"
-//usage: "\n -a ALG Encryption method"
+//usage: "\n -a ALG "CRYPT_METHODS_HELP_STR
//usage: "\n -d Set password to ''"
//usage: "\n -l Lock (disable) account"
//usage: "\n -u Unlock (enable) account"