diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-30 16:41:15 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-30 16:41:15 +0000 |
commit | ab24e18c7a32ee1637be19f239e9dd9d7c7f6534 (patch) | |
tree | 2646cfd66b5a8d279ad360aaa989a814eeecfd64 /libbb/obscure.c | |
parent | b8bb27c7ea37c9885b1ded36d0f7807a09ede712 (diff) | |
download | busybox-w32-ab24e18c7a32ee1637be19f239e9dd9d7c7f6534.tar.gz busybox-w32-ab24e18c7a32ee1637be19f239e9dd9d7c7f6534.tar.bz2 busybox-w32-ab24e18c7a32ee1637be19f239e9dd9d7c7f6534.zip |
passwd: rework:
* do not make backup copy by copying (just retain old file)
* correctly fall back to /etc/passwd if user is not in shadow
* fix bug with overlong passwd entries
* be permissive on some kinds of failures
* reduce stack usage
* code size: -500 bytes
Diffstat (limited to 'libbb/obscure.c')
-rw-r--r-- | libbb/obscure.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libbb/obscure.c b/libbb/obscure.c index 7d839d624..2599095df 100644 --- a/libbb/obscure.c +++ b/libbb/obscure.c | |||
@@ -157,14 +157,14 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc | |||
157 | return NULL; | 157 | return NULL; |
158 | } | 158 | } |
159 | 159 | ||
160 | int obscure(const char *old, const char *newval, const struct passwd *pwdp) | 160 | int obscure(const char *old, const char *newval, const struct passwd *pw) |
161 | { | 161 | { |
162 | const char *msg; | 162 | const char *msg; |
163 | 163 | ||
164 | if ((msg = obscure_msg(old, newval, pwdp))) { | 164 | msg = obscure_msg(old, newval, pw); |
165 | printf("Bad password: %s.\n", msg); | 165 | if (msg) { |
166 | /* If user is root warn only */ | 166 | printf("Bad password: %s\n", msg); |
167 | return getuid() ? 1 : 0; | 167 | return 1; |
168 | } | 168 | } |
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |