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>
This commit is contained in:
Denys Vlasenko 2017-01-20 19:47:49 +01:00
parent 38972a8df1
commit 9731ca7611
4 changed files with 19 additions and 11 deletions

View File

@ -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 \

View File

@ -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"

View File

@ -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: )

View File

@ -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"