diff options
-rw-r--r-- | sshd.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshd.c,v 1.556 2020/06/05 06:18:07 djm Exp $ */ | 1 | /* $OpenBSD: sshd.c,v 1.557 2020/06/18 23:34:19 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 |
@@ -1849,10 +1849,19 @@ main(int ac, char **av) | |||
1849 | &pubkey, NULL)) != 0 && r != SSH_ERR_SYSTEM_ERROR) | 1849 | &pubkey, NULL)) != 0 && r != SSH_ERR_SYSTEM_ERROR) |
1850 | do_log2(ll, "Unable to load host key \"%s\": %s", | 1850 | do_log2(ll, "Unable to load host key \"%s\": %s", |
1851 | options.host_key_files[i], ssh_err(r)); | 1851 | options.host_key_files[i], ssh_err(r)); |
1852 | if (pubkey == NULL && key != NULL) | 1852 | if (pubkey != NULL && key != NULL) { |
1853 | if (!sshkey_equal(pubkey, key)) { | ||
1854 | error("Public key for %s does not match " | ||
1855 | "private key", options.host_key_files[i]); | ||
1856 | sshkey_free(pubkey); | ||
1857 | pubkey = NULL; | ||
1858 | } | ||
1859 | } | ||
1860 | if (pubkey == NULL && key != NULL) { | ||
1853 | if ((r = sshkey_from_private(key, &pubkey)) != 0) | 1861 | if ((r = sshkey_from_private(key, &pubkey)) != 0) |
1854 | fatal("Could not demote key: \"%s\": %s", | 1862 | fatal("Could not demote key: \"%s\": %s", |
1855 | options.host_key_files[i], ssh_err(r)); | 1863 | options.host_key_files[i], ssh_err(r)); |
1864 | } | ||
1856 | sensitive_data.host_keys[i] = key; | 1865 | sensitive_data.host_keys[i] = key; |
1857 | sensitive_data.host_pubkeys[i] = pubkey; | 1866 | sensitive_data.host_pubkeys[i] = pubkey; |
1858 | 1867 | ||