diff options
author | djm@openbsd.org <djm@openbsd.org> | 2018-08-12 20:19:13 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-08-13 12:42:13 +1000 |
commit | 1b9dd4aa15208100fbc3650f33ea052255578282 (patch) | |
tree | 6b733b4ececbe643a04a405d82c2d2ba86a8d7dd /readconf.c | |
parent | e36a5f61b0f5bebf6d49c215d228cd99dfe86e28 (diff) |
upstream: better diagnosics on alg list assembly errors; ok
deraadt@ markus@
OpenBSD-Commit-ID: 5a557e74b839daf13cc105924d2af06a1560faee
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/readconf.c b/readconf.c index 4b11bab5e..db5f2d547 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.296 2018/07/27 05:34:42 dtucker Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.297 2018/08/12 20:19:13 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 |
@@ -53,6 +53,7 @@ | |||
53 | 53 | ||
54 | #include "xmalloc.h" | 54 | #include "xmalloc.h" |
55 | #include "ssh.h" | 55 | #include "ssh.h" |
56 | #include "ssherr.h" | ||
56 | #include "compat.h" | 57 | #include "compat.h" |
57 | #include "cipher.h" | 58 | #include "cipher.h" |
58 | #include "pathnames.h" | 59 | #include "pathnames.h" |
@@ -1924,6 +1925,7 @@ void | |||
1924 | fill_default_options(Options * options) | 1925 | fill_default_options(Options * options) |
1925 | { | 1926 | { |
1926 | char *all_cipher, *all_mac, *all_kex, *all_key; | 1927 | char *all_cipher, *all_mac, *all_kex, *all_key; |
1928 | int r; | ||
1927 | 1929 | ||
1928 | if (options->forward_agent == -1) | 1930 | if (options->forward_agent == -1) |
1929 | options->forward_agent = 0; | 1931 | options->forward_agent = 0; |
@@ -2075,17 +2077,18 @@ fill_default_options(Options * options) | |||
2075 | all_mac = mac_alg_list(','); | 2077 | all_mac = mac_alg_list(','); |
2076 | all_kex = kex_alg_list(','); | 2078 | all_kex = kex_alg_list(','); |
2077 | all_key = sshkey_alg_list(0, 0, 1, ','); | 2079 | all_key = sshkey_alg_list(0, 0, 1, ','); |
2078 | if (kex_assemble_names(&options->ciphers, | 2080 | #define ASSEMBLE(what, defaults, all) \ |
2079 | KEX_CLIENT_ENCRYPT, all_cipher) != 0 || | 2081 | do { \ |
2080 | kex_assemble_names(&options->macs, | 2082 | if ((r = kex_assemble_names(&options->what, \ |
2081 | KEX_CLIENT_MAC, all_mac) != 0 || | 2083 | defaults, all)) != 0) \ |
2082 | kex_assemble_names(&options->kex_algorithms, | 2084 | fatal("%s: %s: %s", __func__, #what, ssh_err(r)); \ |
2083 | KEX_CLIENT_KEX, all_kex) != 0 || | 2085 | } while (0) |
2084 | kex_assemble_names(&options->hostbased_key_types, | 2086 | ASSEMBLE(ciphers, KEX_SERVER_ENCRYPT, all_cipher); |
2085 | KEX_DEFAULT_PK_ALG, all_key) != 0 || | 2087 | ASSEMBLE(macs, KEX_SERVER_MAC, all_mac); |
2086 | kex_assemble_names(&options->pubkey_key_types, | 2088 | ASSEMBLE(kex_algorithms, KEX_SERVER_KEX, all_kex); |
2087 | KEX_DEFAULT_PK_ALG, all_key) != 0) | 2089 | ASSEMBLE(hostbased_key_types, KEX_DEFAULT_PK_ALG, all_key); |
2088 | fatal("%s: kex_assemble_names failed", __func__); | 2090 | ASSEMBLE(pubkey_key_types, KEX_DEFAULT_PK_ALG, all_key); |
2091 | #undef ASSEMBLE | ||
2089 | free(all_cipher); | 2092 | free(all_cipher); |
2090 | free(all_mac); | 2093 | free(all_mac); |
2091 | free(all_kex); | 2094 | free(all_kex); |