From: Christopher Faulet Date: Mon, 15 Jun 2026 05:29:23 +0000 (+0200) Subject: BUG/MINOR: mux-h1: Properly resolve file path for 'h1-case-adjust-file' X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82a16a29274b29d51ed18c1f683a7df56fa2a997;p=thirdparty%2Fhaproxy.git BUG/MINOR: mux-h1: Properly resolve file path for 'h1-case-adjust-file' The file specified by 'h1-case-adjust-file' directive is only loaded during post-parsing. However when a relative path is used, the corresponding absoulte path was not resolve during parsing. So the file could be loaded relatively from the wrong location leading to a configuration error. It may happen if several configuration files are used or if several "default-config" are used. The last "default" location was always used. To fix the issue, the absolute path of the file is now resolved when the directive is parsed. This patch should fix the issue #3415. It must be backported to all versions. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index 556250144..41aa3c984 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -5986,7 +5986,24 @@ static int cfg_parse_h1_headers_case_adjust_file(char **args, int section_type, return -1; } free(hdrs_map.name); - hdrs_map.name = strdup(args[1]); + if (args[1][0] != '/') { + char *curpath; + char *fullpath = NULL; + + /* filename is provided using relative path, store the absolute path + * to take current chdir into account for other threads file load + * which occur later + */ + curpath = getcwd(trash.area, trash.size); + if (!curpath) { + memprintf(err, "failed to retrieve cur path"); + return -1; + } + hdrs_map.name = memprintf(&fullpath, "%s/%s", curpath, args[1]); + } + else + hdrs_map.name = strdup(args[1]); + if (!hdrs_map.name) { memprintf(err, "'%s %s' : out of memory", args[0], args[1]); return -1;