View | Details | Raw Unified | Return to bug 2520 | Differences between
and this patch

Collapse All | Expand All

(-)a/ssh-keygen.c (-1 / +9 lines)
Lines 37-42 Link Here
37
#include <string.h>
37
#include <string.h>
38
#include <unistd.h>
38
#include <unistd.h>
39
#include <limits.h>
39
#include <limits.h>
40
#include <bsd/vis.h>
40
41
41
#include "xmalloc.h"
42
#include "xmalloc.h"
42
#include "sshkey.h"
43
#include "sshkey.h"
Lines 836-841 fingerprint_one_key(const struct sshkey *public, const char *comment) Link Here
836
	char *fp = NULL, *ra = NULL;
837
	char *fp = NULL, *ra = NULL;
837
	enum sshkey_fp_rep rep;
838
	enum sshkey_fp_rep rep;
838
	int fptype;
839
	int fptype;
840
	char * pc = NULL;
839
841
840
	fptype = print_bubblebabble ? SSH_DIGEST_SHA1 : fingerprint_hash;
842
	fptype = print_bubblebabble ? SSH_DIGEST_SHA1 : fingerprint_hash;
841
	rep =    print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT;
843
	rep =    print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT;
Lines 843-852 fingerprint_one_key(const struct sshkey *public, const char *comment) Link Here
843
	ra = sshkey_fingerprint(public, fingerprint_hash, SSH_FP_RANDOMART);
845
	ra = sshkey_fingerprint(public, fingerprint_hash, SSH_FP_RANDOMART);
844
	if (fp == NULL || ra == NULL)
846
	if (fp == NULL || ra == NULL)
845
		fatal("%s: sshkey_fingerprint failed", __func__);
847
		fatal("%s: sshkey_fingerprint failed", __func__);
848
849
	/* strvis needs 4 * strlen() according to manpage */
850
	pc = malloc(4 * strlen(comment) * sizeof (char) + 1);
851
	strvis(pc, comment, VIS_OCTAL | VIS_SAFE);
852
846
	printf("%u %s %s (%s)\n", sshkey_size(public), fp,
853
	printf("%u %s %s (%s)\n", sshkey_size(public), fp,
847
	    comment ? comment : "no comment", sshkey_type(public));
854
	    pc ? pc : "no comment", sshkey_type(public));
848
	if (log_level >= SYSLOG_LEVEL_VERBOSE)
855
	if (log_level >= SYSLOG_LEVEL_VERBOSE)
849
		printf("%s\n", ra);
856
		printf("%s\n", ra);
857
	free(pc);
850
	free(ra);
858
	free(ra);
851
	free(fp);
859
	free(fp);
852
}
860
}

Return to bug 2520