|
Lines 48-56
extern u_char session_id[16];
Link Here
|
| 48 |
* following format: |
48 |
* following format: |
| 49 |
* options bits e n comment |
49 |
* options bits e n comment |
| 50 |
* where bits, e and n are decimal numbers, |
50 |
* where bits, e and n are decimal numbers, |
| 51 |
* and comment is any string of characters up to newline. The maximum |
51 |
* and comment is any string of characters up to newline. |
| 52 |
* length of a line is 8000 characters. See the documentation for a |
52 |
* See the documentation for a description of the options. |
| 53 |
* description of the options. |
|
|
| 54 |
*/ |
53 |
*/ |
| 55 |
|
54 |
|
| 56 |
BIGNUM * |
55 |
BIGNUM * |
|
Lines 152-158
auth_rsa_challenge_dialog(Key *key)
Link Here
|
| 152 |
int |
151 |
int |
| 153 |
auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey) |
152 |
auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey) |
| 154 |
{ |
153 |
{ |
| 155 |
char line[8192], *file; |
154 |
char *line, *file, err[2048]; |
| 156 |
int allowed = 0; |
155 |
int allowed = 0; |
| 157 |
u_int bits; |
156 |
u_int bits; |
| 158 |
FILE *f; |
157 |
FILE *f; |
|
Lines 183-192
auth_rsa_key_allowed(struct passwd *pw,
Link Here
|
| 183 |
return (0); |
182 |
return (0); |
| 184 |
} |
183 |
} |
| 185 |
if (options.strict_modes && |
184 |
if (options.strict_modes && |
| 186 |
secure_filename(f, file, pw, line, sizeof(line)) != 0) { |
185 |
secure_filename(f, file, pw, err, sizeof(err)) != 0) { |
| 187 |
xfree(file); |
186 |
xfree(file); |
| 188 |
fclose(f); |
187 |
fclose(f); |
| 189 |
logit("Authentication refused: %s", line); |
188 |
logit("Authentication refused: %s", err); |
| 190 |
restore_uid(); |
189 |
restore_uid(); |
| 191 |
return (0); |
190 |
return (0); |
| 192 |
} |
191 |
} |
|
Lines 201-207
auth_rsa_key_allowed(struct passwd *pw,
Link Here
|
| 201 |
* found, perform a challenge-response dialog to verify that the |
200 |
* found, perform a challenge-response dialog to verify that the |
| 202 |
* user really has the corresponding private key. |
201 |
* user really has the corresponding private key. |
| 203 |
*/ |
202 |
*/ |
| 204 |
while (fgets(line, sizeof(line), f)) { |
203 |
while ((line = fgetline(f))) { |
| 205 |
char *cp; |
204 |
char *cp; |
| 206 |
char *key_options; |
205 |
char *key_options; |
| 207 |
|
206 |
|
|
Lines 210-217
auth_rsa_key_allowed(struct passwd *pw,
Link Here
|
| 210 |
/* Skip leading whitespace, empty and comment lines. */ |
209 |
/* Skip leading whitespace, empty and comment lines. */ |
| 211 |
for (cp = line; *cp == ' ' || *cp == '\t'; cp++) |
210 |
for (cp = line; *cp == ' ' || *cp == '\t'; cp++) |
| 212 |
; |
211 |
; |
| 213 |
if (!*cp || *cp == '\n' || *cp == '#') |
212 |
if (!*cp || *cp == '\n' || *cp == '#') { |
|
|
213 |
xfree(line); |
| 214 |
continue; |
214 |
continue; |
|
|
215 |
} |
| 215 |
|
216 |
|
| 216 |
/* |
217 |
/* |
| 217 |
* Check if there are options for this key, and if so, |
218 |
* Check if there are options for this key, and if so, |
|
Lines 235-240
auth_rsa_key_allowed(struct passwd *pw,
Link Here
|
| 235 |
if (hostfile_read_key(&cp, &bits, key) == 0) { |
236 |
if (hostfile_read_key(&cp, &bits, key) == 0) { |
| 236 |
debug("%.100s, line %lu: non ssh1 key syntax", |
237 |
debug("%.100s, line %lu: non ssh1 key syntax", |
| 237 |
file, linenum); |
238 |
file, linenum); |
|
|
239 |
xfree(line); |
| 238 |
continue; |
240 |
continue; |
| 239 |
} |
241 |
} |
| 240 |
/* cp now points to the comment part. */ |
242 |
/* cp now points to the comment part. */ |
|
Lines 254-264
auth_rsa_key_allowed(struct passwd *pw,
Link Here
|
| 254 |
* If our options do not allow this key to be used, |
256 |
* If our options do not allow this key to be used, |
| 255 |
* do not send challenge. |
257 |
* do not send challenge. |
| 256 |
*/ |
258 |
*/ |
| 257 |
if (!auth_parse_options(pw, key_options, file, linenum)) |
259 |
if (!auth_parse_options(pw, key_options, file, linenum)) { |
|
|
260 |
xfree(line); |
| 258 |
continue; |
261 |
continue; |
|
|
262 |
} |
| 259 |
|
263 |
|
| 260 |
/* break out, this key is allowed */ |
264 |
/* break out, this key is allowed */ |
| 261 |
allowed = 1; |
265 |
allowed = 1; |
|
|
266 |
xfree(line); |
| 262 |
break; |
267 |
break; |
| 263 |
} |
268 |
} |
| 264 |
|
269 |
|