summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-07-23 21:01:56 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-07-23 21:01:56 +0000
commit264ee307a8fd171dbb44121ec05b83f4143408cf (patch)
tree879766e789662f58ab0b8b7482126f743072e6c2 /sshd.c
parent6f52b3e39958dde417eacd9ca8fb513a3ea5b769 (diff)
- markus@cvs.openbsd.org 2002/07/19 15:43:33
[log.c log.h session.c sshd.c] remove fatal cleanups after fork; based on discussions with and code from solar.
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sshd.c b/sshd.c
index 8f9d3c39..427ca354 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.255 2002/06/30 21:59:45 deraadt Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.256 2002/07/19 15:43:33 markus Exp $");
#include <openssl/dh.h>
#include <openssl/bn.h>
@@ -303,9 +303,6 @@ grace_alarm_handler(int sig)
{
/* XXX no idea how fix this signal handler */
- /* Close the connection. */
- packet_close();
-
/* Log error and exit. */
fatal("Timeout before authentication for %s.", get_remote_ipaddr());
}
@@ -589,6 +586,8 @@ privsep_preauth(void)
if (pid == -1) {
fatal("fork of unprivileged child failed");
} else if (pid != 0) {
+ fatal_remove_cleanup((void (*) (void *)) packet_close, NULL);
+
debug2("Network child is on pid %ld", (long)pid);
close(pmonitor->m_recvfd);
@@ -602,6 +601,10 @@ privsep_preauth(void)
while (waitpid(pid, &status, 0) < 0)
if (errno != EINTR)
break;
+
+ /* Reinstall, since the child has finished */
+ fatal_add_cleanup((void (*) (void *)) packet_close, NULL);
+
return (authctxt);
} else {
/* child */
@@ -649,6 +652,8 @@ privsep_postauth(Authctxt *authctxt)
if (pmonitor->m_pid == -1)
fatal("fork of unprivileged child failed");
else if (pmonitor->m_pid != 0) {
+ fatal_remove_cleanup((void (*) (void *)) packet_close, NULL);
+
debug2("User child is on pid %ld", (long)pmonitor->m_pid);
close(pmonitor->m_recvfd);
monitor_child_postauth(pmonitor);