|
Lines 308-319
do_convert_from_ssh2(struct passwd *pw)
Link Here
|
| 308 |
Key *k; |
308 |
Key *k; |
| 309 |
int blen; |
309 |
int blen; |
| 310 |
u_int len; |
310 |
u_int len; |
| 311 |
char line[1024], *p; |
311 |
char line[1024], *p, *q; |
| 312 |
u_char blob[8096]; |
312 |
u_char blob[8096]; |
| 313 |
char encoded[8096]; |
313 |
char encoded[8096]; |
| 314 |
struct stat st; |
314 |
struct stat st; |
| 315 |
int escaped = 0, private = 0, ok; |
315 |
int escaped = 0, private = 0, ok; |
| 316 |
FILE *fp; |
316 |
FILE *fp; |
|
|
317 |
long position = 0; |
| 317 |
|
318 |
|
| 318 |
if (!have_identity) |
319 |
if (!have_identity) |
| 319 |
ask_filename(pw, "Enter file in which the key is"); |
320 |
ask_filename(pw, "Enter file in which the key is"); |
|
Lines 328-336
do_convert_from_ssh2(struct passwd *pw)
Link Here
|
| 328 |
} |
329 |
} |
| 329 |
encoded[0] = '\0'; |
330 |
encoded[0] = '\0'; |
| 330 |
while (fgets(line, sizeof(line), fp)) { |
331 |
while (fgets(line, sizeof(line), fp)) { |
| 331 |
if (!(p = strchr(line, '\n'))) { |
332 |
p = strchr(line, '\n'); |
|
|
333 |
q = strchr(line, '\r'); |
| 334 |
if (p == NULL && q == NULL) { |
| 332 |
fprintf(stderr, "input line too long.\n"); |
335 |
fprintf(stderr, "input line too long.\n"); |
| 333 |
exit(1); |
336 |
exit(1); |
|
|
337 |
} else { |
| 338 |
if (p == NULL) { |
| 339 |
/* CR but no NL, seek to next line */ |
| 340 |
p = q; |
| 341 |
position += p - line + 1; |
| 342 |
if (fseek(fp, position, SEEK_SET) != 0) { |
| 343 |
fprintf(stderr, "fseek: %s\n", |
| 344 |
strerror(errno)); |
| 345 |
exit(1); |
| 346 |
} |
| 347 |
} else if (q != NULL) |
| 348 |
/* have both, select first one */ |
| 349 |
p = MIN(p, q); |
| 334 |
} |
350 |
} |
| 335 |
if (p > line && p[-1] == '\\') |
351 |
if (p > line && p[-1] == '\\') |
| 336 |
escaped++; |
352 |
escaped++; |