From daa2fe662116e0741d16c9deb6825773abb0bff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=E9d=E9ric=20L=E9caille?= Date: Thu, 20 Apr 2017 12:17:50 +0200 Subject: [PATCH] BUG/MINOR: server: missing default server 'resolvers' setting duplication. 'resolvers' setting was not duplicated from default server setting to new server instances when parsing 'server' lines. This fix is simple: strdup() default resolvers 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server.c b/src/server.c index a151fd4cf..63569cf04 100644 --- a/src/server.c +++ b/src/server.c @@ -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; }