diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-06-25 04:18:59 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-06-25 04:18:59 +0000 |
commit | af7388046d8238c5d50a78c5ecdc9d782dad01de (patch) | |
tree | e5ee197e6787b246b8fd90a47e37dbbc542d81d9 | |
parent | f96704d4ef4c55599d9999292abc1457e8153674 (diff) |
- 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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | dh.c | 12 |
2 files changed, 9 insertions, 9 deletions
@@ -25,6 +25,10 @@ | |||
25 | merge authorized_keys2 into authorized_keys. | 25 | merge authorized_keys2 into authorized_keys. |
26 | authorized_keys2 is used for backward compat. | 26 | authorized_keys2 is used for backward compat. |
27 | (just append authorized_keys2 to authorized_keys). | 27 | (just append authorized_keys2 to authorized_keys). |
28 | - provos@cvs.openbsd.org 2001/06/22 21:57:59 | ||
29 | [dh.c] | ||
30 | increase linebuffer to deal with larger moduli; use rewind instead of | ||
31 | close/open | ||
28 | 32 | ||
29 | 20010622 | 33 | 20010622 |
30 | - (stevesk) handle systems without pw_expire and pw_change. | 34 | - (stevesk) handle systems without pw_expire and pw_change. |
@@ -5709,4 +5713,4 @@ | |||
5709 | - Wrote replacements for strlcpy and mkdtemp | 5713 | - Wrote replacements for strlcpy and mkdtemp |
5710 | - Released 1.0pre1 | 5714 | - Released 1.0pre1 |
5711 | 5715 | ||
5712 | $Id: ChangeLog,v 1.1302 2001/06/25 04:17:12 mouring Exp $ | 5716 | $Id: ChangeLog,v 1.1303 2001/06/25 04:18:59 mouring Exp $ |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: dh.c,v 1.15 2001/06/22 21:27:07 provos Exp $"); | 26 | RCSID("$OpenBSD: dh.c,v 1.16 2001/06/22 21:57:59 provos Exp $"); |
27 | 27 | ||
28 | #include "xmalloc.h" | 28 | #include "xmalloc.h" |
29 | 29 | ||
@@ -103,7 +103,7 @@ DH * | |||
103 | choose_dh(int min, int wantbits, int max) | 103 | choose_dh(int min, int wantbits, int max) |
104 | { | 104 | { |
105 | FILE *f; | 105 | FILE *f; |
106 | char line[1024]; | 106 | char line[2048]; |
107 | int best, bestcount, which; | 107 | int best, bestcount, which; |
108 | int linenum; | 108 | int linenum; |
109 | struct dhgroup dhg; | 109 | struct dhgroup dhg; |
@@ -134,18 +134,14 @@ choose_dh(int min, int wantbits, int max) | |||
134 | if (dhg.size == best) | 134 | if (dhg.size == best) |
135 | bestcount++; | 135 | bestcount++; |
136 | } | 136 | } |
137 | fclose (f); | 137 | rewind(f); |
138 | 138 | ||
139 | if (bestcount == 0) { | 139 | if (bestcount == 0) { |
140 | fclose(f); | ||
140 | log("WARNING: no suitable primes in %s", _PATH_DH_PRIMES); | 141 | log("WARNING: no suitable primes in %s", _PATH_DH_PRIMES); |
141 | return (NULL); | 142 | return (NULL); |
142 | } | 143 | } |
143 | 144 | ||
144 | f = fopen(_PATH_DH_PRIMES, "r"); | ||
145 | if (!f) { | ||
146 | fatal("WARNING: %s disappeared, giving up", _PATH_DH_PRIMES); | ||
147 | } | ||
148 | |||
149 | linenum = 0; | 145 | linenum = 0; |
150 | which = arc4random() % bestcount; | 146 | which = arc4random() % bestcount; |
151 | while (fgets(line, sizeof(line), f)) { | 147 | while (fgets(line, sizeof(line), f)) { |