- Fix PAM account and session being called multiple times. Problem

reported by Adrian Baugh <adrian@merlin.keble.ox.ac.uk>
This commit is contained in:
Damien Miller 1999-12-07 14:56:27 +11:00
parent 3bc14dde05
commit eabf3417bc
2 changed files with 33 additions and 14 deletions

View File

@ -2,6 +2,8 @@
- sshd Redhat init script patch from Jim Knoble <jmknoble@pobox.com> - sshd Redhat init script patch from Jim Knoble <jmknoble@pobox.com>
fixes compatability with 4.x and 5.x fixes compatability with 4.x and 5.x
- Fixed default SSH_ASKPASS - Fixed default SSH_ASKPASS
- Fix PAM account and session being called multiple times. Problem
reported by Adrian Baugh <adrian@merlin.keble.ox.ac.uk>
19991204 19991204
- Small cleanup of PAM code in sshd.c - Small cleanup of PAM code in sshd.c

27
sshd.c
View File

@ -11,7 +11,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$Id: sshd.c,v 1.33 1999/12/04 09:24:48 damien Exp $"); RCSID("$Id: sshd.c,v 1.34 1999/12/07 03:56:27 damien Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "rsa.h" #include "rsa.h"
@ -1551,7 +1551,14 @@ do_authloop(struct passwd * pw)
get_remote_port(), get_remote_port(),
user); user);
#ifdef HAVE_LIBPAM #ifndef HAVE_LIBPAM
if (authenticated)
return;
if (attempt > AUTH_FAIL_MAX)
packet_disconnect(AUTH_FAIL_MSG, pw->pw_name);
#else /* HAVE_LIBPAM */
if (authenticated) {
do_pam_account_and_session(pw->pw_name, client_user); do_pam_account_and_session(pw->pw_name, client_user);
/* Clean up */ /* Clean up */
@ -1562,13 +1569,23 @@ do_authloop(struct passwd * pw)
memset(password, 0, strlen(password)); memset(password, 0, strlen(password));
xfree(password); xfree(password);
} }
#endif /* HAVE_LIBPAM */
if (authenticated)
return; return;
}
if (attempt > AUTH_FAIL_MAX) {
/* Clean up */
if (client_user != NULL)
xfree(client_user);
if (password != NULL) {
memset(password, 0, strlen(password));
xfree(password);
}
if (attempt > AUTH_FAIL_MAX)
packet_disconnect(AUTH_FAIL_MSG, pw->pw_name); packet_disconnect(AUTH_FAIL_MSG, pw->pw_name);
}
#endif /* HAVE_LIBPAM */
/* Send a message indicating that the authentication attempt failed. */ /* Send a message indicating that the authentication attempt failed. */
packet_start(SSH_SMSG_FAILURE); packet_start(SSH_SMSG_FAILURE);