Commit a49c5c22 authored by Simon Kelley's avatar Simon Kelley

Fix search_servers() segfault with DNSSEC.

--address=/example.com/<IP> would segfault if query on example.com
was generated as part of DNSSEC validation.
parent 30858e3b
...@@ -1460,13 +1460,6 @@ void check_servers(void) ...@@ -1460,13 +1460,6 @@ void check_servers(void)
for (sfd = daemon->sfds; sfd; sfd = sfd->next) for (sfd = daemon->sfds; sfd; sfd = sfd->next)
sfd->used = 0; sfd->used = 0;
#ifdef HAVE_DNSSEC
/* Disable DNSSEC validation when using server=/domain/.... servers
unless there's a configured trust anchor. */
for (serv = daemon->servers; serv; serv = serv->next)
serv->flags |= SERV_DO_DNSSEC;
#endif
for (count = 0, serv = daemon->servers; serv; serv = serv->next) for (count = 0, serv = daemon->servers; serv; serv = serv->next)
{ {
if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND))) if (!(serv->flags & (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND)))
...@@ -1478,6 +1471,11 @@ void check_servers(void) ...@@ -1478,6 +1471,11 @@ void check_servers(void)
#ifdef HAVE_DNSSEC #ifdef HAVE_DNSSEC
if (option_bool(OPT_DNSSEC_VALID)) if (option_bool(OPT_DNSSEC_VALID))
{ {
if (!(serv->flags & SERV_FOR_NODOTS))
serv->flags |= SERV_DO_DNSSEC;
/* Disable DNSSEC validation when using server=/domain/.... servers
unless there's a configured trust anchor. */
if (serv->flags & SERV_HAS_DOMAIN) if (serv->flags & SERV_HAS_DOMAIN)
{ {
struct ds_config *ds; struct ds_config *ds;
...@@ -1494,8 +1492,6 @@ void check_servers(void) ...@@ -1494,8 +1492,6 @@ void check_servers(void)
if (!ds) if (!ds)
serv->flags &= ~SERV_DO_DNSSEC; serv->flags &= ~SERV_DO_DNSSEC;
} }
else if (serv->flags & SERV_FOR_NODOTS)
serv->flags &= ~SERV_DO_DNSSEC;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment