From: William Lallemand Date: Fri, 9 May 2025 17:18:38 +0000 (+0200) Subject: MINOR: ssl/ckch: warn when the same keyword was used twice X-Git-Tag: v3.2-dev16~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b0d1a41136dede6b414b2432ecdcbfc821b37e0;p=thirdparty%2Fhaproxy.git MINOR: ssl/ckch: warn when the same keyword was used twice When using a crt-list or a crt-store, keywords mentionned twice on the same line overwritte the previous value. This patch emits a warning when the same keyword is found another time on the same line. --- diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c index a2e96dd36..57f1c3e91 100644 --- a/src/ssl_ckch.c +++ b/src/ssl_ckch.c @@ -4870,7 +4870,12 @@ int ckch_conf_parse(char **args, int cur_arg, struct ckch_conf *f, int *found, c if (ckch_conf_kws[i].type == PARSE_TYPE_STR) { char **t = target; - ha_free(t); + if (*t) { + ha_free(t); + memprintf(err, "'%s' already specified, overwriting.", ckch_conf_kws[i].name); + err_code |= ERR_WARN; + } + *t = strdup(args[cur_arg + 1]); if (!*t) { ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum); @@ -4884,7 +4889,11 @@ int ckch_conf_parse(char **args, int cur_arg, struct ckch_conf *f, int *found, c char *b, *e; /* split a string into substring split by colons */ - ha_freearray(t); + if (*t) { + ha_freearray(t); + memprintf(err, "'%s' already specified, overwriting.", ckch_conf_kws[i].name); + err_code |= ERR_WARN; + } e = b = args[cur_arg + 1]; do { while (*e != ',' && *e != '\0')