Mercurial > dropbear
comparison svr-main.c @ 1733:d529a52b2f7c coverity coverity
merge coverity from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 26 Jun 2020 21:07:34 +0800 |
parents | 6ea18ca8fc03 |
children | 2b3a8026a6ce |
comparison
equal
deleted
inserted
replaced
1643:b59623a64678 | 1733:d529a52b2f7c |
---|---|
78 | 78 |
79 #if INETD_MODE | 79 #if INETD_MODE |
80 static void main_inetd() { | 80 static void main_inetd() { |
81 char *host, *port = NULL; | 81 char *host, *port = NULL; |
82 | 82 |
83 /* Set up handlers, syslog, seed random */ | 83 /* Set up handlers, syslog */ |
84 commonsetup(); | 84 commonsetup(); |
85 | |
86 seedrandom(); | |
85 | 87 |
86 #if DEBUG_TRACE | 88 #if DEBUG_TRACE |
87 if (debug_trace) { | 89 if (debug_trace) { |
88 /* -v output goes to stderr which would get sent over the inetd network socket */ | 90 /* -v output goes to stderr which would get sent over the inetd network socket */ |
89 dropbear_exit("Dropbear inetd mode is incompatible with debug -v"); | 91 dropbear_exit("Dropbear inetd mode is incompatible with debug -v"); |
271 if (pipe(childpipe) < 0) { | 273 if (pipe(childpipe) < 0) { |
272 TRACE(("error creating child pipe")) | 274 TRACE(("error creating child pipe")) |
273 goto out; | 275 goto out; |
274 } | 276 } |
275 | 277 |
276 #ifdef DEBUG_NOFORK | 278 #if DEBUG_NOFORK |
277 fork_ret = 0; | 279 fork_ret = 0; |
278 #else | 280 #else |
279 fork_ret = fork(); | 281 fork_ret = fork(); |
280 #endif | 282 #endif |
281 if (fork_ret < 0) { | 283 if (fork_ret < 0) { |
294 remote_host = NULL; | 296 remote_host = NULL; |
295 | 297 |
296 } else { | 298 } else { |
297 | 299 |
298 /* child */ | 300 /* child */ |
299 #ifdef DEBUG_FORKGPROF | |
300 extern void _start(void), etext(void); | |
301 monstartup((u_long)&_start, (u_long)&etext); | |
302 #endif /* DEBUG_FORKGPROF */ | |
303 | |
304 getaddrstring(&remoteaddr, NULL, &remote_port, 0); | 301 getaddrstring(&remoteaddr, NULL, &remote_port, 0); |
305 dropbear_log(LOG_INFO, "Child connection from %s:%s", remote_host, remote_port); | 302 dropbear_log(LOG_INFO, "Child connection from %s:%s", remote_host, remote_port); |
306 m_free(remote_host); | 303 m_free(remote_host); |
307 m_free(remote_port); | 304 m_free(remote_port); |
308 | 305 |
402 crypto_init(); | 399 crypto_init(); |
403 | 400 |
404 /* Now we can setup the hostkeys - needs to be after logging is on, | 401 /* Now we can setup the hostkeys - needs to be after logging is on, |
405 * otherwise we might end up blatting error messages to the socket */ | 402 * otherwise we might end up blatting error messages to the socket */ |
406 load_all_hostkeys(); | 403 load_all_hostkeys(); |
407 | |
408 seedrandom(); | |
409 } | 404 } |
410 | 405 |
411 /* Set up listening sockets for all the requested ports */ | 406 /* Set up listening sockets for all the requested ports */ |
412 static size_t listensockets(int *socks, size_t sockcount, int *maxfd) { | 407 static size_t listensockets(int *socks, size_t sockcount, int *maxfd) { |
413 | 408 |