diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-03-31 00:32:39 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-03-31 00:32:39 +0200 |
commit | a27dc33f976b15ccfe9180d652ed16579638c48c (patch) | |
tree | b003f63c2af67c1192e04c647dfa087bedeb5aa5 | |
parent | f75a96d74c2e87d0f11995466683b0bf316b9973 (diff) | |
download | busybox-w32-a27dc33f976b15ccfe9180d652ed16579638c48c.tar.gz busybox-w32-a27dc33f976b15ccfe9180d652ed16579638c48c.tar.bz2 busybox-w32-a27dc33f976b15ccfe9180d652ed16579638c48c.zip |
make MKPASSWD a separate config option, not an automatic alias to cryptpw
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | loginutils/cryptpw.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c index 55dcc2914..23a1884f4 100644 --- a/loginutils/cryptpw.c +++ b/loginutils/cryptpw.c | |||
@@ -14,13 +14,22 @@ | |||
14 | //config: default y | 14 | //config: default y |
15 | //config: help | 15 | //config: help |
16 | //config: Encrypts the given password with the crypt(3) libc function | 16 | //config: Encrypts the given password with the crypt(3) libc function |
17 | //config: using the given salt. | ||
18 | //config: | ||
19 | //config:config MKPASSWD | ||
20 | //config: bool "mkpasswd" | ||
21 | //config: default y | ||
22 | //config: help | ||
23 | //config: Encrypts the given password with the crypt(3) libc function | ||
17 | //config: using the given salt. Debian has this utility under mkpasswd | 24 | //config: using the given salt. Debian has this utility under mkpasswd |
18 | //config: name. Busybox provides mkpasswd as an alias for cryptpw. | 25 | //config: name. Busybox provides mkpasswd as an alias for cryptpw. |
19 | 26 | ||
20 | //applet:IF_CRYPTPW(APPLET(cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP)) | 27 | //applet:IF_CRYPTPW(APPLET(cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP)) |
21 | //applet:IF_CRYPTPW(APPLET_ODDNAME(mkpasswd, cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP, mkpasswd)) | 28 | // APPLET_ODDNAME:name main location suid_type help |
29 | //applet:IF_MKPASSWD(APPLET_ODDNAME(mkpasswd, cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP, cryptpw)) | ||
22 | 30 | ||
23 | //kbuild:lib-$(CONFIG_CRYPTPW) += cryptpw.o | 31 | //kbuild:lib-$(CONFIG_CRYPTPW) += cryptpw.o |
32 | //kbuild:lib-$(CONFIG_MKPASSWD) += cryptpw.o | ||
24 | 33 | ||
25 | //usage:#define cryptpw_trivial_usage | 34 | //usage:#define cryptpw_trivial_usage |
26 | //usage: "[OPTIONS] [PASSWORD] [SALT]" | 35 | //usage: "[OPTIONS] [PASSWORD] [SALT]" |
@@ -40,25 +49,6 @@ | |||
40 | //usage: "\n -S SALT" | 49 | //usage: "\n -S SALT" |
41 | //usage: ) | 50 | //usage: ) |
42 | 51 | ||
43 | /* mkpasswd is an alias to cryptpw */ | ||
44 | //usage:#define mkpasswd_trivial_usage | ||
45 | //usage: "[OPTIONS] [PASSWORD] [SALT]" | ||
46 | /* We do support -s, we just don't mention it */ | ||
47 | //usage:#define mkpasswd_full_usage "\n\n" | ||
48 | //usage: "Crypt PASSWORD using crypt(3)\n" | ||
49 | //usage: IF_LONG_OPTS( | ||
50 | //usage: "\n -P,--password-fd=N Read password from fd N" | ||
51 | /* //usage: "\n -s,--stdin Use stdin; like -P0" */ | ||
52 | //usage: "\n -m,--method=TYPE Encryption method" | ||
53 | //usage: "\n -S,--salt=SALT" | ||
54 | //usage: ) | ||
55 | //usage: IF_NOT_LONG_OPTS( | ||
56 | //usage: "\n -P N Read password from fd N" | ||
57 | /* //usage: "\n -s Use stdin; like -P0" */ | ||
58 | //usage: "\n -m TYPE Encryption method TYPE" | ||
59 | //usage: "\n -S SALT" | ||
60 | //usage: ) | ||
61 | |||
62 | #include "libbb.h" | 52 | #include "libbb.h" |
63 | 53 | ||
64 | /* Debian has 'mkpasswd' utility, manpage says: | 54 | /* Debian has 'mkpasswd' utility, manpage says: |
@@ -140,7 +130,7 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv) | |||
140 | if (!password) { | 130 | if (!password) { |
141 | /* Only mkpasswd, and only from tty, prompts. | 131 | /* Only mkpasswd, and only from tty, prompts. |
142 | * Otherwise it is a plain read. */ | 132 | * Otherwise it is a plain read. */ |
143 | password = (isatty(STDIN_FILENO) && applet_name[0] == 'm') | 133 | password = (ENABLE_MKPASSWD && isatty(STDIN_FILENO) && applet_name[0] == 'm') |
144 | ? bb_ask_stdin("Password: ") | 134 | ? bb_ask_stdin("Password: ") |
145 | : xmalloc_fgetline(stdin) | 135 | : xmalloc_fgetline(stdin) |
146 | ; | 136 | ; |