=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sshconnect.c,v retrieving revision 1.205 retrieving revision 1.206 diff -u -r1.205 -r1.206 --- src/usr.bin/ssh/sshconnect.c 2008/06/12 00:03:49 1.205 +++ src/usr.bin/ssh/sshconnect.c 2008/06/12 00:13:55 1.206 @@ -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 * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -597,6 +597,7 @@ 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,7 +640,14 @@ } else { ip = xstrdup(""); } + /* + * 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 @@ 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);