1303 files changed, 32187 insertions, 57138 deletions
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c index 29f0fbe..9f5f406 100644 --- a/loginutils/cryptpw.c +++ b/loginutils/cryptpw.c @@ -9,6 +9,27 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config CRYPTPW +//config: bool "cryptpw" +//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_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]" @@ -28,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: @@ -109,8 +111,8 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv) opt_m = CONFIG_FEATURE_DEFAULT_PASSWD_ALGO; opt_S = NULL; /* at most two non-option arguments; -P NUM */ - opt_complementary = "?2:P+"; - getopt32(argv, "sP:S:m:a:", &fd, &opt_S, &opt_m, &opt_m); + opt_complementary = "?2"; + getopt32(argv, "sP:+S:m:a:", &fd, &opt_S, &opt_m, &opt_m); argv += optind; /* have no idea how to handle -s... */ @@ -128,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) ; |