]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: missing default server 'resolvers' setting duplication.
authorFrédéric Lécaille <flecaille@haproxy.com>
Thu, 20 Apr 2017 10:17:50 +0000 (12:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 21 Apr 2017 13:42:09 +0000 (15:42 +0200)
'resolvers' setting was not duplicated from default server setting to
new server instances when parsing 'server' lines.
This fix is simple: strdup() default resolvers <id> string argument after
having allocated a new server when parsing 'server' lines.

This patch must be backported to 1.7 and 1.6.

src/server.c

index a151fd4cfc010296f1d7501e008c6d7176f05836..63569cf04eba8e6f140dd3149649a5d833fb7321 100644 (file)
@@ -1813,6 +1813,8 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
                        newsrv->agent.fall      = curproxy->defsrv.agent.fall;
                        newsrv->agent.health    = newsrv->agent.rise;   /* up, but will fall down at first failure */
                        newsrv->agent.server    = newsrv;
+                       if (curproxy->defsrv.resolvers_id != NULL)
+                               newsrv->resolvers_id = strdup(curproxy->defsrv.resolvers_id);
                        newsrv->dns_opts.family_prio = curproxy->defsrv.dns_opts.family_prio;
                        if (newsrv->dns_opts.family_prio == AF_UNSPEC)
                                newsrv->dns_opts.family_prio = AF_INET6;
@@ -1939,6 +1941,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
                                cur_arg += 2;
                        }
                        else if (!strcmp(args[cur_arg], "resolvers")) {
+                               free(newsrv->resolvers_id);
                                newsrv->resolvers_id = strdup(args[cur_arg + 1]);
                                cur_arg += 2;
                        }