summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-06-25 05:10:20 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-06-25 05:10:20 +0000
commit980978639c3d4d5dcb1dd184861a83b280147460 (patch)
treeed5bd4994fc7cbfff8ae30cbaa525e5336e178e1 /sshd.c
parent2464322d7ee41dcd8beee12903775f7f2a80a164 (diff)
- markus@cvs.openbsd.org 2001/06/23 19:12:43
[sshd.c] pidfile/sigterm race; bbraun@synack.net
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/sshd.c b/sshd.c
index 431f4e2ac..936e861a9 100644
--- a/sshd.c
+++ b/sshd.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: sshd.c,v 1.200 2001/06/23 15:12:21 itojun Exp $"); 43RCSID("$OpenBSD: sshd.c,v 1.201 2001/06/23 19:12:43 markus Exp $");
44 44
45#include <openssl/dh.h> 45#include <openssl/dh.h>
46#include <openssl/bn.h> 46#include <openssl/bn.h>
@@ -876,6 +876,22 @@ main(int ac, char **av)
876 if (!num_listen_socks) 876 if (!num_listen_socks)
877 fatal("Cannot bind any address."); 877 fatal("Cannot bind any address.");
878 878
879 if (options.protocol & SSH_PROTO_1)
880 generate_ephemeral_server_key();
881
882 /*
883 * Arrange to restart on SIGHUP. The handler needs
884 * listen_sock.
885 */
886 signal(SIGHUP, sighup_handler);
887
888 signal(SIGTERM, sigterm_handler);
889 signal(SIGQUIT, sigterm_handler);
890
891 /* Arrange SIGCHLD to be caught. */
892 signal(SIGCHLD, main_sigchld_handler);
893
894 /* Write out the pid file after the sigterm handler is setup */
879 if (!debug_flag) { 895 if (!debug_flag) {
880 /* 896 /*
881 * Record our pid in /var/run/sshd.pid to make it 897 * Record our pid in /var/run/sshd.pid to make it
@@ -890,17 +906,6 @@ main(int ac, char **av)
890 fclose(f); 906 fclose(f);
891 } 907 }
892 } 908 }
893 if (options.protocol & SSH_PROTO_1)
894 generate_ephemeral_server_key();
895
896 /* Arrange to restart on SIGHUP. The handler needs listen_sock. */
897 signal(SIGHUP, sighup_handler);
898
899 signal(SIGTERM, sigterm_handler);
900 signal(SIGQUIT, sigterm_handler);
901
902 /* Arrange SIGCHLD to be caught. */
903 signal(SIGCHLD, main_sigchld_handler);
904 909
905 /* setup fd set for listen */ 910 /* setup fd set for listen */
906 fdset = NULL; 911 fdset = NULL;