BUG/MINOR: ech: non destructive parsing in cli_find_ech_specific_ctx()

cli_find_ech_specific_ctx() parses the <frontend>/<bind_conf> and sets
 a \0 in place the '/'. But the originals tring is still used to emit
 messages in the CLI so we only output the frontend part.

 This patch do the parsing in a trash buffer instead.
This commit is contained in:
William Lallemand 2025-10-30 11:54:49 +01:00
parent 37f76c45fa
commit f6503bd7d3

View File

@ -84,25 +84,27 @@ end:
return rv; return rv;
} }
/* /* find a named SSL_CTX, returns 1 if found
*
* <name> should be in the format "frontend/@<filename>:<linenum>" * <name> should be in the format "frontend/@<filename>:<linenum>"
* Example: * Example:
* "http1/@haproxy.cfg:1234" * "http1/@haproxy.cfg:1234"
*
*/ */
static int cli_find_ech_specific_ctx(const char *name, SSL_CTX **sctx)
/* find a named SSL_CTX, returns 1 if found */
static int cli_find_ech_specific_ctx(char *name, SSL_CTX **sctx)
{ {
struct proxy *p; struct proxy *p;
struct bind_conf *bind_conf; struct bind_conf *bind_conf;
char *pname; /* proxy name */ char *pname; /* proxy name */
char *bname; /* bind_name */ char *bname; /* bind_name */
struct buffer *tmp = get_trash_chunk();
if (!name || !sctx) if (!name || !sctx)
return 0; return 0;
for (pname = bname = name; *bname != '\0' && *bname != '/'; bname++)
b_putblk(tmp, name, strlen(name) + 1);
for (pname = bname = tmp->area; *bname != '\0' && *bname != '/'; bname++)
; ;
if (*bname) { if (*bname) {