diff options
author | 2020-04-17 07:16:07 +0000 | |
---|---|---|
committer | 2020-04-17 07:16:07 +0000 | |
commit | fd5b71516673aa35c961928609f76e2e237c0d23 (patch) | |
tree | 9fa3453be24cb77a00d50c02baaff660c09a5617 /usr.bin/ssh/ssh-keygen.c | |
parent | refactor out some duplicate private key loading code; based on (diff) | |
download | wireguard-openbsd-fd5b71516673aa35c961928609f76e2e237c0d23.tar.xz wireguard-openbsd-fd5b71516673aa35c961928609f76e2e237c0d23.zip |
repair private key fingerprint printing to also print comment after
regression caused by my recent pubkey loading refactor. Reported by
loic AT venez.fr, ok dtucker@
Diffstat (limited to 'usr.bin/ssh/ssh-keygen.c')
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index dd676c01967..57ade4d7350 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keygen.c,v 1.405 2020/04/03 02:26:56 djm Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.406 2020/04/17 07:16:07 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -890,22 +890,21 @@ fingerprint_private(const char *path) { struct stat st; char *comment = NULL; - struct sshkey *public = NULL; + struct sshkey *key = NULL; int r; if (stat(identity_file, &st) == -1) fatal("%s: %s", path, strerror(errno)); - if ((r = sshkey_load_public(path, &public, &comment)) != 0) { - debug("load public \"%s\": %s", path, ssh_err(r)); - if ((r = sshkey_load_private(path, NULL, - &public, &comment)) != 0) { - debug("load private \"%s\": %s", path, ssh_err(r)); + if ((r = sshkey_load_private(path, NULL, &key, &comment)) != 0) { + debug("load private \"%s\": %s", path, ssh_err(r)); + if ((r = sshkey_load_public(path, &key, &comment)) != 0) { + debug("load public \"%s\": %s", path, ssh_err(r)); fatal("%s is not a key file.", path); } } - fingerprint_one_key(public, comment); - sshkey_free(public); + fingerprint_one_key(key, comment); + sshkey_free(key); free(comment); } |