aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-12-03 18:48:39 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-12-03 18:48:39 +0000
commit82b142996625d6bf20ee667ce602496cb270fccc (patch)
treedf4be1e1502cdbe3f49bf46c7bd00db764add571 /include
parent81c3a1d0b2be02c1d675e6dceb500ce6b3da3282 (diff)
downloadbusybox-82b142996625d6bf20ee667ce602496cb270fccc.tar.gz
- add new applet mkpasswd(1)
function old new delta bb_ask - 355 +355 mkpasswd_main - 296 +296 .rodata 121746 121847 +101 packed_usage 24632 24689 +57 static.methods - 21 +21 gmatch 229 248 +19 bb_ask_stdin - 11 +11 applet_names 1949 1958 +9 applet_main 1172 1176 +4 sulogin_main 503 505 +2 applet_nameofs 586 588 +2 sha256_hash 329 327 -2 correct_password 208 206 -2 parse_command 1442 1439 -3 get_cred_or_die 145 141 -4 passwd_main 1054 1044 -10 bb_askpass 348 - -348 ------------------------------------------------------------------------------ (add/remove: 4/1 grow/shrink: 7/5 up/down: 877/-369) Total: 508 bytes
Diffstat (limited to 'include')
-rw-r--r--include/applets.h1
-rw-r--r--include/libbb.h5
-rw-r--r--include/usage.h15
3 files changed, 19 insertions, 2 deletions
diff --git a/include/applets.h b/include/applets.h
index ad3925577..9c844eeae 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -252,6 +252,7 @@ USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
//USE_MKE2FS(APPLET_ODDNAME(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_ext3))
USE_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix))
USE_MKNOD(APPLET(mknod, _BB_DIR_BIN, _BB_SUID_NEVER))
+USE_MKPASSWD(APPLET(mkpasswd, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_MKSWAP(APPLET(mkswap, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MKTEMP(APPLET(mktemp, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_MODPROBE(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER))
diff --git a/include/libbb.h b/include/libbb.h
index acae93a56..a34e8a1f9 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1021,9 +1021,10 @@ extern int del_loop(const char *device) FAST_FUNC;
* return value: 1: read-only loopdev was setup, 0: rw, < 0: error */
extern int set_loop(char **devname, const char *file, unsigned long long offset) FAST_FUNC;
-
+/* Like bb_ask below, but asks on stdin with no timeout. */
+char *bb_ask_stdin(const char * prompt) FAST_FUNC;
//TODO: pass buf pointer or return allocated buf (avoid statics)?
-char *bb_askpass(int timeout, const char * prompt) FAST_FUNC;
+char *bb_ask(const int fd, int timeout, const char * prompt) FAST_FUNC;
int bb_ask_confirmation(void) FAST_FUNC;
int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC;
diff --git a/include/usage.h b/include/usage.h
index 000b864d6..a174222be 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -2618,6 +2618,21 @@
"$ mknod /dev/fd0 b 2 0\n" \
"$ mknod -m 644 /tmp/pipe p\n"
+#define mkpasswd_trivial_usage \
+ "[OPTIONS] [PASSWORD]"
+#define mkpasswd_full_usage "\n\n" \
+ "Crypts the PASSWORD using crypt(3)\n" \
+ "\nOptions:" \
+ "\n\t-P"USE_GETOPT_LONG(", --password-fd=")"NUM\tread password from fd NUM" \
+ "\n\t-s"USE_GETOPT_LONG(", --stdin")"\t\tuse stdin; like -P0" \
+ "\n\t-m"USE_GETOPT_LONG(", --method=")"TYPE\tEncryption method TYPE" \
+ "\n\t-S"USE_GETOPT_LONG(", --salt=")"SALT\t\tuse SALT" \
+ //"\n\t-l"USE_GETOPT_LONG(", --length=")"LEN\tRandom password with length LEN"
+
+#define mkpasswd_example_usage \
+ "$ mkpasswd -m md5\n" \
+ "$ mkpasswd -l 12\n"
+
#define mkswap_trivial_usage \
"DEVICE"
#define mkswap_full_usage "\n\n" \