[sshd.c]
     use less doubles in daemons; markus@ ok
This commit is contained in:
Darren Tucker 2004-11-05 20:09:09 +11:00
parent 7cc5c23817
commit 178fa66a64
2 changed files with 8 additions and 6 deletions

View File

@ -23,6 +23,9 @@
From Michael Knudsen, with wording changed slightly to match the From Michael Knudsen, with wording changed slightly to match the
PrintMotd description. PrintMotd description.
ok djm ok djm
- mickey@cvs.openbsd.org 2004/09/15 18:42:27
[sshd.c]
use less doubles in daemons; markus@ ok
20041102 20041102
- (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX - (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX
@ -1802,4 +1805,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3567 2004/11/05 09:06:59 dtucker Exp $ $Id: ChangeLog,v 1.3568 2004/11/05 09:09:09 dtucker Exp $

9
sshd.c
View File

@ -42,7 +42,7 @@
*/ */
#include "includes.h" #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/dh.h>
#include <openssl/bn.h> #include <openssl/bn.h>
@ -750,7 +750,7 @@ get_hostkey_index(Key *key)
static int static int
drop_connection(int startups) drop_connection(int startups)
{ {
double p, r; int p, r;
if (startups < options.max_startups_begin) if (startups < options.max_startups_begin)
return 0; return 0;
@ -761,10 +761,9 @@ drop_connection(int startups)
p = 100 - options.max_startups_rate; p = 100 - options.max_startups_rate;
p *= startups - options.max_startups_begin; 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 += options.max_startups_rate;
p /= 100.0; r = arc4random() % 100;
r = arc4random() / (double) UINT_MAX;
debug("drop_connection: p %g, r %g", p, r); debug("drop_connection: p %g, r %g", p, r);
return (r < p) ? 1 : 0; return (r < p) ? 1 : 0;