summaryrefslogtreecommitdiff
path: root/auth2.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-10-28 21:05:57 +1100
committerDamien Miller <djm@mindrot.org>2000-10-28 21:05:57 +1100
commitd425d4da7073ed18e943346d862ca87789daee47 (patch)
tree11093dec360421739ccc3c35d718ea52f49c062f /auth2.c
parent69b69aa50d0effadc8b7e9c564f7a2ee223ac6b5 (diff)
- (djm) authctxt->pw may be NULL. Fix from Markus Friedl
<markus.friedl@informatik.uni-erlangen.de>
Diffstat (limited to 'auth2.c')
-rw-r--r--auth2.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/auth2.c b/auth2.c
index d3c05a7ae..d51a1a765 100644
--- a/auth2.c
+++ b/auth2.c
@@ -193,7 +193,8 @@ input_userauth_request(int type, int plen, void *ctxt)
193 fatal("input_userauth_request: no authctxt"); 193 fatal("input_userauth_request: no authctxt");
194 if (authctxt->attempt++ >= AUTH_FAIL_MAX) { 194 if (authctxt->attempt++ >= AUTH_FAIL_MAX) {
195#ifdef WITH_AIXAUTHENTICATE 195#ifdef WITH_AIXAUTHENTICATE
196 loginfailed(authctxt->pw->pw_name, get_canonical_hostname(), "ssh"); 196 loginfailed(authctxt->user?authctxt->user:"NOUSER",
197 get_canonical_hostname(), "ssh");
197#endif /* WITH_AIXAUTHENTICATE */ 198#endif /* WITH_AIXAUTHENTICATE */
198 packet_disconnect("too many failed userauth_requests"); 199 packet_disconnect("too many failed userauth_requests");
199 } 200 }
@@ -250,7 +251,7 @@ input_userauth_request(int type, int plen, void *ctxt)
250 } 251 }
251 252
252#ifdef USE_PAM 253#ifdef USE_PAM
253 if (authenticated && !do_pam_account(authctxt->pw->pw_name, NULL)) 254 if (authenticated && authctxt->user && !do_pam_account(authctxt->user, NULL))
254 authenticated = 0; 255 authenticated = 0;
255#endif /* USE_PAM */ 256#endif /* USE_PAM */
256 257
@@ -306,8 +307,8 @@ userauth_reply(Authctxt *authctxt, int authenticated)
306 if (authenticated == 1) { 307 if (authenticated == 1) {
307#ifdef WITH_AIXAUTHENTICATE 308#ifdef WITH_AIXAUTHENTICATE
308 /* We don't have a pty yet, so just label the line as "ssh" */ 309 /* We don't have a pty yet, so just label the line as "ssh" */
309 if (loginsuccess(authctxt->pw->pw_name, get_canonical_hostname(), 310 if (loginsuccess(authctxt->user?authctxt->user:"NOUSER",
310 "ssh", &aixloginmsg) < 0) 311 get_canonical_hostname(), "ssh", &aixloginmsg) < 0)
311 aixloginmsg = NULL; 312 aixloginmsg = NULL;
312#endif /* WITH_AIXAUTHENTICATE */ 313#endif /* WITH_AIXAUTHENTICATE */
313 /* turn off userauth */ 314 /* turn off userauth */
@@ -350,8 +351,8 @@ userauth_none(Authctxt *authctxt)
350 return auth_pam_password(authctxt->pw, ""); 351 return auth_pam_password(authctxt->pw, "");
351#elif defined(HAVE_OSF_SIA) 352#elif defined(HAVE_OSF_SIA)
352 return (sia_validate_user(NULL, saved_argc, saved_argv, 353 return (sia_validate_user(NULL, saved_argc, saved_argv,
353 get_canonical_hostname(), authctxt->pw->pw_name, NULL, 354 get_canonical_hostname(), authctxt->user?authctxt->user:"NOUSER",
354 0, NULL, "") == SIASUCCESS); 355 NULL, 0, NULL, "") == SIASUCCESS);
355#else /* !HAVE_OSF_SIA && !USE_PAM */ 356#else /* !HAVE_OSF_SIA && !USE_PAM */
356 return auth_password(authctxt->pw, ""); 357 return auth_password(authctxt->pw, "");
357#endif /* USE_PAM */ 358#endif /* USE_PAM */
@@ -377,8 +378,8 @@ userauth_passwd(Authctxt *authctxt)
377 auth_pam_password(authctxt->pw, password) == 1) 378 auth_pam_password(authctxt->pw, password) == 1)
378#elif defined(HAVE_OSF_SIA) 379#elif defined(HAVE_OSF_SIA)
379 sia_validate_user(NULL, saved_argc, saved_argv, 380 sia_validate_user(NULL, saved_argc, saved_argv,
380 get_canonical_hostname(), authctxt->pw->pw_name, NULL, 0, 381 get_canonical_hostname(), authctxt->user?authctxt->user:"NOUSER",
381 NULL, password) == SIASUCCESS) 382 NULL, 0, NULL, password) == SIASUCCESS)
382#else /* !USE_PAM && !HAVE_OSF_SIA */ 383#else /* !USE_PAM && !HAVE_OSF_SIA */
383 auth_password(authctxt->pw, password) == 1) 384 auth_password(authctxt->pw, password) == 1)
384#endif /* USE_PAM */ 385#endif /* USE_PAM */