BUG/MAJOR: resolvers: segfault using server template without SRV RECORDs
This patch fix the issue adding a test in srvrq before registering
the server on it during server template init.
This was a regression due to commit :
3406766d57fc11478d54a6fa2d048cbfe4524a4e
This should be backported with this previous commit (until 2.0)
(cherry picked from commit caef19e0c7594b00aa341d8984a33ddd0f15113f)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 3ecaf53374306519ff4394a7e7eebfe05235b9d6)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/server.c b/src/server.c
index b30c4e9..eca38ad 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1892,7 +1892,8 @@
}
#endif
/* append to list of servers available to receive an hostname */
- LIST_ADDQ(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item);
+ if (newsrv->srvrq)
+ LIST_ADDQ(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item);
/* Set this new server ID. */
srv_set_id_from_prefix(newsrv, srv->tmpl_info.prefix, i);