diff options
Diffstat (limited to 'auth-passwd.c')
-rw-r--r-- | auth-passwd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/auth-passwd.c b/auth-passwd.c index 9901d4842..62ea3a52d 100644 --- a/auth-passwd.c +++ b/auth-passwd.c | |||
@@ -93,6 +93,7 @@ int | |||
93 | auth_password(Authctxt *authctxt, const char *password) | 93 | auth_password(Authctxt *authctxt, const char *password) |
94 | { | 94 | { |
95 | struct passwd * pw = authctxt->pw; | 95 | struct passwd * pw = authctxt->pw; |
96 | int ok = authctxt->valid; | ||
96 | #if !defined(USE_PAM) && !defined(HAVE_OSF_SIA) | 97 | #if !defined(USE_PAM) && !defined(HAVE_OSF_SIA) |
97 | char *encrypted_password; | 98 | char *encrypted_password; |
98 | char *pw_password; | 99 | char *pw_password; |
@@ -115,19 +116,23 @@ auth_password(Authctxt *authctxt, const char *password) | |||
115 | 116 | ||
116 | /* deny if no user. */ | 117 | /* deny if no user. */ |
117 | if (pw == NULL) | 118 | if (pw == NULL) |
118 | return 0; | 119 | ok = 0; |
119 | #ifndef HAVE_CYGWIN | 120 | #ifndef HAVE_CYGWIN |
120 | if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES) | 121 | if (pw && pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES) |
121 | return 0; | 122 | ok = 0; |
122 | #endif | 123 | #endif |
123 | if (*password == '\0' && options.permit_empty_passwd == 0) | 124 | if (*password == '\0' && options.permit_empty_passwd == 0) |
124 | return 0; | 125 | ok = 0; |
125 | 126 | ||
126 | #if defined(USE_PAM) | 127 | #if defined(USE_PAM) |
127 | return auth_pam_password(authctxt, password); | 128 | return auth_pam_password(authctxt, password) && ok; |
128 | #elif defined(HAVE_OSF_SIA) | 129 | #elif defined(HAVE_OSF_SIA) |
130 | if (!ok) | ||
131 | return 0; | ||
129 | return auth_sia_password(authctxt, password); | 132 | return auth_sia_password(authctxt, password); |
130 | #else | 133 | #else |
134 | if (!ok) | ||
135 | return 0; | ||
131 | # ifdef KRB5 | 136 | # ifdef KRB5 |
132 | if (options.kerberos_authentication == 1) { | 137 | if (options.kerberos_authentication == 1) { |
133 | int ret = auth_krb5_password(authctxt, password); | 138 | int ret = auth_krb5_password(authctxt, password); |