summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/passwd.c4
-rw-r--r--loginutils/sulogin.c7
2 files changed, 7 insertions, 4 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index bcb7f2b26..0d910f56a 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -275,7 +275,8 @@ int passwd_main(int argc, char **argv)
275 } 275 }
276 276
277 filename = bb_path_passwd_file; 277 filename = bb_path_passwd_file;
278 if (ENABLE_FEATURE_SHADOWPASSWDS) { 278#if ENABLE_FEATURE_SHADOWPASSWDS
279 {
279 struct spwd *sp = getspnam(name); 280 struct spwd *sp = getspnam(name);
280 if (!sp) { 281 if (!sp) {
281 /* LOGMODE_BOTH */ 282 /* LOGMODE_BOTH */
@@ -287,6 +288,7 @@ int passwd_main(int argc, char **argv)
287 pw->pw_passwd = sp->sp_pwdp; 288 pw->pw_passwd = sp->sp_pwdp;
288 } 289 }
289 } 290 }
291#endif
290 292
291 /* Decide what the new password will be */ 293 /* Decide what the new password will be */
292 newp = NULL; 294 newp = NULL;
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index c07264e7b..8bcb393f5 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -41,7 +41,6 @@ int sulogin_main(int argc, char **argv)
41 char *timeout_arg; 41 char *timeout_arg;
42 const char * const *p; 42 const char * const *p;
43 struct passwd *pwd; 43 struct passwd *pwd;
44 struct spwd *spwd;
45 const char *shell; 44 const char *shell;
46 45
47 logmode = LOGMODE_BOTH; 46 logmode = LOGMODE_BOTH;
@@ -75,13 +74,15 @@ int sulogin_main(int argc, char **argv)
75 goto auth_error; 74 goto auth_error;
76 } 75 }
77 76
78 if (ENABLE_FEATURE_SHADOWPASSWDS) { 77#if ENABLE_FEATURE_SHADOWPASSWDS
79 spwd = getspnam(pwd->pw_name); 78 {
79 struct spwd *spwd = getspnam(pwd->pw_name);
80 if (!spwd) { 80 if (!spwd) {
81 goto auth_error; 81 goto auth_error;
82 } 82 }
83 pwd->pw_passwd = spwd->sp_pwdp; 83 pwd->pw_passwd = spwd->sp_pwdp;
84 } 84 }
85#endif
85 86
86 while (1) { 87 while (1) {
87 /* cp points to a static buffer that is zeroed every time */ 88 /* cp points to a static buffer that is zeroed every time */