]> andersk Git - openssh.git/blobdiff - sshd.c
[configure.ac] Make sure -lcrypto is before -lsocket for sco3. ok mouring@
[openssh.git] / sshd.c
diff --git a/sshd.c b/sshd.c
index 50856317ac29d0c0a7ef2e4ecfde3efb5bb808e6..42484c0648645d60577fb54d50871708c93b244f 100644 (file)
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.283 2003/12/09 17:29:04 markus Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.285 2004/02/05 05:37:17 dtucker Exp $");
 
 #include <openssl/dh.h>
 #include <openssl/bn.h>
@@ -101,6 +101,7 @@ extern char *__progname;
 #else
 char *__progname;
 #endif
+extern char **environ;
 
 /* Server configuration options. */
 ServerOptions options;
@@ -199,7 +200,7 @@ int startup_pipe;           /* in child */
 
 /* variables used for privilege separation */
 int use_privsep;
-struct monitor *pmonitor;
+struct monitor *pmonitor = NULL;
 
 /* message to be displayed after login */
 Buffer loginmsg;
@@ -305,6 +306,9 @@ grace_alarm_handler(int sig)
 {
        /* XXX no idea how fix this signal handler */
 
+       if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0)
+               kill(pmonitor->m_pid, SIGALRM);
+
        /* Log error and exit. */
        fatal("Timeout before authentication for %s", get_remote_ipaddr());
 }
@@ -592,6 +596,7 @@ privsep_preauth(Authctxt *authctxt)
                debug2("Network child is on pid %ld", (long)pid);
 
                close(pmonitor->m_recvfd);
+               pmonitor->m_pid = pid;
                monitor_child_preauth(authctxt, pmonitor);
                close(pmonitor->m_sendfd);
 
@@ -1101,6 +1106,11 @@ main(int ac, char **av)
           unmounted if desired. */
        chdir("/");
 
+#ifndef HAVE_CYGWIN
+       /* Clear environment */
+       environ[0] = NULL;
+#endif
+
        /* ignore SIGPIPE */
        signal(SIGPIPE, SIG_IGN);
 
@@ -1398,8 +1408,8 @@ main(int ac, char **av)
        signal(SIGCHLD, SIG_DFL);
        signal(SIGINT, SIG_DFL);
 
-       /* Set keepalives if requested. */
-       if (options.keepalives &&
+       /* Set SO_KEEPALIVE if requested. */
+       if (options.tcp_keep_alive &&
            setsockopt(sock_in, SOL_SOCKET, SO_KEEPALIVE, &on,
            sizeof(on)) < 0)
                error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno));
This page took 0.036314 seconds and 4 git commands to generate.