diff options
author | Darren Tucker <dtucker@zip.com.au> | 2004-11-05 20:09:09 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2004-11-05 20:09:09 +1100 |
commit | 178fa66a6451d890083d2441a2de207bdb74a348 (patch) | |
tree | e3b8f6eb00afab49734625145a471335d6987552 | |
parent | 7cc5c23817e35938a1004e6815936f8e7baa94a2 (diff) |
- mickey@cvs.openbsd.org 2004/09/15 18:42:27
[sshd.c]
use less doubles in daemons; markus@ ok
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sshd.c | 9 |
2 files changed, 8 insertions, 6 deletions
@@ -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 | ||
27 | 20041102 | 30 | 20041102 |
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 $ |
@@ -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; |