|
Lines 1456-1468
do_change_passphrase(struct passwd *pw)
Link Here
|
| 1456 |
*/ |
1456 |
*/ |
| 1457 |
static int |
1457 |
static int |
| 1458 |
do_print_resource_record(struct passwd *pw, char *fname, char *hname, |
1458 |
do_print_resource_record(struct passwd *pw, char *fname, char *hname, |
| 1459 |
int print_generic) |
1459 |
int print_generic, char * const *opts, size_t nopts) |
| 1460 |
{ |
1460 |
{ |
| 1461 |
struct sshkey *public; |
1461 |
struct sshkey *public; |
| 1462 |
char *comment = NULL; |
1462 |
char *comment = NULL; |
| 1463 |
struct stat st; |
1463 |
struct stat st; |
| 1464 |
int r; |
1464 |
int r, hash = -1; |
|
|
1465 |
size_t i; |
| 1465 |
|
1466 |
|
|
|
1467 |
for (i = 0; i < nopts; i++) { |
| 1468 |
if (strncasecmp(opts[i], "hashalg=", 8) == 0) { |
| 1469 |
if ((hash = ssh_digest_alg_by_name(opts[i] + 8)) == -1) |
| 1470 |
fatal("Unsupported hash algorithm"); |
| 1471 |
} else { |
| 1472 |
error("Invalid option \"%s\"", opts[i]); |
| 1473 |
return SSH_ERR_INVALID_ARGUMENT; |
| 1474 |
} |
| 1475 |
} |
| 1466 |
if (fname == NULL) |
1476 |
if (fname == NULL) |
| 1467 |
fatal_f("no filename"); |
1477 |
fatal_f("no filename"); |
| 1468 |
if (stat(fname, &st) == -1) { |
1478 |
if (stat(fname, &st) == -1) { |
|
Lines 1472-1478
do_print_resource_record(struct passwd *pw, char *fname, char *hname,
Link Here
|
| 1472 |
} |
1482 |
} |
| 1473 |
if ((r = sshkey_load_public(fname, &public, &comment)) != 0) |
1483 |
if ((r = sshkey_load_public(fname, &public, &comment)) != 0) |
| 1474 |
fatal_r(r, "Failed to read v2 public key from \"%s\"", fname); |
1484 |
fatal_r(r, "Failed to read v2 public key from \"%s\"", fname); |
| 1475 |
export_dns_rr(hname, public, stdout, print_generic); |
1485 |
export_dns_rr(hname, public, stdout, print_generic, hash); |
| 1476 |
sshkey_free(public); |
1486 |
sshkey_free(public); |
| 1477 |
free(comment); |
1487 |
free(comment); |
| 1478 |
return 1; |
1488 |
return 1; |
|
Lines 3699-3705
main(int argc, char **argv)
Link Here
|
| 3699 |
|
3709 |
|
| 3700 |
if (have_identity) { |
3710 |
if (have_identity) { |
| 3701 |
n = do_print_resource_record(pw, identity_file, |
3711 |
n = do_print_resource_record(pw, identity_file, |
| 3702 |
rr_hostname, print_generic); |
3712 |
rr_hostname, print_generic, opts, nopts); |
| 3703 |
if (n == 0) |
3713 |
if (n == 0) |
| 3704 |
fatal("%s: %s", identity_file, strerror(errno)); |
3714 |
fatal("%s: %s", identity_file, strerror(errno)); |
| 3705 |
exit(0); |
3715 |
exit(0); |
|
Lines 3707-3725
main(int argc, char **argv)
Link Here
|
| 3707 |
|
3717 |
|
| 3708 |
n += do_print_resource_record(pw, |
3718 |
n += do_print_resource_record(pw, |
| 3709 |
_PATH_HOST_RSA_KEY_FILE, rr_hostname, |
3719 |
_PATH_HOST_RSA_KEY_FILE, rr_hostname, |
| 3710 |
print_generic); |
3720 |
print_generic, opts, nopts); |
| 3711 |
n += do_print_resource_record(pw, |
3721 |
n += do_print_resource_record(pw, |
| 3712 |
_PATH_HOST_DSA_KEY_FILE, rr_hostname, |
3722 |
_PATH_HOST_DSA_KEY_FILE, rr_hostname, |
| 3713 |
print_generic); |
3723 |
print_generic, opts, nopts); |
| 3714 |
n += do_print_resource_record(pw, |
3724 |
n += do_print_resource_record(pw, |
| 3715 |
_PATH_HOST_ECDSA_KEY_FILE, rr_hostname, |
3725 |
_PATH_HOST_ECDSA_KEY_FILE, rr_hostname, |
| 3716 |
print_generic); |
3726 |
print_generic, opts, nopts); |
| 3717 |
n += do_print_resource_record(pw, |
3727 |
n += do_print_resource_record(pw, |
| 3718 |
_PATH_HOST_ED25519_KEY_FILE, rr_hostname, |
3728 |
_PATH_HOST_ED25519_KEY_FILE, rr_hostname, |
| 3719 |
print_generic); |
3729 |
print_generic, opts, nopts); |
| 3720 |
n += do_print_resource_record(pw, |
3730 |
n += do_print_resource_record(pw, |
| 3721 |
_PATH_HOST_XMSS_KEY_FILE, rr_hostname, |
3731 |
_PATH_HOST_XMSS_KEY_FILE, rr_hostname, |
| 3722 |
print_generic); |
3732 |
print_generic, opts, nopts); |
| 3723 |
if (n == 0) |
3733 |
if (n == 0) |
| 3724 |
fatal("no keys found."); |
3734 |
fatal("no keys found."); |
| 3725 |
exit(0); |
3735 |
exit(0); |