diff options
author | Bernhard Reutner-Fischer | 2007-06-09 09:07:17 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer | 2007-06-09 09:07:17 +0000 |
commit | d08b43f8a572613815b30bf39a44e8ee580150aa (patch) | |
tree | b8d52412ad84d91671de025880e621ed212db4a0 /libbb | |
parent | 37e977b80e12d1adf9d2feac996839fce999ccf0 (diff) | |
download | busybox-d08b43f8a572613815b30bf39a44e8ee580150aa.zip busybox-d08b43f8a572613815b30bf39a44e8ee580150aa.tar.gz |
- pull fix for bug#1383 from trunk (r18782)
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/correct_password.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libbb/correct_password.c b/libbb/correct_password.c index c515b26..af6ff07 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c @@ -31,9 +31,10 @@ #include "libbb.h" /* Ask the user for a password. - Return 1 if the user gives the correct password for entry PW, - 0 if not. Return 1 without asking for a password if run by UID 0 - or if PW has an empty password. */ + * Return 1 if the user gives the correct password for entry PW, + * 0 if not. Return 1 without asking if PW has an empty password. + * + * NULL pw means "just fake it for login with bad username" */ int correct_password(const struct passwd *pw) { @@ -46,6 +47,9 @@ int correct_password(const struct passwd *pw) char buffer[256]; #endif + correct = "aa"; /* fake salt. crypt() can choke otherwise */ + if (!pw) + goto fake_it; /* "aa" will never match */ correct = pw->pw_passwd; #if ENABLE_FEATURE_SHADOWPASSWDS if (LONE_CHAR(pw->pw_passwd, 'x') || LONE_CHAR(pw->pw_passwd, '*')) { @@ -59,6 +63,7 @@ int correct_password(const struct passwd *pw) if (!correct || correct[0] == '\0') return 1; + fake_it: unencrypted = bb_askpass(0, "Password: "); if (!unencrypted) { return 0; |