From: William Lallemand Date: Mon, 13 Feb 2023 09:58:13 +0000 (+0100) Subject: MINOR: ssl: rename confusing ssl_bind_kws X-Git-Tag: v2.8-dev5~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af678066518ea5569005b5e43c140a8facb2ee61;p=thirdparty%2Fhaproxy.git MINOR: ssl: rename confusing ssl_bind_kws The ssl_bind_kw structure is exclusively used for crt-list keyword, it must be named otherwise to remove the confusion. The structure was renamed ssl_crtlist_kws. --- diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h index 899c849247..1fe25f59de 100644 --- a/include/haproxy/listener-t.h +++ b/include/haproxy/listener-t.h @@ -262,7 +262,9 @@ struct bind_kw { int (*parse)(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err); int skip; /* nb of args to skip */ }; -struct ssl_bind_kw { + +/* same as bind_kw but for crtlist keywords */ +struct ssl_crtlist_kw { const char *kw; int (*parse)(char **args, int cur_arg, struct proxy *px, struct ssl_bind_conf *conf, int from_cli, char **err); int skip; /* nb of args to skip */ diff --git a/include/haproxy/ssl_sock.h b/include/haproxy/ssl_sock.h index db93d96a22..d118331f9e 100644 --- a/include/haproxy/ssl_sock.h +++ b/include/haproxy/ssl_sock.h @@ -37,7 +37,7 @@ extern struct eb_root crtlists_tree; extern struct eb_root cafile_tree; extern int sctl_ex_index; extern struct global_ssl global_ssl; -extern struct ssl_bind_kw ssl_bind_kws[]; +extern struct ssl_crtlist_kw ssl_crtlist_kws[]; extern struct methodVersions methodVersions[]; __decl_thread(extern HA_SPINLOCK_T ckch_lock); extern struct pool_head *pool_head_ssl_capture; diff --git a/src/cfgparse-ssl.c b/src/cfgparse-ssl.c index 75af0e838b..655115f525 100644 --- a/src/cfgparse-ssl.c +++ b/src/cfgparse-ssl.c @@ -1917,9 +1917,9 @@ static int ssl_parse_skip_self_issued_ca(char **args, int section_type, struct p * not enabled. */ -/* the keywords are used for crt-list parsing, they *MUST* be safe +/* the keywords are used for crt-list parsing, they *MUST* be safe * with their proxy argument NULL and must only fill the ssl_bind_conf */ -struct ssl_bind_kw ssl_bind_kws[] = { +struct ssl_crtlist_kw ssl_crtlist_kws[] = { { "allow-0rtt", ssl_bind_parse_allow_0rtt, 0 }, /* allow 0-RTT */ { "alpn", ssl_bind_parse_alpn, 1 }, /* set ALPN supported protocols */ { "ca-file", ssl_bind_parse_ca_file, 1 }, /* set CAfile to process ca-names and verify on client cert */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 60d007b478..f4041157f6 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -4742,13 +4742,13 @@ void cfg_dump_registered_keywords() extern struct list tcp_req_conn_keywords, tcp_req_sess_keywords, tcp_req_cont_keywords, tcp_res_cont_keywords; extern struct bind_kw_list bind_keywords; - extern struct ssl_bind_kw ssl_bind_kws[] __maybe_unused; + extern struct ssl_crtlist_kw ssl_crtlist_kws[] __maybe_unused; extern struct srv_kw_list srv_keywords; struct bind_kw_list *bkwl; struct srv_kw_list *skwl; const struct bind_kw *bkwp, *bkwn; const struct srv_kw *skwp, *skwn; - const struct ssl_bind_kw *sbkwp __maybe_unused, *sbkwn __maybe_unused; + const struct ssl_crtlist_kw *sbkwp __maybe_unused, *sbkwn __maybe_unused; const struct cfg_opt *coptp, *coptn; for (bkwn = bkwp = NULL;; bkwp = bkwn) { @@ -4770,11 +4770,11 @@ void cfg_dump_registered_keywords() #if defined(USE_OPENSSL) for (sbkwn = sbkwp = NULL;; sbkwp = sbkwn) { - for (index = 0; ssl_bind_kws[index].kw != NULL; index++) { + for (index = 0; ssl_crtlist_kws[index].kw != NULL; index++) { if (strordered(sbkwp ? sbkwp->kw : NULL, - ssl_bind_kws[index].kw, + ssl_crtlist_kws[index].kw, sbkwn != sbkwp ? sbkwn->kw : NULL)) - sbkwn = &ssl_bind_kws[index]; + sbkwn = &ssl_crtlist_kws[index]; } if (sbkwn == sbkwp) break; diff --git a/src/ssl_crtlist.c b/src/ssl_crtlist.c index 2675703a41..aa7fdb2edb 100644 --- a/src/ssl_crtlist.c +++ b/src/ssl_crtlist.c @@ -420,17 +420,17 @@ int crtlist_parse_line(char *line, char **crt_path, struct crtlist_entry *entry, cur_arg = ssl_b ? ssl_b : 1; while (cur_arg < ssl_e) { newarg = 0; - for (i = 0; ssl_bind_kws[i].kw != NULL; i++) { - if (strcmp(ssl_bind_kws[i].kw, args[cur_arg]) == 0) { + for (i = 0; ssl_crtlist_kws[i].kw != NULL; i++) { + if (strcmp(ssl_crtlist_kws[i].kw, args[cur_arg]) == 0) { newarg = 1; - cfgerr |= ssl_bind_kws[i].parse(args, cur_arg, NULL, ssl_conf, from_cli, err); - if (cur_arg + 1 + ssl_bind_kws[i].skip > ssl_e) { + cfgerr |= ssl_crtlist_kws[i].parse(args, cur_arg, NULL, ssl_conf, from_cli, err); + if (cur_arg + 1 + ssl_crtlist_kws[i].skip > ssl_e) { memprintf(err, "parsing [%s:%d]: ssl args out of '[]' for %s", file, linenum, args[cur_arg]); cfgerr |= ERR_ALERT | ERR_FATAL; goto error; } - cur_arg += 1 + ssl_bind_kws[i].skip; + cur_arg += 1 + ssl_crtlist_kws[i].skip; break; } }