]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: dont return immediately from parse_server() when skipping checks
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 7 Mar 2025 08:11:21 +0000 (09:11 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Fri, 7 Mar 2025 08:39:46 +0000 (09:39 +0100)
If parse_server() is called under peers section parser, and the address
needs to be parsed but it is missing, we directly return from the function

However since 0fc136ce5b ("REORG: server: use parsing ctx for server
parsing"), parse_server() uses parsing ctx to emit warning/errors, and
the ctx must be reset before returning from the function, yet this early
return was overlooked. Because of that, any ha_{warning,alert..} message
reported after early return from parse_server() could cause messages to
have an extra "parsing [file:line]" info.

We fix that by ensuring parse_server() doesn't return without resetting
the parsing context.

It should be backported up to 2.6

src/server.c

index 26ef58f4d87c76fe8eb25ada92b85d0b42b03fe4..051dd984a3f46a6a975f499cef73c3f38a848186 100644 (file)
@@ -3758,7 +3758,7 @@ int parse_server(const char *file, int linenum, char **args,
        if ((parse_flags & (SRV_PARSE_IN_PEER_SECTION|SRV_PARSE_PARSE_ADDR)) ==
            (SRV_PARSE_IN_PEER_SECTION|SRV_PARSE_PARSE_ADDR)) {
                if (!*args[2])
-                       return 0;
+                       goto out;
        }
 
        err_code = _srv_parse_init(&newsrv, args, &cur_arg, curproxy,