summaryrefslogtreecommitdiffstats
path: root/source4/dns_server/dns_query.c
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2014-02-27 23:49:24 +0100
committerKai Blin <kai@samba.org>2014-03-04 13:46:34 +0100
commitd9829df13317b38677d92a499134727ab31fbb0e (patch)
tree5e9b59ab6615bdbb14260b742e0618cc22e15912 /source4/dns_server/dns_query.c
parent6f092cfd878a16db276238444f41d6218e66d12a (diff)
downloadsamba-d9829df13317b38677d92a499134727ab31fbb0e.tar.gz
samba-d9829df13317b38677d92a499134727ab31fbb0e.tar.xz
samba-d9829df13317b38677d92a499134727ab31fbb0e.zip
bug #10471: Don't respond with NXDOMAIN to records that exist with another type
DNS queries for records with the wrong type need to trigger an empty response with RCODE_OK instead of returning NXDOMAIN. This adds a test and fixes bug #10471 Signed-off-by: Kai Blin <kai@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dns_server/dns_query.c')
-rw-r--r--source4/dns_server/dns_query.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c
index 5414e1d9ee4..77f797bf5b2 100644
--- a/source4/dns_server/dns_query.c
+++ b/source4/dns_server/dns_query.c
@@ -258,7 +258,7 @@ static WERROR handle_question(struct dns_server *dns,
struct dns_res_rec **answers, uint16_t *ancount)
{
struct dns_res_rec *ans = *answers;
- WERROR werror;
+ WERROR werror, werror_return;
unsigned int ri;
struct dnsp_DnssrvRpcRecord *recs;
uint16_t rec_count, ai = *ancount;
@@ -275,6 +275,9 @@ static WERROR handle_question(struct dns_server *dns,
return WERR_NOMEM;
}
+ /* Set up for an NXDOMAIN reply if no match is found */
+ werror_return = DNS_ERR(NAME_ERROR);
+
for (ri = 0; ri < rec_count; ri++) {
if ((recs[ri].wType == DNS_TYPE_CNAME) &&
((question->question_type == DNS_QTYPE_A) ||
@@ -319,28 +322,27 @@ static WERROR handle_question(struct dns_server *dns,
if (!W_ERROR_IS_OK(werror)) {
return werror;
}
+ werror_return = WERR_OK;
continue;
}
if ((question->question_type != DNS_QTYPE_ALL) &&
(recs[ri].wType != question->question_type)) {
+ werror_return = WERR_OK;
continue;
}
werror = create_response_rr(question, &recs[ri], &ans, &ai);
if (!W_ERROR_IS_OK(werror)) {
return werror;
}
- }
-
- if (ai == 0) {
- return DNS_ERR(NAME_ERROR);
+ werror_return = WERR_OK;
}
*ancount = ai;
*answers = ans;
- return WERR_OK;
+ return werror_return;
}
static NTSTATUS create_tkey(struct dns_server *dns,