summaryrefslogtreecommitdiff
path: root/security/hpn-ssh/files/auth2-pam-freebsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/hpn-ssh/files/auth2-pam-freebsd.c')
-rw-r--r--security/hpn-ssh/files/auth2-pam-freebsd.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/security/hpn-ssh/files/auth2-pam-freebsd.c b/security/hpn-ssh/files/auth2-pam-freebsd.c
index 94ce18480e53..f3f06ad05751 100644
--- a/security/hpn-ssh/files/auth2-pam-freebsd.c
+++ b/security/hpn-ssh/files/auth2-pam-freebsd.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-RCSID("$FreeBSD: /tmp/pcvs/ports/security/hpn-ssh/files/Attic/auth2-pam-freebsd.c,v 1.2 2002-07-07 18:55:26 dinoex Exp $");
+RCSID("$FreeBSD: /tmp/pcvs/ports/security/hpn-ssh/files/Attic/auth2-pam-freebsd.c,v 1.3 2002-07-24 20:47:22 dinoex Exp $");
#ifdef USE_PAM
#include <security/pam_appl.h>
@@ -156,6 +156,17 @@ pam_child(struct pam_ctxt *ctxt)
exit(0);
}
+static void
+pam_cleanup(void *ctxtp)
+{
+ struct pam_ctxt *ctxt = ctxtp;
+ int status;
+
+ close(ctxt->pam_sock);
+ kill(ctxt->pam_pid, SIGHUP);
+ waitpid(ctxt->pam_pid, &status, 0);
+}
+
static void *
pam_init_ctx(Authctxt *authctxt)
{
@@ -192,6 +203,7 @@ pam_init_ctx(Authctxt *authctxt)
}
ctxt->pam_sock = socks[0];
close(socks[1]);
+ fatal_add_cleanup(pam_cleanup, ctxt);
return (ctxt);
}
@@ -297,6 +309,7 @@ pam_free_ctx(void *ctxtp)
struct pam_ctxt *ctxt = ctxtp;
int status;
+ fatal_remove_cleanup(pam_cleanup, ctxt);
close(ctxt->pam_sock);
kill(ctxt->pam_pid, SIGHUP);
waitpid(ctxt->pam_pid, &status, 0);