diff options
author | djm@openbsd.org <djm@openbsd.org> | 2018-08-12 22:19:13 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-08-13 04:42:13 +0200 |
commit | 1b9dd4aa15208100fbc3650f33ea052255578282 (patch) | |
tree | 6b733b4ececbe643a04a405d82c2d2ba86a8d7dd /readconf.c | |
parent | Some AIX fixes; report from Michael Felt (diff) | |
download | openssh-1b9dd4aa15208100fbc3650f33ea052255578282.tar.xz openssh-1b9dd4aa15208100fbc3650f33ea052255578282.zip |
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 @@ -/* $OpenBSD: readconf.c,v 1.296 2018/07/27 05:34:42 dtucker Exp $ */ +/* $OpenBSD: readconf.c,v 1.297 2018/08/12 20:19:13 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -53,6 +53,7 @@ #include "xmalloc.h" #include "ssh.h" +#include "ssherr.h" #include "compat.h" #include "cipher.h" #include "pathnames.h" @@ -1924,6 +1925,7 @@ void fill_default_options(Options * options) { char *all_cipher, *all_mac, *all_kex, *all_key; + int r; if (options->forward_agent == -1) options->forward_agent = 0; @@ -2075,17 +2077,18 @@ fill_default_options(Options * options) all_mac = mac_alg_list(','); all_kex = kex_alg_list(','); all_key = sshkey_alg_list(0, 0, 1, ','); - if (kex_assemble_names(&options->ciphers, - KEX_CLIENT_ENCRYPT, all_cipher) != 0 || - kex_assemble_names(&options->macs, - KEX_CLIENT_MAC, all_mac) != 0 || - kex_assemble_names(&options->kex_algorithms, - KEX_CLIENT_KEX, all_kex) != 0 || - kex_assemble_names(&options->hostbased_key_types, - KEX_DEFAULT_PK_ALG, all_key) != 0 || - kex_assemble_names(&options->pubkey_key_types, - KEX_DEFAULT_PK_ALG, all_key) != 0) - fatal("%s: kex_assemble_names failed", __func__); +#define ASSEMBLE(what, defaults, all) \ + do { \ + if ((r = kex_assemble_names(&options->what, \ + defaults, all)) != 0) \ + fatal("%s: %s: %s", __func__, #what, ssh_err(r)); \ + } while (0) + ASSEMBLE(ciphers, KEX_SERVER_ENCRYPT, all_cipher); + ASSEMBLE(macs, KEX_SERVER_MAC, all_mac); + ASSEMBLE(kex_algorithms, KEX_SERVER_KEX, all_kex); + ASSEMBLE(hostbased_key_types, KEX_DEFAULT_PK_ALG, all_key); + ASSEMBLE(pubkey_key_types, KEX_DEFAULT_PK_ALG, all_key); +#undef ASSEMBLE free(all_cipher); free(all_mac); free(all_kex); |