Mercurial > dropbear
comparison svr-chansession.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 | 541b14504870 |
children | 8438ff0cdb74 |
comparison
equal
deleted
inserted
replaced
271:be18c7dd486e | 272:3be7ae2e8dfa |
---|---|
831 /* wipe the hostkey */ | 831 /* wipe the hostkey */ |
832 sign_key_free(svr_opts.hostkey); | 832 sign_key_free(svr_opts.hostkey); |
833 svr_opts.hostkey = NULL; | 833 svr_opts.hostkey = NULL; |
834 | 834 |
835 /* overwrite the prng state */ | 835 /* overwrite the prng state */ |
836 seedrandom(); | 836 reseedrandom(); |
837 | 837 |
838 /* close file descriptors except stdin/stdout/stderr | 838 /* close file descriptors except stdin/stdout/stderr |
839 * Need to be sure FDs are closed here to avoid reading files as root */ | 839 * Need to be sure FDs are closed here to avoid reading files as root */ |
840 for (i = 3; i <= (unsigned int)ses.maxfd; i++) { | 840 for (i = 3; i <= (unsigned int)ses.maxfd; i++) { |
841 if (m_close(i) == DROPBEAR_FAILURE) { | 841 if (m_close(i) == DROPBEAR_FAILURE) { |