summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-11-05 20:09:09 +1100
committerDarren Tucker <dtucker@zip.com.au>2004-11-05 20:09:09 +1100
commit178fa66a6451d890083d2441a2de207bdb74a348 (patch)
treee3b8f6eb00afab49734625145a471335d6987552
parent7cc5c23817e35938a1004e6815936f8e7baa94a2 (diff)
- mickey@cvs.openbsd.org 2004/09/15 18:42:27
[sshd.c] use less doubles in daemons; markus@ ok
-rw-r--r--ChangeLog5
-rw-r--r--sshd.c9
2 files changed, 8 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6316a4de0..70fc70cc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,9 @@
23 From Michael Knudsen, with wording changed slightly to match the 23 From Michael Knudsen, with wording changed slightly to match the
24 PrintMotd description. 24 PrintMotd description.
25 ok djm 25 ok djm
26 - mickey@cvs.openbsd.org 2004/09/15 18:42:27
27 [sshd.c]
28 use less doubles in daemons; markus@ ok
26 29
2720041102 3020041102
28 - (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX 31 - (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX
@@ -1802,4 +1805,4 @@
1802 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1805 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1803 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1806 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1804 1807
1805$Id: ChangeLog,v 1.3567 2004/11/05 09:06:59 dtucker Exp $ 1808$Id: ChangeLog,v 1.3568 2004/11/05 09:09:09 dtucker Exp $
diff --git a/sshd.c b/sshd.c
index 4b2d10af9..2afe316cf 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.302 2004/08/28 01:01:48 djm Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.303 2004/09/15 18:42:27 mickey Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -750,7 +750,7 @@ get_hostkey_index(Key *key)
750static int 750static int
751drop_connection(int startups) 751drop_connection(int startups)
752{ 752{
753 double p, r; 753 int p, r;
754 754
755 if (startups < options.max_startups_begin) 755 if (startups < options.max_startups_begin)
756 return 0; 756 return 0;
@@ -761,10 +761,9 @@ drop_connection(int startups)
761 761
762 p = 100 - options.max_startups_rate; 762 p = 100 - options.max_startups_rate;
763 p *= startups - options.max_startups_begin; 763 p *= startups - options.max_startups_begin;
764 p /= (double) (options.max_startups - options.max_startups_begin); 764 p /= options.max_startups - options.max_startups_begin;
765 p += options.max_startups_rate; 765 p += options.max_startups_rate;
766 p /= 100.0; 766 r = arc4random() % 100;
767 r = arc4random() / (double) UINT_MAX;
768 767
769 debug("drop_connection: p %g, r %g", p, r); 768 debug("drop_connection: p %g, r %g", p, r);
770 return (r < p) ? 1 : 0; 769 return (r < p) ? 1 : 0;