diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: sshd.c,v 1.198 2001/05/28 23:58:35 markus Exp $"); | 43 | RCSID("$OpenBSD: sshd.c,v 1.199 2001/06/04 23:07:21 markus Exp $"); |
44 | 44 | ||
45 | #include <openssl/dh.h> | 45 | #include <openssl/dh.h> |
46 | #include <openssl/bn.h> | 46 | #include <openssl/bn.h> |
@@ -167,8 +167,9 @@ struct { | |||
167 | */ | 167 | */ |
168 | int key_do_regen = 0; | 168 | int key_do_regen = 0; |
169 | 169 | ||
170 | /* This is set to true when SIGHUP is received. */ | 170 | /* This is set to true when a signal is received. */ |
171 | int received_sighup = 0; | 171 | int received_sighup = 0; |
172 | int received_sigterm = 0; | ||
172 | 173 | ||
173 | /* session identifier, used by RSA-auth */ | 174 | /* session identifier, used by RSA-auth */ |
174 | u_char session_id[16]; | 175 | u_char session_id[16]; |
@@ -227,21 +228,16 @@ sighup_restart(void) | |||
227 | 228 | ||
228 | /* | 229 | /* |
229 | * Generic signal handler for terminating signals in the master daemon. | 230 | * Generic signal handler for terminating signals in the master daemon. |
230 | * These close the listen socket; not closing it seems to cause "Address | ||
231 | * already in use" problems on some machines, which is inconvenient. | ||
232 | */ | 231 | */ |
233 | void | 232 | void |
234 | sigterm_handler(int sig) | 233 | sigterm_handler(int sig) |
235 | { | 234 | { |
236 | log("Received signal %d; terminating.", sig); | 235 | received_sigterm = sig; |
237 | close_listen_socks(); | ||
238 | unlink(options.pid_file); | ||
239 | exit(255); | ||
240 | } | 236 | } |
241 | 237 | ||
242 | /* | 238 | /* |
243 | * SIGCHLD handler. This is called whenever a child dies. This will then | 239 | * SIGCHLD handler. This is called whenever a child dies. This will then |
244 | * reap any zombies left by exited c. | 240 | * reap any zombies left by exited children. |
245 | */ | 241 | */ |
246 | void | 242 | void |
247 | main_sigchld_handler(int sig) | 243 | main_sigchld_handler(int sig) |
@@ -262,6 +258,8 @@ main_sigchld_handler(int sig) | |||
262 | void | 258 | void |
263 | grace_alarm_handler(int sig) | 259 | grace_alarm_handler(int sig) |
264 | { | 260 | { |
261 | /* XXX no idea how fix this signal handler */ | ||
262 | |||
265 | /* Close the connection. */ | 263 | /* Close the connection. */ |
266 | packet_close(); | 264 | packet_close(); |
267 | 265 | ||
@@ -939,6 +937,13 @@ main(int ac, char **av) | |||
939 | ret = select(maxfd+1, fdset, NULL, NULL, NULL); | 937 | ret = select(maxfd+1, fdset, NULL, NULL, NULL); |
940 | if (ret < 0 && errno != EINTR) | 938 | if (ret < 0 && errno != EINTR) |
941 | error("select: %.100s", strerror(errno)); | 939 | error("select: %.100s", strerror(errno)); |
940 | if (received_sigterm) { | ||
941 | log("Received signal %d; terminating.", | ||
942 | received_sigterm); | ||
943 | close_listen_socks(); | ||
944 | unlink(options.pid_file); | ||
945 | exit(255); | ||
946 | } | ||
942 | if (key_used && key_do_regen) { | 947 | if (key_used && key_do_regen) { |
943 | generate_ephemeral_server_key(); | 948 | generate_ephemeral_server_key(); |
944 | key_used = 0; | 949 | key_used = 0; |