summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sshd.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/sshd.c b/sshd.c
index 004ddd4a5..4282bdc1b 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.440 2015/01/26 06:10:03 djm Exp $ */ 1/* $OpenBSD: sshd.c,v 1.441 2015/01/31 20:30:05 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
@@ -795,7 +795,7 @@ list_hostkey_types(void)
795 buffer_init(&b); 795 buffer_init(&b);
796 for (i = 0; i < options.num_host_key_files; i++) { 796 for (i = 0; i < options.num_host_key_files; i++) {
797 key = sensitive_data.host_keys[i]; 797 key = sensitive_data.host_keys[i];
798 if (key == NULL) 798 if (key == NULL && have_agent)
799 key = sensitive_data.host_pubkeys[i]; 799 key = sensitive_data.host_pubkeys[i];
800 if (key == NULL) 800 if (key == NULL)
801 continue; 801 continue;
@@ -1442,7 +1442,7 @@ main(int ac, char **av)
1442 int sock_in = -1, sock_out = -1, newsock = -1; 1442 int sock_in = -1, sock_out = -1, newsock = -1;
1443 const char *remote_ip; 1443 const char *remote_ip;
1444 int remote_port; 1444 int remote_port;
1445 char *line, *logfile = NULL; 1445 char *fp, *line, *logfile = NULL;
1446 int config_s[2] = { -1 , -1 }; 1446 int config_s[2] = { -1 , -1 };
1447 u_int n; 1447 u_int n;
1448 u_int64_t ibytes, obytes; 1448 u_int64_t ibytes, obytes;
@@ -1764,10 +1764,11 @@ main(int ac, char **av)
1764 sensitive_data.host_keys[i] = key; 1764 sensitive_data.host_keys[i] = key;
1765 sensitive_data.host_pubkeys[i] = pubkey; 1765 sensitive_data.host_pubkeys[i] = pubkey;
1766 1766
1767 if (key == NULL && pubkey != NULL && pubkey->type != KEY_RSA1 && 1767 if (key == NULL && pubkey != NULL && pubkey->type != KEY_RSA1) {
1768 have_agent) { 1768 if (have_agent) {
1769 debug("will rely on agent for hostkey %s", 1769 debug("will rely on agent for hostkey %s",
1770 options.host_key_files[i]); 1770 options.host_key_files[i]);
1771 }
1771 keytype = pubkey->type; 1772 keytype = pubkey->type;
1772 } else if (key != NULL) { 1773 } else if (key != NULL) {
1773 keytype = key->type; 1774 keytype = key->type;
@@ -1788,11 +1789,17 @@ main(int ac, char **av)
1788 case KEY_DSA: 1789 case KEY_DSA:
1789 case KEY_ECDSA: 1790 case KEY_ECDSA:
1790 case KEY_ED25519: 1791 case KEY_ED25519:
1791 sensitive_data.have_ssh2_key = 1; 1792 if (have_agent || key != NULL)
1793 sensitive_data.have_ssh2_key = 1;
1792 break; 1794 break;
1793 } 1795 }
1794 debug("private host key: #%d type %d %s", i, keytype, 1796 if ((fp = sshkey_fingerprint(pubkey, options.fingerprint_hash,
1795 key_type(key ? key : pubkey)); 1797 SSH_FP_DEFAULT)) == NULL)
1798 fatal("sshkey_fingerprint failed");
1799 debug("%s host key #%d: %s %s",
1800 key ? "private" : "public", i, keytype == KEY_RSA1 ?
1801 sshkey_type(pubkey) : sshkey_ssh_name(pubkey), fp);
1802 free(fp);
1796 } 1803 }
1797 if ((options.protocol & SSH_PROTO_1) && !sensitive_data.have_ssh1_key) { 1804 if ((options.protocol & SSH_PROTO_1) && !sensitive_data.have_ssh1_key) {
1798 logit("Disabling protocol version 1. Could not load host key"); 1805 logit("Disabling protocol version 1. Could not load host key");