summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c9
1 files changed, 4 insertions, 5 deletions
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;