make MKPASSWD a separate config option, not an automatic alias to cryptpw

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-03-31 00:32:39 +02:00
parent f75a96d74c
commit a27dc33f97

View File

@ -14,13 +14,22 @@
//config: default y
//config: help
//config: Encrypts the given password with the crypt(3) libc function
//config: using the given salt.
//config:
//config:config MKPASSWD
//config: bool "mkpasswd"
//config: default y
//config: help
//config: Encrypts the given password with the crypt(3) libc function
//config: using the given salt. Debian has this utility under mkpasswd
//config: name. Busybox provides mkpasswd as an alias for cryptpw.
//applet:IF_CRYPTPW(APPLET(cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP))
//applet:IF_CRYPTPW(APPLET_ODDNAME(mkpasswd, cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP, mkpasswd))
// APPLET_ODDNAME:name main location suid_type help
//applet:IF_MKPASSWD(APPLET_ODDNAME(mkpasswd, cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP, cryptpw))
//kbuild:lib-$(CONFIG_CRYPTPW) += cryptpw.o
//kbuild:lib-$(CONFIG_MKPASSWD) += cryptpw.o
//usage:#define cryptpw_trivial_usage
//usage: "[OPTIONS] [PASSWORD] [SALT]"
@ -40,25 +49,6 @@
//usage: "\n -S SALT"
//usage: )
/* mkpasswd is an alias to cryptpw */
//usage:#define mkpasswd_trivial_usage
//usage: "[OPTIONS] [PASSWORD] [SALT]"
/* We do support -s, we just don't mention it */
//usage:#define mkpasswd_full_usage "\n\n"
//usage: "Crypt PASSWORD using crypt(3)\n"
//usage: IF_LONG_OPTS(
//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: )
//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 -S SALT"
//usage: )
#include "libbb.h"
/* Debian has 'mkpasswd' utility, manpage says:
@ -140,7 +130,7 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv)
if (!password) {
/* Only mkpasswd, and only from tty, prompts.
* Otherwise it is a plain read. */
password = (isatty(STDIN_FILENO) && applet_name[0] == 'm')
password = (ENABLE_MKPASSWD && isatty(STDIN_FILENO) && applet_name[0] == 'm')
? bb_ask_stdin("Password: ")
: xmalloc_fgetline(stdin)
;