summaryrefslogtreecommitdiffstats
path: root/source4/dns_server/dns_query.c
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2011-09-26 22:31:46 -0700
committerKai Blin <kai@samba.org>2011-09-28 03:37:22 +0200
commit1210b8abe73f39f85f363cbbfa2a990e2ccd4517 (patch)
tree331a4bb89f4ce7031350e7f3eff9556ff5b5bce7 /source4/dns_server/dns_query.c
parentf98ebcf43f9b77266ef900a12b019f62d107096a (diff)
downloadsamba-1210b8abe73f39f85f363cbbfa2a990e2ccd4517.tar.gz
samba-1210b8abe73f39f85f363cbbfa2a990e2ccd4517.tar.xz
samba-1210b8abe73f39f85f363cbbfa2a990e2ccd4517.zip
dns: Do as BIND and MS DNS and drop quries with qdcount != 1
Autobuild-User: Kai Blin <kai@samba.org> Autobuild-Date: Wed Sep 28 03:37:22 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4/dns_server/dns_query.c')
-rw-r--r--source4/dns_server/dns_query.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c
index d96877e9bd..2153ad9245 100644
--- a/source4/dns_server/dns_query.c
+++ b/source4/dns_server/dns_query.c
@@ -206,17 +206,19 @@ WERROR dns_server_process_query(struct dns_server *dns,
struct dns_res_rec **nsrecs, uint16_t *nscount,
struct dns_res_rec **additional, uint16_t *arcount)
{
- uint16_t i, num_answers=0;
+ uint16_t num_answers=0;
struct dns_res_rec *ans=NULL;
WERROR werror;
+ if (in->qdcount != 1) {
+ return DNS_ERR(FORMAT_ERROR);
+ }
+
ans = talloc_array(mem_ctx, struct dns_res_rec, 0);
W_ERROR_HAVE_NO_MEMORY(ans);
- for (i = 0; i < in->qdcount; ++i) {
- werror = handle_question(dns, mem_ctx, &in->questions[i], &ans, &num_answers);
- W_ERROR_NOT_OK_RETURN(werror);
- }
+ werror = handle_question(dns, mem_ctx, &in->questions[0], &ans, &num_answers);
+ W_ERROR_NOT_OK_GOTO(werror, query_failed);
*answers = ans;
*ancount = num_answers;
@@ -229,4 +231,8 @@ WERROR dns_server_process_query(struct dns_server *dns,
*arcount = 0;
return WERR_OK;
+
+query_failed:
+ /*FIXME: add our SOA record to nsrecs */
+ return werror;
}