diff options
author | 2008-06-12 00:13:55 +0000 | |
---|---|---|
committer | 2008-06-12 00:13:55 +0000 | |
commit | 7d2af32167e5aeccde6648f82e487b170d40a736 (patch) | |
tree | 115f13ab086b0e24ac5130ea47cb037b99ee2293 | |
parent | use an odd number of rows and columns and a separate start marker, looks (diff) | |
download | wireguard-openbsd-7d2af32167e5aeccde6648f82e487b170d40a736.tar.xz wireguard-openbsd-7d2af32167e5aeccde6648f82e487b170d40a736.zip |
Make ssh print the random art also when ssh'ing to a host using IP only.
spotted by naddy@, ok and help djm@ dtucker@
-rw-r--r-- | usr.bin/ssh/sshconnect.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index 6459f7906e6..0328634dd0d 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/sshconnect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect.c,v 1.205 2008/06/12 00:03:49 dtucker Exp $ */ +/* $OpenBSD: sshconnect.c,v 1.206 2008/06/12 00:13:55 grunk Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -597,6 +597,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, char msg[1024]; int len, host_line, ip_line; const char *host_file = NULL, *ip_file = NULL; + int display_randomart; /* * Force accepting of the host key for loopback/localhost. The @@ -639,6 +640,13 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, } else { ip = xstrdup("<no hostip for proxy command>"); } + + /* + * check_host_ip may be set to zero in the next step, so if it + * conveys a request to display the random art, save it away. + */ + display_randomart = (options.check_host_ip == SSHCTL_CHECKHOSTIP_FPR); + /* * Turn off check_host_ip if the connection is to localhost, via proxy * command or if we don't have a hostname to compare with @@ -723,7 +731,7 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port, logit("Warning: Permanently added the %s host " "key for IP address '%.128s' to the list " "of known hosts.", type, ip); - } else if (options.check_host_ip == SSHCTL_CHECKHOSTIP_FPR) { + } else if (display_randomart) { fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); ra = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_RANDOMART); |