]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: repair private key fingerprint printing to also print
authordjm@openbsd.org <djm@openbsd.org>
Fri, 17 Apr 2020 07:16:07 +0000 (07:16 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 17 Apr 2020 07:17:48 +0000 (17:17 +1000)
comment after regression caused by my recent pubkey loading refactor.
Reported by loic AT venez.fr, ok dtucker@

OpenBSD-Commit-ID: f8db49acbee6a6ccb2a4259135693b3cceedb89e

ssh-keygen.c

index 802fd25c286fbc75fd22253e5112244c260a15b6..c181b58aa2e3cf557b161b04ffcadaadd913860c 100644 (file)
@@ -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
@@ -910,22 +910,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);
 }