]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2008/05/19 15:46:31
authordtucker <dtucker>
Sun, 8 Jun 2008 02:54:29 +0000 (02:54 +0000)
committerdtucker <dtucker>
Sun, 8 Jun 2008 02:54:29 +0000 (02:54 +0000)
     [ssh-keygen.c]
     support -l (print fingerprint) in combination with -F (find host) to
     search for a host in ~/.ssh/known_hosts and display its fingerprint;
     ok markus@

ChangeLog
ssh-keygen.c

index 441bc89afa4f932dd4586d2b6d93a2ed1f3236dd..b35aec7c1be76b12daf9b0c4909c4662175dbbbf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
      we would send the modes corresponding to a zeroed struct termios,
      whereas we should have been sending an empty list of modes.
      Based on patch from daniel.ritz AT alcatel.ch; ok dtucker@ markus@
+   - djm@cvs.openbsd.org 2008/05/19 15:46:31
+     [ssh-keygen.c]
+     support -l (print fingerprint) in combination with -F (find host) to
+     search for a host in ~/.ssh/known_hosts and display its fingerprint;
+     ok markus@
 
 20080604
  - (djm) [openbsd-compat/bsd-arc4random.c] Fix math bug that caused bias
index 69b16e6f50e2ffe4ef8410b4cee772fe24d3930b..a03c6575d67f0b5b5c478edd19750c8baf14cc6e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.165 2008/01/19 22:37:19 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.166 2008/05/19 15:46:31 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -600,12 +600,24 @@ do_fingerprint(struct passwd *pw)
 static void
 print_host(FILE *f, const char *name, Key *public, int hash)
 {
-       if (hash && (name = host_hash(name, NULL, 0)) == NULL)
-               fatal("hash_host failed");
-       fprintf(f, "%s ", name);
-       if (!key_write(public, f))
-               fatal("key_write failed");
-       fprintf(f, "\n");
+       if (print_fingerprint) {
+               enum fp_rep rep;
+               enum fp_type fptype;
+               char *fp;
+
+               fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
+               rep =    print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX;
+               fp = key_fingerprint(public, fptype, rep);
+               printf("%u %s %s\n", key_size(public), fp, name);
+               xfree(fp);
+       } else {
+               if (hash && (name = host_hash(name, NULL, 0)) == NULL)
+                       fatal("hash_host failed");
+               fprintf(f, "%s ", name);
+               if (!key_write(public, f))
+                       fatal("key_write failed");
+               fprintf(f, "\n");
+       }
 }
 
 static void
@@ -1231,6 +1243,10 @@ main(int argc, char **argv)
                printf("Can only have one of -p and -c.\n");
                usage();
        }
+       if (print_fingerprint && (delete_host || hash_hosts)) {
+               printf("Cannot use -l with -D or -R.\n");
+               usage();
+       }
        if (delete_host || hash_hosts || find_host)
                do_known_hosts(pw, rr_hostname);
        if (print_fingerprint || print_bubblebabble)
This page took 0.130708 seconds and 5 git commands to generate.