diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -42,7 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include "includes.h" | 44 | #include "includes.h" |
45 | RCSID("$OpenBSD: sshd.c,v 1.302 2004/08/28 01:01:48 djm Exp $"); | 45 | RCSID("$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) | |||
750 | static int | 750 | static int |
751 | drop_connection(int startups) | 751 | drop_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; |