diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-20 19:47:49 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-20 19:47:49 +0100 |
commit | 9731ca7611e19827702eb8c690fb6c3b37403319 (patch) | |
tree | 703d8fbaf75e872fca83ca1e57e830eaeff1aace | |
parent | 38972a8df1df970a5878bbd7fc5ef6259f1168ab (diff) | |
download | busybox-w32-9731ca7611e19827702eb8c690fb6c3b37403319.tar.gz busybox-w32-9731ca7611e19827702eb8c690fb6c3b37403319.tar.bz2 busybox-w32-9731ca7611e19827702eb8c690fb6c3b37403319.zip |
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.h | 8 | ||||
-rw-r--r-- | loginutils/chpasswd.c | 12 | ||||
-rw-r--r-- | loginutils/cryptpw.c | 8 | ||||
-rw-r--r-- | loginutils/passwd.c | 2 |
4 files changed, 19 insertions, 11 deletions
diff --git a/include/usage.src.h b/include/usage.src.h index 78beccf4d..00369dfb3 100644 --- a/include/usage.src.h +++ b/include/usage.src.h | |||
@@ -14,6 +14,14 @@ | |||
14 | 14 | ||
15 | #define NOUSAGE_STR "\b" | 15 | #define NOUSAGE_STR "\b" |
16 | 16 | ||
17 | #if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA | ||
18 | # define CRYPT_METHODS_HELP_STR "des,md5,sha256/512" \ | ||
19 | " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")" | ||
20 | #else | ||
21 | # define CRYPT_METHODS_HELP_STR "des,md5" \ | ||
22 | " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")" | ||
23 | #endif | ||
24 | |||
17 | INSERT | 25 | INSERT |
18 | 26 | ||
19 | #define busybox_notes_usage \ | 27 | #define busybox_notes_usage \ |
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index 2d268be67..baafd35c8 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c | |||
@@ -13,9 +13,9 @@ | |||
13 | //config: and uses this information to update a group of existing users. | 13 | //config: and uses this information to update a group of existing users. |
14 | //config: | 14 | //config: |
15 | //config:config FEATURE_DEFAULT_PASSWD_ALGO | 15 | //config:config FEATURE_DEFAULT_PASSWD_ALGO |
16 | //config: string "Default password encryption method (passwd -a, cryptpw -m parameter)" | 16 | //config: string "Default encryption method (passwd -a, cryptpw -m, chpasswd -c ALG)" |
17 | //config: default "des" | 17 | //config: default "des" |
18 | //config: depends on PASSWD || CRYPTPW | 18 | //config: depends on PASSWD || CRYPTPW || CHPASSWD |
19 | //config: help | 19 | //config: help |
20 | //config: Possible choices are "d[es]", "m[d5]", "s[ha256]" or "sha512". | 20 | //config: Possible choices are "d[es]", "m[d5]", "s[ha256]" or "sha512". |
21 | 21 | ||
@@ -29,13 +29,13 @@ | |||
29 | //usage: "Read user:password from stdin and update /etc/passwd\n" | 29 | //usage: "Read user:password from stdin and update /etc/passwd\n" |
30 | //usage: IF_LONG_OPTS( | 30 | //usage: IF_LONG_OPTS( |
31 | //usage: "\n -e,--encrypted Supplied passwords are in encrypted form" | 31 | //usage: "\n -e,--encrypted Supplied passwords are in encrypted form" |
32 | //usage: "\n -m,--md5 Use MD5 encryption instead of DES" | 32 | //usage: "\n -m,--md5 Eencrypt using md5, not des" |
33 | //usage: "\n -c,--crypt-method Use the specified method to encrypt the passwords" | 33 | //usage: "\n -c,--crypt-method ALG "CRYPT_METHODS_HELP_STR |
34 | //usage: ) | 34 | //usage: ) |
35 | //usage: IF_NOT_LONG_OPTS( | 35 | //usage: IF_NOT_LONG_OPTS( |
36 | //usage: "\n -e Supplied passwords are in encrypted form" | 36 | //usage: "\n -e Supplied passwords are in encrypted form" |
37 | //usage: "\n -m Use MD5 encryption instead of DES" | 37 | //usage: "\n -m Eencrypt using md5, not des" |
38 | //usage: "\n -c Use the specified method to encrypt the passwords" | 38 | //usage: "\n -c ALG "CRYPT_METHODS_HELP_STR |
39 | //usage: ) | 39 | //usage: ) |
40 | 40 | ||
41 | #include "libbb.h" | 41 | #include "libbb.h" |
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c index d630231c6..696e169fc 100644 --- a/loginutils/cryptpw.c +++ b/loginutils/cryptpw.c | |||
@@ -37,15 +37,15 @@ | |||
37 | //usage:#define cryptpw_full_usage "\n\n" | 37 | //usage:#define cryptpw_full_usage "\n\n" |
38 | //usage: "Print crypt(3) hashed PASSWORD\n" | 38 | //usage: "Print crypt(3) hashed PASSWORD\n" |
39 | //usage: IF_LONG_OPTS( | 39 | //usage: IF_LONG_OPTS( |
40 | //usage: "\n -P,--password-fd=N Read password from fd N" | 40 | //usage: "\n -P,--password-fd N Read password from fd N" |
41 | /* //usage: "\n -s,--stdin Use stdin; like -P0" */ | 41 | /* //usage: "\n -s,--stdin Use stdin; like -P0" */ |
42 | //usage: "\n -m,--method=TYPE Encryption method" | 42 | //usage: "\n -m,--method TYPE "CRYPT_METHODS_HELP_STR |
43 | //usage: "\n -S,--salt=SALT" | 43 | //usage: "\n -S,--salt SALT" |
44 | //usage: ) | 44 | //usage: ) |
45 | //usage: IF_NOT_LONG_OPTS( | 45 | //usage: IF_NOT_LONG_OPTS( |
46 | //usage: "\n -P N Read password from fd N" | 46 | //usage: "\n -P N Read password from fd N" |
47 | /* //usage: "\n -s Use stdin; like -P0" */ | 47 | /* //usage: "\n -s Use stdin; like -P0" */ |
48 | //usage: "\n -m TYPE Encryption method TYPE" | 48 | //usage: "\n -m TYPE "CRYPT_METHODS_HELP_STR |
49 | //usage: "\n -S SALT" | 49 | //usage: "\n -S SALT" |
50 | //usage: ) | 50 | //usage: ) |
51 | 51 | ||
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 52b66ca50..b7b7423fd 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -32,7 +32,7 @@ | |||
32 | //usage:#define passwd_full_usage "\n\n" | 32 | //usage:#define passwd_full_usage "\n\n" |
33 | //usage: "Change USER's password (default: current user)" | 33 | //usage: "Change USER's password (default: current user)" |
34 | //usage: "\n" | 34 | //usage: "\n" |
35 | //usage: "\n -a ALG Encryption method" | 35 | //usage: "\n -a ALG "CRYPT_METHODS_HELP_STR |
36 | //usage: "\n -d Set password to ''" | 36 | //usage: "\n -d Set password to ''" |
37 | //usage: "\n -l Lock (disable) account" | 37 | //usage: "\n -l Lock (disable) account" |
38 | //usage: "\n -u Unlock (enable) account" | 38 | //usage: "\n -u Unlock (enable) account" |