[dh.c]
     increase linebuffer to deal with larger moduli; use rewind instead of
     close/open
This commit is contained in:
Ben Lindstrom 2001-06-25 04:18:59 +00:00
parent f96704d4ef
commit af7388046d
2 changed files with 9 additions and 9 deletions

View File

@ -25,6 +25,10 @@
merge authorized_keys2 into authorized_keys.
authorized_keys2 is used for backward compat.
(just append authorized_keys2 to authorized_keys).
- provos@cvs.openbsd.org 2001/06/22 21:57:59
[dh.c]
increase linebuffer to deal with larger moduli; use rewind instead of
close/open
20010622
- (stevesk) handle systems without pw_expire and pw_change.
@ -5709,4 +5713,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1302 2001/06/25 04:17:12 mouring Exp $
$Id: ChangeLog,v 1.1303 2001/06/25 04:18:59 mouring Exp $

12
dh.c
View File

@ -23,7 +23,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: dh.c,v 1.15 2001/06/22 21:27:07 provos Exp $");
RCSID("$OpenBSD: dh.c,v 1.16 2001/06/22 21:57:59 provos Exp $");
#include "xmalloc.h"
@ -103,7 +103,7 @@ DH *
choose_dh(int min, int wantbits, int max)
{
FILE *f;
char line[1024];
char line[2048];
int best, bestcount, which;
int linenum;
struct dhgroup dhg;
@ -134,18 +134,14 @@ choose_dh(int min, int wantbits, int max)
if (dhg.size == best)
bestcount++;
}
fclose (f);
rewind(f);
if (bestcount == 0) {
fclose(f);
log("WARNING: no suitable primes in %s", _PATH_DH_PRIMES);
return (NULL);
}
f = fopen(_PATH_DH_PRIMES, "r");
if (!f) {
fatal("WARNING: %s disappeared, giving up", _PATH_DH_PRIMES);
}
linenum = 0;
which = arc4random() % bestcount;
while (fgets(line, sizeof(line), f)) {