summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loginutils/cryptpw.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index 55dcc29..23a1884 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -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)
;