Commit d1c759c5 authored by Simon Kelley's avatar Simon Kelley

Answer CNAME queries correctly.

parent e46164e0
...@@ -90,6 +90,9 @@ version 2.61 ...@@ -90,6 +90,9 @@ version 2.61
Updated French translation. Thanks to Gildas Le Nadan. Updated French translation. Thanks to Gildas Le Nadan.
Give correct from-cache answers to explict CNAME queries.
Thanks to Rob Zwissler for spotting this.
version 2.60 version 2.60
Fix compilation problem in Mac OS X Lion. Thanks to Olaf Fix compilation problem in Mac OS X Lion. Thanks to Olaf
......
...@@ -1640,6 +1640,23 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen, ...@@ -1640,6 +1640,23 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
} }
} }
if (qtype == T_CNAME || qtype == T_ANY)
{
if ((crecp = cache_find_by_name(NULL, name, now, F_CNAME)) &&
(qtype == T_CNAME || (crecp->flags & (F_HOSTS | F_DHCP))))
{
ans = 1;
if (!dryrun)
{
log_query(crecp->flags, name, NULL, record_source(crecp->uid));
if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
crec_ttl(crecp, now), &nameoffset,
T_CNAME, C_IN, "d", cache_get_name(crecp->addr.cname.cache)))
anscount++;
}
}
}
if (qtype == T_MX || qtype == T_ANY) if (qtype == T_MX || qtype == T_ANY)
{ {
int found = 0; int found = 0;
......
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