# HG changeset patch # User Matt Johnston # Date 1115265610 0 # Node ID 06e326daf16a6e828f9f76645be3349d38453496 # Parent c9483550701bc5b15997ac0fed72847d754722d7# Parent 5ccad7634388cf8fc7fe2fdc187afa44a129f857 merge of 6b56bdff53b47ae7366d93b496ce353d9e3753dc and b68c53583ba80ad14fd0ba70ff26ea3dbd8e8823 diff -r c9483550701b -r 06e326daf16a TODO --- a/TODO Thu May 05 03:58:21 2005 +0000 +++ b/TODO Thu May 05 04:00:10 2005 +0000 @@ -4,9 +4,6 @@ - Make options.h generated from configure perhaps? -- some sort of warning when blocking on random? (could be difficult, - investigate alarm() perhaps) - - Improved queueing of unauthed connections - handle /etc/environment in AIX diff -r c9483550701b -r 06e326daf16a cli-tcpfwd.c --- a/cli-tcpfwd.c Thu May 05 03:58:21 2005 +0000 +++ b/cli-tcpfwd.c Thu May 05 04:00:10 2005 +0000 @@ -94,7 +94,7 @@ TRACE(("enter cli_localtcp: %d %s %d", listenport, remoteaddr, remoteport)); - tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener*)); + tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener)); tcpinfo->sendaddr = m_strdup(remoteaddr); tcpinfo->sendport = remoteport; tcpinfo->listenport = listenport; diff -r c9483550701b -r 06e326daf16a random.c --- a/random.c Thu May 05 03:58:21 2005 +0000 +++ b/random.c Thu May 05 04:00:10 2005 +0000 @@ -51,6 +51,7 @@ static void readrand(unsigned char* buf, unsigned int buflen) { + static int already_blocked = 0; int readfd; unsigned int readpos; int readlen; @@ -93,6 +94,24 @@ /* read the actual random data */ readpos = 0; do { + if (!already_blocked) + { + int ret; + struct timeval timeout; + fd_set read_fds; + + timeout.tv_sec = 2; /* two seconds should be enough */ + timeout.tv_usec = 0; + + FD_ZERO(&read_fds); + FD_SET(readfd, &read_fds); + ret = select(readfd + 1, &read_fds, NULL, NULL, &timeout); + if (ret == 0) + { + dropbear_log(LOG_INFO, "Warning: Reading the random source seems to have blocked.\nIf you experience problems, you probably need to find a better entropy source."); + already_blocked = 1; + } + } readlen = read(readfd, &buf[readpos], buflen - readpos); if (readlen <= 0) { if (readlen < 0 && errno == EINTR) {