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 :
3406766d57

This should be backported with this previous commit (until 2.0)
This commit is contained in:
Emeric Brun 2021-06-14 10:02:18 +02:00 committed by Christopher Faulet
parent b89c0e4635
commit caef19e0c7
1 changed files with 2 additions and 1 deletions

View File

@ -2306,7 +2306,8 @@ static int _srv_parse_tmpl_init(struct server *srv, struct proxy *px)
}
#endif
/* append to list of servers available to receive an hostname */
LIST_APPEND(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item);
if (newsrv->srvrq)
LIST_APPEND(&newsrv->srvrq->attached_servers, &newsrv->srv_rec_item);
/* Set this new server ID. */
_srv_parse_set_id_from_prefix(newsrv, srv->tmpl_info.prefix, i);