diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-03 10:28:46 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-03 10:28:46 +0000 |
commit | 54e19da86d5496ec5f5787b85a2b6342be1d63d4 (patch) | |
tree | b9bff1f9333b0c37302828ceecc07dd3780545db | |
parent | a48369183b0bfd9692737477ab3a4092f5114031 (diff) | |
download | busybox-w32-54e19da86d5496ec5f5787b85a2b6342be1d63d4.tar.gz busybox-w32-54e19da86d5496ec5f5787b85a2b6342be1d63d4.tar.bz2 busybox-w32-54e19da86d5496ec5f5787b85a2b6342be1d63d4.zip |
correct_password: if password is 'x' or '*' and there is no shadow, use
fake encrypted password 'aa' (which is guaranteed to fail password check).
-rw-r--r-- | libbb/correct_password.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libbb/correct_password.c b/libbb/correct_password.c index 815c51c43..f1793cd17 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c | |||
@@ -54,13 +54,11 @@ int correct_password(const struct passwd *pw) | |||
54 | struct spwd spw; | 54 | struct spwd spw; |
55 | struct spwd *result; | 55 | struct spwd *result; |
56 | char buffer[256]; | 56 | char buffer[256]; |
57 | if (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result) == 0) | 57 | correct = (getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result)) ? "aa" : spw.sp_pwdp; |
58 | correct = spw.sp_pwdp; | ||
59 | /* else: no valid shadow password, checking ordinary one */ | ||
60 | } | 58 | } |
61 | #endif | 59 | #endif |
62 | 60 | ||
63 | if (!correct || correct[0] == '\0') | 61 | if (!correct[0]) /* empty password field? */ |
64 | return 1; | 62 | return 1; |
65 | 63 | ||
66 | fake_it: | 64 | fake_it: |