summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-08-12 20:19:13 +0000
committerDamien Miller <djm@mindrot.org>2018-08-13 12:42:13 +1000
commit1b9dd4aa15208100fbc3650f33ea052255578282 (patch)
tree6b733b4ececbe643a04a405d82c2d2ba86a8d7dd /servconf.c
parente36a5f61b0f5bebf6d49c215d228cd99dfe86e28 (diff)
upstream: better diagnosics on alg list assembly errors; ok
deraadt@ markus@ OpenBSD-Commit-ID: 5a557e74b839daf13cc105924d2af06a1560faee
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/servconf.c b/servconf.c
index f1010b3b9..c0f6af0be 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
1 1
2/* $OpenBSD: servconf.c,v 1.339 2018/07/11 18:53:29 markus Exp $ */ 2/* $OpenBSD: servconf.c,v 1.340 2018/08/12 20:19:13 djm Exp $ */
3/* 3/*
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved 5 * All rights reserved
@@ -192,24 +192,24 @@ static void
192assemble_algorithms(ServerOptions *o) 192assemble_algorithms(ServerOptions *o)
193{ 193{
194 char *all_cipher, *all_mac, *all_kex, *all_key; 194 char *all_cipher, *all_mac, *all_kex, *all_key;
195 int r;
195 196
196 all_cipher = cipher_alg_list(',', 0); 197 all_cipher = cipher_alg_list(',', 0);
197 all_mac = mac_alg_list(','); 198 all_mac = mac_alg_list(',');
198 all_kex = kex_alg_list(','); 199 all_kex = kex_alg_list(',');
199 all_key = sshkey_alg_list(0, 0, 1, ','); 200 all_key = sshkey_alg_list(0, 0, 1, ',');
200 if (kex_assemble_names(&o->ciphers, 201#define ASSEMBLE(what, defaults, all) \
201 KEX_SERVER_ENCRYPT, all_cipher) != 0 || 202 do { \
202 kex_assemble_names(&o->macs, 203 if ((r = kex_assemble_names(&o->what, defaults, all)) != 0) \
203 KEX_SERVER_MAC, all_mac) != 0 || 204 fatal("%s: %s: %s", __func__, #what, ssh_err(r)); \
204 kex_assemble_names(&o->kex_algorithms, 205 } while (0)
205 KEX_SERVER_KEX, all_kex) != 0 || 206 ASSEMBLE(ciphers, KEX_SERVER_ENCRYPT, all_cipher);
206 kex_assemble_names(&o->hostkeyalgorithms, 207 ASSEMBLE(macs, KEX_SERVER_MAC, all_mac);
207 KEX_DEFAULT_PK_ALG, all_key) != 0 || 208 ASSEMBLE(kex_algorithms, KEX_SERVER_KEX, all_kex);
208 kex_assemble_names(&o->hostbased_key_types, 209 ASSEMBLE(hostkeyalgorithms, KEX_DEFAULT_PK_ALG, all_key);
209 KEX_DEFAULT_PK_ALG, all_key) != 0 || 210 ASSEMBLE(hostbased_key_types, KEX_DEFAULT_PK_ALG, all_key);
210 kex_assemble_names(&o->pubkey_key_types, 211 ASSEMBLE(pubkey_key_types, KEX_DEFAULT_PK_ALG, all_key);
211 KEX_DEFAULT_PK_ALG, all_key) != 0) 212#undef ASSEMBLE
212 fatal("kex_assemble_names failed");
213 free(all_cipher); 213 free(all_cipher);
214 free(all_mac); 214 free(all_mac);
215 free(all_kex); 215 free(all_kex);