]> andersk Git - openssh.git/blobdiff - ssh-keygen.c
- (dtucker] [misc.c] Shrink the area covered by USE_ROUTINGDOMAIN more
[openssh.git] / ssh-keygen.c
index 02bd530a03c4fe2e116547d8b8dd7c2d73abd124..4f90ac5c1c7e2f6d9314645a501bae6ff5c224f2 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.169 2008/06/11 22:20:46 grunk Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.175 2009/08/27 17:33:49 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -135,7 +135,7 @@ ask_filename(struct passwd *pw, const char *prompt)
                        name = _PATH_SSH_CLIENT_ID_RSA;
                        break;
                default:
-                       fprintf(stderr, "bad key type");
+                       fprintf(stderr, "bad key type\n");
                        exit(1);
                        break;
                }
@@ -421,7 +421,7 @@ do_convert_from_ssh2(struct passwd *pw)
                 PEM_write_RSAPrivateKey(stdout, k->rsa, NULL, NULL, 0, NULL, NULL)) :
            key_write(k, stdout);
        if (!ok) {
-               fprintf(stderr, "key write failed");
+               fprintf(stderr, "key write failed\n");
                exit(1);
        }
        key_free(k);
@@ -524,8 +524,9 @@ do_fingerprint(struct passwd *pw)
        public = key_load_public(identity_file, &comment);
        if (public != NULL) {
                fp = key_fingerprint(public, fptype, rep);
-               ra = key_fingerprint(public, fptype, SSH_FP_RANDOMART);
-               printf("%u %s %s\n", key_size(public), fp, comment);
+               ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART);
+               printf("%u %s %s (%s)\n", key_size(public), fp, comment,
+                   key_type(public));
                if (log_level >= SYSLOG_LEVEL_VERBOSE)
                        printf("%s\n", ra);
                key_free(public);
@@ -588,9 +589,9 @@ do_fingerprint(struct passwd *pw)
                        }
                        comment = *cp ? cp : comment;
                        fp = key_fingerprint(public, fptype, rep);
-                       ra = key_fingerprint(public, fptype, SSH_FP_RANDOMART);
-                       printf("%u %s %s\n", key_size(public), fp,
-                           comment ? comment : "no comment");
+                       ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART);
+                       printf("%u %s %s (%s)\n", key_size(public), fp,
+                           comment ? comment : "no comment", key_type(public));
                        if (log_level >= SYSLOG_LEVEL_VERBOSE)
                                printf("%s\n", ra);
                        xfree(ra);
@@ -618,8 +619,11 @@ print_host(FILE *f, const char *name, Key *public, int hash)
                fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
                rep =    print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX;
                fp = key_fingerprint(public, fptype, rep);
-               ra = key_fingerprint(public, fptype, SSH_FP_RANDOMART);
-               printf("%u %s %s\n%s\n", key_size(public), fp, name, ra);
+               ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART);
+               printf("%u %s %s (%s)\n", key_size(public), fp, name,
+                   key_type(public));
+               if (log_level >= SYSLOG_LEVEL_VERBOSE)
+                       printf("%s\n", ra);
                xfree(ra);
                xfree(fp);
        } else {
@@ -1011,11 +1015,11 @@ do_change_comment(struct passwd *pw)
        }
        f = fdopen(fd, "w");
        if (f == NULL) {
-               printf("fdopen %s failed", identity_file);
+               printf("fdopen %s failed\n", identity_file);
                exit(1);
        }
        if (!key_write(public, f))
-               fprintf(stderr, "write key failed");
+               fprintf(stderr, "write key failed\n");
        key_free(public);
        fprintf(f, " %s\n", new_comment);
        fclose(f);
@@ -1362,7 +1366,7 @@ main(int argc, char **argv)
                printf("Generating public/private %s key pair.\n", key_type_name);
        private = key_generate(type, bits);
        if (private == NULL) {
-               fprintf(stderr, "key_generate failed");
+               fprintf(stderr, "key_generate failed\n");
                exit(1);
        }
        public  = key_from_private(private);
@@ -1422,7 +1426,7 @@ passphrase_again:
        if (identity_comment) {
                strlcpy(comment, identity_comment, sizeof(comment));
        } else {
-               /* Create default commend field for the passphrase. */
+               /* Create default comment field for the passphrase. */
                snprintf(comment, sizeof comment, "%s@%s", pw->pw_name, hostname);
        }
 
@@ -1452,11 +1456,11 @@ passphrase_again:
        }
        f = fdopen(fd, "w");
        if (f == NULL) {
-               printf("fdopen %s failed", identity_file);
+               printf("fdopen %s failed\n", identity_file);
                exit(1);
        }
        if (!key_write(public, f))
-               fprintf(stderr, "write key failed");
+               fprintf(stderr, "write key failed\n");
        fprintf(f, " %s\n", comment);
        fclose(f);
 
This page took 0.08017 seconds and 4 git commands to generate.