diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-12-03 18:48:39 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-12-03 18:48:39 +0000 |
commit | 82b142996625d6bf20ee667ce602496cb270fccc (patch) | |
tree | df4be1e1502cdbe3f49bf46c7bd00db764add571 /libbb | |
parent | 81c3a1d0b2be02c1d675e6dceb500ce6b3da3282 (diff) | |
download | busybox-w32-82b142996625d6bf20ee667ce602496cb270fccc.tar.gz busybox-w32-82b142996625d6bf20ee667ce602496cb270fccc.tar.bz2 busybox-w32-82b142996625d6bf20ee667ce602496cb270fccc.zip |
- 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 'libbb')
-rw-r--r-- | libbb/bb_askpass.c | 12 | ||||
-rw-r--r-- | libbb/correct_password.c | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c index c97649733..c0dcf0c5f 100644 --- a/libbb/bb_askpass.c +++ b/libbb/bb_askpass.c | |||
@@ -15,7 +15,11 @@ static void askpass_timeout(int UNUSED_PARAM ignore) | |||
15 | { | 15 | { |
16 | } | 16 | } |
17 | 17 | ||
18 | char* FAST_FUNC bb_askpass(int timeout, const char *prompt) | 18 | char* FAST_FUNC bb_ask_stdin(const char *prompt) |
19 | { | ||
20 | return bb_ask(STDIN_FILENO, 0, prompt); | ||
21 | } | ||
22 | char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt) | ||
19 | { | 23 | { |
20 | /* Was static char[BIGNUM] */ | 24 | /* Was static char[BIGNUM] */ |
21 | enum { sizeof_passwd = 128 }; | 25 | enum { sizeof_passwd = 128 }; |
@@ -30,8 +34,8 @@ char* FAST_FUNC bb_askpass(int timeout, const char *prompt) | |||
30 | passwd = xmalloc(sizeof_passwd); | 34 | passwd = xmalloc(sizeof_passwd); |
31 | memset(passwd, 0, sizeof_passwd); | 35 | memset(passwd, 0, sizeof_passwd); |
32 | 36 | ||
33 | tcgetattr(STDIN_FILENO, &oldtio); | 37 | tcgetattr(fd, &oldtio); |
34 | tcflush(STDIN_FILENO, TCIFLUSH); | 38 | tcflush(fd, TCIFLUSH); |
35 | tio = oldtio; | 39 | tio = oldtio; |
36 | tio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); | 40 | tio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); |
37 | tio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP); | 41 | tio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP); |
@@ -52,7 +56,7 @@ char* FAST_FUNC bb_askpass(int timeout, const char *prompt) | |||
52 | ret = NULL; | 56 | ret = NULL; |
53 | /* On timeout or Ctrl-C, read will hopefully be interrupted, | 57 | /* On timeout or Ctrl-C, read will hopefully be interrupted, |
54 | * and we return NULL */ | 58 | * and we return NULL */ |
55 | if (read(STDIN_FILENO, passwd, sizeof_passwd - 1) > 0) { | 59 | if (read(fd, passwd, sizeof_passwd - 1) > 0) { |
56 | ret = passwd; | 60 | ret = passwd; |
57 | i = 0; | 61 | i = 0; |
58 | /* Last byte is guaranteed to be 0 | 62 | /* Last byte is guaranteed to be 0 |
diff --git a/libbb/correct_password.c b/libbb/correct_password.c index 255b04870..6301589e6 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c | |||
@@ -68,7 +68,7 @@ int FAST_FUNC correct_password(const struct passwd *pw) | |||
68 | return 1; | 68 | return 1; |
69 | 69 | ||
70 | fake_it: | 70 | fake_it: |
71 | unencrypted = bb_askpass(0, "Password: "); | 71 | unencrypted = bb_ask_stdin("Password: "); |
72 | if (!unencrypted) { | 72 | if (!unencrypted) { |
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |