diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-07-11 16:19:17 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-07-11 16:19:17 +0000 |
commit | 6166bb40b91e0fb0f4ae59c572df0dd00858892f (patch) | |
tree | 6afc009d439dc7174f008ccd531f2452e26a833c /loginutils/passwd.c | |
parent | 5c1a4bd0a2cd584faf216be049509dace663f162 (diff) | |
download | busybox-w32-6166bb40b91e0fb0f4ae59c572df0dd00858892f.tar.gz busybox-w32-6166bb40b91e0fb0f4ae59c572df0dd00858892f.tar.bz2 busybox-w32-6166bb40b91e0fb0f4ae59c572df0dd00858892f.zip |
Patch from Tito to remove pwd_to_spwd (which we don't actually need), with
some #ifdef removal from me.
git-svn-id: svn://busybox.net/trunk/busybox@15685 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-rw-r--r-- | loginutils/passwd.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index a1ad02bf0..607e8fd65 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -146,9 +146,6 @@ int passwd_main(int argc, char **argv) | |||
146 | int dflg = 0; /* -d - delete password */ | 146 | int dflg = 0; /* -d - delete password */ |
147 | const struct passwd *pw; | 147 | const struct passwd *pw; |
148 | 148 | ||
149 | #if ENABLE_FEATURE_SHADOWPASSWDS | ||
150 | const struct spwd *sp; | ||
151 | #endif | ||
152 | amroot = (getuid() == 0); | 149 | amroot = (getuid() == 0); |
153 | openlog("passwd", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); | 150 | openlog("passwd", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); |
154 | while ((flag = getopt(argc, argv, "a:dlu")) != EOF) { | 151 | while ((flag = getopt(argc, argv, "a:dlu")) != EOF) { |
@@ -187,18 +184,13 @@ int passwd_main(int argc, char **argv) | |||
187 | syslog(LOG_WARNING, "can't change pwd for `%s'", name); | 184 | syslog(LOG_WARNING, "can't change pwd for `%s'", name); |
188 | bb_error_msg_and_die("Permission denied.\n"); | 185 | bb_error_msg_and_die("Permission denied.\n"); |
189 | } | 186 | } |
190 | #if ENABLE_FEATURE_SHADOWPASSWDS | 187 | if (ENABLE_FEATURE_SHADOWPASSWDS) { |
191 | sp = getspnam(name); | 188 | struct spwd *sp = getspnam(name); |
192 | if (!sp) { | 189 | if (!sp) bb_error_msg_and_die("Unknown user %s", name); |
193 | sp = (struct spwd *) pwd_to_spwd(pw); | 190 | cp = sp->sp_pwdp; |
194 | } | 191 | } else cp = pw->pw_passwd; |
195 | cp = sp->sp_pwdp; | ||
196 | np = sp->sp_namp; | ||
197 | #else | ||
198 | cp = pw->pw_passwd; | ||
199 | np = name; | ||
200 | #endif | ||
201 | 192 | ||
193 | np = name; | ||
202 | safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd)); | 194 | safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd)); |
203 | if (!(dflg || lflg || uflg)) { | 195 | if (!(dflg || lflg || uflg)) { |
204 | if (!amroot) { | 196 | if (!amroot) { |
@@ -243,6 +235,7 @@ int passwd_main(int argc, char **argv) | |||
243 | syslog(LOG_WARNING, "an error occurred updating the password file"); | 235 | syslog(LOG_WARNING, "an error occurred updating the password file"); |
244 | bb_error_msg_and_die("An error occurred updating the password file.\n"); | 236 | bb_error_msg_and_die("An error occurred updating the password file.\n"); |
245 | } | 237 | } |
238 | if (ENABLE_FEATURE_CLEAN_UP) free(myname); | ||
246 | return (0); | 239 | return (0); |
247 | } | 240 | } |
248 | 241 | ||