summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-01-28 22:36:00 +0000
committerDamien Miller <djm@mindrot.org>2015-01-29 10:18:56 +1100
commit9ce86c926dfa6e0635161b035e3944e611cbccf0 (patch)
treed946ba3df439153ece7857d742035a3d6adcbc98 /sshconnect.c
parent9125525c37bf73ad3ee4025520889d2ce9d10f29 (diff)
upstream commit
update to new API (key_fingerprint => sshkey_fingerprint) check sshkey_fingerprint return values; ok markus
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/sshconnect.c b/sshconnect.c
index df921bec1..9e515066d 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.258 2015/01/26 06:10:03 djm Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.259 2015/01/28 22:36:00 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -770,7 +770,7 @@ get_hostfile_hostname_ipaddr(char *hostname, struct sockaddr *hostaddr,
770 if (options.proxy_command == NULL) { 770 if (options.proxy_command == NULL) {
771 if (getnameinfo(hostaddr, addrlen, 771 if (getnameinfo(hostaddr, addrlen,
772 ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST) != 0) 772 ntop, sizeof(ntop), NULL, 0, NI_NUMERICHOST) != 0)
773 fatal("check_host_key: getnameinfo failed"); 773 fatal("%s: getnameinfo failed", __func__);
774 *hostfile_ipaddr = put_host_port(ntop, port); 774 *hostfile_ipaddr = put_host_port(ntop, port);
775 } else { 775 } else {
776 *hostfile_ipaddr = xstrdup("<no hostip for proxy " 776 *hostfile_ipaddr = xstrdup("<no hostip for proxy "
@@ -919,10 +919,12 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
919 "key for IP address '%.128s' to the list " 919 "key for IP address '%.128s' to the list "
920 "of known hosts.", type, ip); 920 "of known hosts.", type, ip);
921 } else if (options.visual_host_key) { 921 } else if (options.visual_host_key) {
922 fp = key_fingerprint(host_key, 922 fp = sshkey_fingerprint(host_key,
923 options.fingerprint_hash, SSH_FP_DEFAULT); 923 options.fingerprint_hash, SSH_FP_DEFAULT);
924 ra = key_fingerprint(host_key, 924 ra = sshkey_fingerprint(host_key,
925 options.fingerprint_hash, SSH_FP_RANDOMART); 925 options.fingerprint_hash, SSH_FP_RANDOMART);
926 if (fp == NULL || ra == NULL)
927 fatal("%s: sshkey_fingerprint fail", __func__);
926 logit("Host key fingerprint is %s\n%s\n", fp, ra); 928 logit("Host key fingerprint is %s\n%s\n", fp, ra);
927 free(ra); 929 free(ra);
928 free(fp); 930 free(fp);
@@ -962,10 +964,12 @@ check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,
962 else 964 else
963 snprintf(msg1, sizeof(msg1), "."); 965 snprintf(msg1, sizeof(msg1), ".");
964 /* The default */ 966 /* The default */
965 fp = key_fingerprint(host_key, 967 fp = sshkey_fingerprint(host_key,
966 options.fingerprint_hash, SSH_FP_DEFAULT); 968 options.fingerprint_hash, SSH_FP_DEFAULT);
967 ra = key_fingerprint(host_key, 969 ra = sshkey_fingerprint(host_key,
968 options.fingerprint_hash, SSH_FP_RANDOMART); 970 options.fingerprint_hash, SSH_FP_RANDOMART);
971 if (fp == NULL || ra == NULL)
972 fatal("%s: sshkey_fingerprint fail", __func__);
969 msg2[0] = '\0'; 973 msg2[0] = '\0';
970 if (options.verify_host_key_dns) { 974 if (options.verify_host_key_dns) {
971 if (matching_host_key_dns) 975 if (matching_host_key_dns)
@@ -1399,10 +1403,12 @@ show_other_keys(struct hostkeys *hostkeys, Key *key)
1399 continue; 1403 continue;
1400 if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found)) 1404 if (!lookup_key_in_hostkeys_by_type(hostkeys, type[i], &found))
1401 continue; 1405 continue;
1402 fp = key_fingerprint(found->key, 1406 fp = sshkey_fingerprint(found->key,
1403 options.fingerprint_hash, SSH_FP_DEFAULT); 1407 options.fingerprint_hash, SSH_FP_DEFAULT);
1404 ra = key_fingerprint(found->key, 1408 ra = sshkey_fingerprint(found->key,
1405 options.fingerprint_hash, SSH_FP_RANDOMART); 1409 options.fingerprint_hash, SSH_FP_RANDOMART);
1410 if (fp == NULL || ra == NULL)
1411 fatal("%s: sshkey_fingerprint fail", __func__);
1406 logit("WARNING: %s key found for host %s\n" 1412 logit("WARNING: %s key found for host %s\n"
1407 "in %s:%lu\n" 1413 "in %s:%lu\n"
1408 "%s key fingerprint %s.", 1414 "%s key fingerprint %s.",
@@ -1423,8 +1429,10 @@ warn_changed_key(Key *host_key)
1423{ 1429{
1424 char *fp; 1430 char *fp;
1425 1431
1426 fp = key_fingerprint(host_key, options.fingerprint_hash, 1432 fp = sshkey_fingerprint(host_key, options.fingerprint_hash,
1427 SSH_FP_DEFAULT); 1433 SSH_FP_DEFAULT);
1434 if (fp == NULL)
1435 fatal("%s: sshkey_fingerprint fail", __func__);
1428 1436
1429 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); 1437 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
1430 error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); 1438 error("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @");