summaryrefslogtreecommitdiff
path: root/loginutils/cryptpw.c
diff options
context:
space:
mode:
authorDenys Vlasenko2016-03-31 00:32:39 +0200
committerDenys Vlasenko2016-03-31 00:32:39 +0200
commita27dc33f976b15ccfe9180d652ed16579638c48c (patch)
treeb003f63c2af67c1192e04c647dfa087bedeb5aa5 /loginutils/cryptpw.c
parentf75a96d74c2e87d0f11995466683b0bf316b9973 (diff)
downloadbusybox-a27dc33f976b15ccfe9180d652ed16579638c48c.zip
busybox-a27dc33f976b15ccfe9180d652ed16579638c48c.tar.gz
make MKPASSWD a separate config option, not an automatic alias to cryptpw
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils/cryptpw.c')
-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)
;