diff options
author | Matt Johnston <matt@ucc.asn.au> | 2004-08-23 05:27:34 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2004-08-23 05:27:34 +0000 |
commit | aaac206345aad73cb516611b103f8a003d54f445 (patch) | |
tree | f1be04a5b36d076ae3ab624cc17335dea3fd2350 /svr-main.c | |
parent | f3761a3edafd6bc5c830adcd50ae3366c1e7febd (diff) |
Change the way we load keys/ports so we don't print error messages into our
socket.
--HG--
extra : convert_revision : b830e790bd08933685502f36d8e7838f143f2f2f
Diffstat (limited to 'svr-main.c')
-rw-r--r-- | svr-main.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -139,6 +139,10 @@ void main_noinetd() { commonsetup(); + /* Now we can setup the hostkeys - needs to be after logging is on, + * otherwise we might end up blatting error messages to the socket */ + loadhostkeys(); + /* should be done after syslog is working */ if (svr_opts.forkbg) { dropbear_log(LOG_INFO, "Running in background"); @@ -358,21 +362,23 @@ static void commonsetup() { static int listensockets(int *sock, int sockcount, int *maxfd) { unsigned int i; - char portstring[NI_MAXSERV]; char* errstring = NULL; unsigned int sockpos = 0; int nsock; + TRACE(("listensockets: %d to try\n", svr_opts.portcount)); + for (i = 0; i < svr_opts.portcount; i++) { - snprintf(portstring, sizeof(portstring), "%d", svr_opts.ports[i]); - nsock = dropbear_listen(NULL, portstring, &sock[sockpos], + TRACE(("listening on '%s'", svr_opts.ports[i])); + + nsock = dropbear_listen(NULL, svr_opts.ports[i], &sock[sockpos], sockcount - sockpos, &errstring, maxfd); if (nsock < 0) { - dropbear_log(LOG_WARNING, "Failed listening on port %s: %s", - portstring, errstring); + dropbear_log(LOG_WARNING, "Failed listening on '%s': %s", + svr_opts.ports[i], errstring); m_free(errstring); continue; } |