summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-05-24 11:55:36 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-05-24 11:55:36 +1000
commitb53355eca5dc476aaaf53c49ef145c397c5c2275 (patch)
treef4df6b9988eead502fae73d3b15edc396b92ce19
parent89413dbafa5a5f237ba1040b74e6437b8b1ff1e0 (diff)
- (dtucker) [auth-pam.c] Bug #839: Ensure that pam authentication "thread"
is terminated if the privsep slave exits during keyboard-interactive authentication. ok djm@
-rw-r--r--ChangeLog14
-rw-r--r--auth-pam.c13
2 files changed, 19 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ce0adb09..bc6b40dae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,9 +12,9 @@
12 add prototypes for -Wall; ok djm 12 add prototypes for -Wall; ok djm
13 - djm@cvs.openbsd.org 2004/05/21 11:33:11 13 - djm@cvs.openbsd.org 2004/05/21 11:33:11
14 [channels.c channels.h clientloop.c serverloop.c ssh.1] 14 [channels.c channels.h clientloop.c serverloop.c ssh.1]
15 bz #756: add support for the cancel-tcpip-forward request for the server and 15 bz #756: add support for the cancel-tcpip-forward request for the server
16 the client (through the ~C commandline). reported by z3p AT twistedmatrix.com; 16 and the client (through the ~C commandline). reported by z3p AT
17 ok markus@ 17 twistedmatrix.com; ok markus@
18 - djm@cvs.openbsd.org 2004/05/22 06:32:12 18 - djm@cvs.openbsd.org 2004/05/22 06:32:12
19 [clientloop.c ssh.1] 19 [clientloop.c ssh.1]
20 use '-h' for help in ~C commandline instead of '-?'; inspired by jmc@ 20 use '-h' for help in ~C commandline instead of '-?'; inspired by jmc@
@@ -22,8 +22,12 @@
22 [ssh.1] 22 [ssh.1]
23 kill whitespace at eol; 23 kill whitespace at eol;
24 - dtucker@cvs.openbsd.org 2004/05/23 23:59:53 24 - dtucker@cvs.openbsd.org 2004/05/23 23:59:53
25 [auth.c auth.h auth1.c auth2.c servconf.c servconf.h sshd_config sshd_config.5] 25 [auth.c auth.h auth1.c auth2.c servconf.c servconf.h sshd_config
26 sshd_config.5]
26 Add MaxAuthTries sshd config option; ok markus@ 27 Add MaxAuthTries sshd config option; ok markus@
28 - (dtucker) [auth-pam.c] Bug #839: Ensure that pam authentication "thread"
29 is terminated if the privsep slave exits during keyboard-interactive
30 authentication. ok djm@
27 31
2820040523 3220040523
29 - (djm) [sshd_config] Explain consequences of UsePAM=yes a little better in 33 - (djm) [sshd_config] Explain consequences of UsePAM=yes a little better in
@@ -1153,4 +1157,4 @@
1153 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1157 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1154 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1158 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1155 1159
1156$Id: ChangeLog,v 1.3365 2004/05/24 00:36:23 dtucker Exp $ 1160$Id: ChangeLog,v 1.3366 2004/05/24 01:55:36 dtucker Exp $
diff --git a/auth-pam.c b/auth-pam.c
index faa0b904f..833c850e7 100644
--- a/auth-pam.c
+++ b/auth-pam.c
@@ -31,7 +31,7 @@
31 31
32/* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */ 32/* Based on $FreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */
33#include "includes.h" 33#include "includes.h"
34RCSID("$Id: auth-pam.c,v 1.101 2004/05/13 07:29:35 dtucker Exp $"); 34RCSID("$Id: auth-pam.c,v 1.102 2004/05/24 01:55:36 dtucker Exp $");
35 35
36#ifdef USE_PAM 36#ifdef USE_PAM
37#if defined(HAVE_SECURITY_PAM_APPL_H) 37#if defined(HAVE_SECURITY_PAM_APPL_H)
@@ -93,10 +93,17 @@ static mysig_t sshpam_oldsig;
93static void 93static void
94sshpam_sigchld_handler(int sig) 94sshpam_sigchld_handler(int sig)
95{ 95{
96 signal(SIGCHLD, SIG_DFL);
96 if (cleanup_ctxt == NULL) 97 if (cleanup_ctxt == NULL)
97 return; /* handler called after PAM cleanup, shouldn't happen */ 98 return; /* handler called after PAM cleanup, shouldn't happen */
98 if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, 0) == -1) 99 if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, WNOHANG)
99 return; /* couldn't wait for process */ 100 == -1) {
101 /* PAM thread has not exitted, privsep slave must have */
102 kill(cleanup_ctxt->pam_thread, SIGTERM);
103 if (waitpid(cleanup_ctxt->pam_thread, &sshpam_thread_status, 0)
104 == -1)
105 return; /* could not wait */
106 }
100 if (WIFSIGNALED(sshpam_thread_status) && 107 if (WIFSIGNALED(sshpam_thread_status) &&
101 WTERMSIG(sshpam_thread_status) == SIGTERM) 108 WTERMSIG(sshpam_thread_status) == SIGTERM)
102 return; /* terminated by pthread_cancel */ 109 return; /* terminated by pthread_cancel */