Mercurial > dropbear
comparison svr-main.c @ 272:3be7ae2e8dfa
Only read /dev/random once when the program starts
rather than for every connection, to "conserve entropy".
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 11 Feb 2006 15:15:37 +0000 |
parents | 306499676384 |
children | 1f5ec029dfe8 |
comparison
equal
deleted
inserted
replaced
271:be18c7dd486e | 272:3be7ae2e8dfa |
---|---|
81 | 81 |
82 struct sockaddr_storage remoteaddr; | 82 struct sockaddr_storage remoteaddr; |
83 int remoteaddrlen; | 83 int remoteaddrlen; |
84 char * addrstring = NULL; | 84 char * addrstring = NULL; |
85 | 85 |
86 /* Set up handlers, syslog */ | 86 /* Set up handlers, syslog, seed random */ |
87 commonsetup(); | 87 commonsetup(); |
88 | 88 |
89 remoteaddrlen = sizeof(remoteaddr); | 89 remoteaddrlen = sizeof(remoteaddr); |
90 if (getpeername(0, (struct sockaddr*)&remoteaddr, &remoteaddrlen) < 0) { | 90 if (getpeername(0, (struct sockaddr*)&remoteaddr, &remoteaddrlen) < 0) { |
91 dropbear_exit("Unable to getpeername: %s", strerror(errno)); | 91 dropbear_exit("Unable to getpeername: %s", strerror(errno)); |
357 } | 357 } |
358 | 358 |
359 /* Now we can setup the hostkeys - needs to be after logging is on, | 359 /* Now we can setup the hostkeys - needs to be after logging is on, |
360 * otherwise we might end up blatting error messages to the socket */ | 360 * otherwise we might end up blatting error messages to the socket */ |
361 loadhostkeys(); | 361 loadhostkeys(); |
362 | |
363 seedrandom(); | |
362 } | 364 } |
363 | 365 |
364 /* Set up listening sockets for all the requested ports */ | 366 /* Set up listening sockets for all the requested ports */ |
365 static int listensockets(int *sock, int sockcount, int *maxfd) { | 367 static int listensockets(int *sock, int sockcount, int *maxfd) { |
366 | 368 |