|
Lines 454-459
sshkey_in_file(struct sshkey *key, const char *filename, int strict_type,
Link Here
|
| 454 |
return SSH_ERR_SYSTEM_ERROR; |
454 |
return SSH_ERR_SYSTEM_ERROR; |
| 455 |
|
455 |
|
| 456 |
while (getline(&line, &linesize, f) != -1) { |
456 |
while (getline(&line, &linesize, f) != -1) { |
|
|
457 |
sshkey_free(pub); |
| 458 |
pub = NULL; |
| 457 |
cp = line; |
459 |
cp = line; |
| 458 |
|
460 |
|
| 459 |
/* Skip leading whitespace. */ |
461 |
/* Skip leading whitespace. */ |
|
Lines 472-487
sshkey_in_file(struct sshkey *key, const char *filename, int strict_type,
Link Here
|
| 472 |
r = SSH_ERR_ALLOC_FAIL; |
474 |
r = SSH_ERR_ALLOC_FAIL; |
| 473 |
goto out; |
475 |
goto out; |
| 474 |
} |
476 |
} |
| 475 |
if ((r = sshkey_read(pub, &cp)) != 0) |
477 |
switch (r = sshkey_read(pub, &cp)) { |
|
|
478 |
case 0: |
| 479 |
break; |
| 480 |
case SSH_ERR_KEY_LENGTH: |
| 481 |
continue; |
| 482 |
default: |
| 476 |
goto out; |
483 |
goto out; |
|
|
484 |
} |
| 477 |
if (sshkey_compare(key, pub) || |
485 |
if (sshkey_compare(key, pub) || |
| 478 |
(check_ca && sshkey_is_cert(key) && |
486 |
(check_ca && sshkey_is_cert(key) && |
| 479 |
sshkey_compare(key->cert->signature_key, pub))) { |
487 |
sshkey_compare(key->cert->signature_key, pub))) { |
| 480 |
r = 0; |
488 |
r = 0; |
| 481 |
goto out; |
489 |
goto out; |
| 482 |
} |
490 |
} |
| 483 |
sshkey_free(pub); |
|
|
| 484 |
pub = NULL; |
| 485 |
} |
491 |
} |
| 486 |
r = SSH_ERR_KEY_NOT_FOUND; |
492 |
r = SSH_ERR_KEY_NOT_FOUND; |
| 487 |
out: |
493 |
out: |