diff options
Diffstat (limited to 'kex.c')
-rw-r--r-- | kex.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.c,v 1.153 2019/09/06 01:58:50 djm Exp $ */ | 1 | /* $OpenBSD: kex.c,v 1.154 2019/09/06 14:45:34 naddy Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -213,8 +213,9 @@ kex_names_cat(const char *a, const char *b) | |||
213 | /* | 213 | /* |
214 | * Assemble a list of algorithms from a default list and a string from a | 214 | * Assemble a list of algorithms from a default list and a string from a |
215 | * configuration file. The user-provided string may begin with '+' to | 215 | * configuration file. The user-provided string may begin with '+' to |
216 | * indicate that it should be appended to the default or '-' that the | 216 | * indicate that it should be appended to the default, '-' that the |
217 | * specified names should be removed. | 217 | * specified names should be removed, or '^' that they should be placed |
218 | * at the head. | ||
218 | */ | 219 | */ |
219 | int | 220 | int |
220 | kex_assemble_names(char **listp, const char *def, const char *all) | 221 | kex_assemble_names(char **listp, const char *def, const char *all) |
@@ -251,6 +252,14 @@ kex_assemble_names(char **listp, const char *def, const char *all) | |||
251 | free(list); | 252 | free(list); |
252 | /* filtering has already been done */ | 253 | /* filtering has already been done */ |
253 | return 0; | 254 | return 0; |
255 | } else if (*list == '^') { | ||
256 | /* Place names at head of default list */ | ||
257 | if ((tmp = kex_names_cat(list + 1, def)) == NULL) { | ||
258 | r = SSH_ERR_ALLOC_FAIL; | ||
259 | goto fail; | ||
260 | } | ||
261 | free(list); | ||
262 | list = tmp; | ||
254 | } else { | 263 | } else { |
255 | /* Explicit list, overrides default - just use "list" as is */ | 264 | /* Explicit list, overrides default - just use "list" as is */ |
256 | } | 265 | } |