diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-09-15 18:42:28 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-09-15 18:42:28 +0000 |
commit | cd72efffcb74191c9cbd98b3712b7c9f2877d86e (patch) | |
tree | 5fc6c9d254bd21658e1b32f654d17f4783410b0f | |
parent | b9a0bbff7a51a26a31d368595e9754a862ef90ab (diff) |
use less doubles in daemons; markus@ ok
-rw-r--r-- | usr.bin/ssh/sshd.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index cb6622578bd..50d0de8198d 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -42,7 +42,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.302 2004/08/28 01:01:48 djm Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.303 2004/09/15 18:42:27 mickey Exp $"); #include <openssl/dh.h> #include <openssl/bn.h> @@ -740,7 +740,7 @@ get_hostkey_index(Key *key) static int drop_connection(int startups) { - double p, r; + int p, r; if (startups < options.max_startups_begin) return 0; @@ -751,10 +751,9 @@ drop_connection(int startups) p = 100 - options.max_startups_rate; p *= startups - options.max_startups_begin; - p /= (double) (options.max_startups - options.max_startups_begin); + p /= options.max_startups - options.max_startups_begin; p += options.max_startups_rate; - p /= 100.0; - r = arc4random() / (double) UINT_MAX; + r = arc4random() % 100; debug("drop_connection: p %g, r %g", p, r); return (r < p) ? 1 : 0; |