diff options
author | Kai Blin <kai@samba.org> | 2011-12-16 14:07:11 +0100 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2011-12-17 02:46:08 +0100 |
commit | c191ad7e130c637faef23e7cec9d37c097da5a8b (patch) | |
tree | 109fb45e8ee1a3416a645413889c87abf6b81805 /source4/dns_server | |
parent | 02c9e18094f68d9014fe56c4d1b1c51fd22bd1b5 (diff) | |
download | samba-c191ad7e130c637faef23e7cec9d37c097da5a8b.tar.gz samba-c191ad7e130c637faef23e7cec9d37c097da5a8b.tar.bz2 samba-c191ad7e130c637faef23e7cec9d37c097da5a8b.zip |
s4 dns: Implement RFC-compatible update prescan
Diffstat (limited to 'source4/dns_server')
-rw-r--r-- | source4/dns_server/dns_update.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c index 5b87e9f669..397384421c 100644 --- a/source4/dns_server/dns_update.c +++ b/source4/dns_server/dns_update.c @@ -227,16 +227,48 @@ static WERROR update_prescan(const struct dns_name_question *zone, return DNS_ERR(NOTZONE); } if (zone->question_class == r->rr_class) { - /*TODO: also check for AXFR,MAILA,MAILB */ if (r->rr_type == DNS_QTYPE_ALL) { return DNS_ERR(FORMAT_ERROR); } + if (r->rr_type == DNS_QTYPE_AXFR) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_MAILB) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_MAILA) { + return DNS_ERR(FORMAT_ERROR); + } } else if (r->rr_class == DNS_QCLASS_ANY) { - if (r->ttl != 0 || r->length != 0) { + if (r->ttl != 0) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->length != 0) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_AXFR) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_MAILB) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_MAILA) { return DNS_ERR(FORMAT_ERROR); } } else if (r->rr_class == DNS_QCLASS_NONE) { - if (r->ttl != 0 || r->rr_type == DNS_QTYPE_ALL) { + if (r->ttl != 0) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_ALL) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_AXFR) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_MAILB) { + return DNS_ERR(FORMAT_ERROR); + } + if (r->rr_type == DNS_QTYPE_MAILA) { return DNS_ERR(FORMAT_ERROR); } } else { @@ -373,6 +405,8 @@ WERROR dns_server_process_update(struct dns_server *dns, return DNS_ERR(REFUSED); } + *update_count = in->nscount; + *updates = in->nsrecs; werror = update_prescan(in->questions, *updates, *update_count); W_ERROR_NOT_OK_RETURN(werror); |