From 9142e1c66d64bcca850b51cc445fe37920266c48 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 16 Aug 2007 23:28:04 +1000 Subject: - (dtucker) [session.c] Call PAM cleanup functions for unauthenticated connections too. Based on a patch from Sandro Wefel, with & ok djm@ --- session.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'session.c') diff --git a/session.c b/session.c index 8c09c17cd..9a606ef8f 100644 --- a/session.c +++ b/session.c @@ -2478,8 +2478,19 @@ do_cleanup(Authctxt *authctxt) return; called = 1; - if (authctxt == NULL || !authctxt->authenticated) + if (authctxt == NULL) return; + +#ifdef USE_PAM + if (options.use_pam) { + sshpam_cleanup(); + sshpam_thread_cleanup(); + } +#endif + + if (!authctxt->authenticated) + return; + #ifdef KRB5 if (options.kerberos_ticket_cleanup && authctxt->krb5_ctx) @@ -2491,13 +2502,6 @@ do_cleanup(Authctxt *authctxt) ssh_gssapi_cleanup_creds(); #endif -#ifdef USE_PAM - if (options.use_pam) { - sshpam_cleanup(); - sshpam_thread_cleanup(); - } -#endif - /* remove agent socket */ auth_sock_cleanup_proc(authctxt->pw); -- cgit v1.2.3