diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sshd.c | 24 |
2 files changed, 21 insertions, 8 deletions
@@ -9,6 +9,9 @@ | |||
9 | - stevesk@cvs.openbsd.org 2001/11/17 19:14:34 | 9 | - stevesk@cvs.openbsd.org 2001/11/17 19:14:34 |
10 | [auth2.c auth.c readconf.c servconf.c ssh-agent.c ssh-keygen.c] | 10 | [auth2.c auth.c readconf.c servconf.c ssh-agent.c ssh-keygen.c] |
11 | enum/int type cleanup where it made sense to do so; ok markus@ | 11 | enum/int type cleanup where it made sense to do so; ok markus@ |
12 | - markus@cvs.openbsd.org 2001/11/19 11:20:21 | ||
13 | [sshd.c] | ||
14 | fd leak on HUP; ok stevesk@ | ||
12 | 15 | ||
13 | 20011126 | 16 | 20011126 |
14 | - (tim) [contrib/cygwin/README, openbsd-compat/bsd-cygwin_util.c, | 17 | - (tim) [contrib/cygwin/README, openbsd-compat/bsd-cygwin_util.c, |
@@ -6931,4 +6934,4 @@ | |||
6931 | - Wrote replacements for strlcpy and mkdtemp | 6934 | - Wrote replacements for strlcpy and mkdtemp |
6932 | - Released 1.0pre1 | 6935 | - Released 1.0pre1 |
6933 | 6936 | ||
6934 | $Id: ChangeLog,v 1.1669 2001/12/06 16:32:47 mouring Exp $ | 6937 | $Id: ChangeLog,v 1.1670 2001/12/06 16:35:40 mouring Exp $ |
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: sshd.c,v 1.210 2001/11/14 20:45:08 deraadt Exp $"); | 43 | RCSID("$OpenBSD: sshd.c,v 1.211 2001/11/19 11:20: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> |
@@ -185,6 +185,10 @@ int session_id2_len = 0; | |||
185 | /* record remote hostname or ip */ | 185 | /* record remote hostname or ip */ |
186 | u_int utmp_len = MAXHOSTNAMELEN; | 186 | u_int utmp_len = MAXHOSTNAMELEN; |
187 | 187 | ||
188 | /* options.max_startup sized array of fd ints */ | ||
189 | int *startup_pipes = NULL; | ||
190 | int startup_pipe; /* in child */ | ||
191 | |||
188 | /* Prototypes for various functions defined later in this file. */ | 192 | /* Prototypes for various functions defined later in this file. */ |
189 | void destroy_sensitive_data(void); | 193 | void destroy_sensitive_data(void); |
190 | 194 | ||
@@ -203,6 +207,16 @@ close_listen_socks(void) | |||
203 | num_listen_socks = -1; | 207 | num_listen_socks = -1; |
204 | } | 208 | } |
205 | 209 | ||
210 | static void | ||
211 | close_startup_pipes(void) | ||
212 | { | ||
213 | int i; | ||
214 | if (startup_pipes) | ||
215 | for (i = 0; i < options.max_startups; i++) | ||
216 | if (startup_pipes[i] != -1) | ||
217 | close(startup_pipes[i]); | ||
218 | } | ||
219 | |||
206 | /* | 220 | /* |
207 | * Signal handler for SIGHUP. Sshd execs itself when it receives SIGHUP; | 221 | * Signal handler for SIGHUP. Sshd execs itself when it receives SIGHUP; |
208 | * the effect is to reread the configuration file (and to regenerate | 222 | * the effect is to reread the configuration file (and to regenerate |
@@ -227,6 +241,7 @@ sighup_restart(void) | |||
227 | { | 241 | { |
228 | log("Received SIGHUP; restarting."); | 242 | log("Received SIGHUP; restarting."); |
229 | close_listen_socks(); | 243 | close_listen_socks(); |
244 | close_startup_pipes(); | ||
230 | execv(saved_argv[0], saved_argv); | 245 | execv(saved_argv[0], saved_argv); |
231 | log("RESTART FAILED: av[0]='%.100s', error: %.100s.", saved_argv[0], strerror(errno)); | 246 | log("RESTART FAILED: av[0]='%.100s', error: %.100s.", saved_argv[0], strerror(errno)); |
232 | exit(1); | 247 | exit(1); |
@@ -528,9 +543,6 @@ drop_connection(int startups) | |||
528 | return (r < p) ? 1 : 0; | 543 | return (r < p) ? 1 : 0; |
529 | } | 544 | } |
530 | 545 | ||
531 | int *startup_pipes = NULL; /* options.max_startup sized array of fd ints */ | ||
532 | int startup_pipe; /* in child */ | ||
533 | |||
534 | /* | 546 | /* |
535 | * Main program for the daemon. | 547 | * Main program for the daemon. |
536 | */ | 548 | */ |
@@ -1058,9 +1070,7 @@ main(int ac, char **av) | |||
1058 | * the connection. | 1070 | * the connection. |
1059 | */ | 1071 | */ |
1060 | startup_pipe = startup_p[1]; | 1072 | startup_pipe = startup_p[1]; |
1061 | for (j = 0; j < options.max_startups; j++) | 1073 | close_startup_pipes(); |
1062 | if (startup_pipes[j] != -1) | ||
1063 | close(startup_pipes[j]); | ||
1064 | close_listen_socks(); | 1074 | close_listen_socks(); |
1065 | sock_in = newsock; | 1075 | sock_in = newsock; |
1066 | sock_out = newsock; | 1076 | sock_out = newsock; |