]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: server: Fix server-template with default-server
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 28 Aug 2026 15:04:51 +0000 (17:04 +0200)
committerOlivier Houchard <cognet@ci0.org>
Fri, 28 Aug 2026 15:02:54 +0000 (17:02 +0200)
Commit c81044a8b moved the call for srv_settings_cpy() from
_srv_parse_init() to parse_server(), but in doing so, it will use 1 as
the last argument if the new server is a server template. This is,
however, wrong, srv_settings_cpy() expect 1 if the source is a
server template, not the destination. Doing that will lead to an
uninitialized server, if there were settings to copy from another
server.
This fixes using server templates with default-server.

src/server.c

index c7ed32d772f49a41bf2603fa02b76e169a8415c0..f8fa20cb85a561e229a891385bd77d86f7f48962 100644 (file)
@@ -4317,7 +4317,7 @@ int parse_server(const char *file, int linenum, char **args,
 
        if (newsrv != from) {
                /* This will copy <from> settings or init them if NULL. */
-               srv_settings_cpy(newsrv, from, !!(parse_flags & SRV_PARSE_TEMPLATE));
+               srv_settings_cpy(newsrv, from, 0);
        }
 
        if (!newsrv->conf.file) // note: do it only once for default-server