1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

s4 dns: Implement RFC-compatible update prescan

This commit is contained in:
Kai Blin 2011-12-16 14:07:11 +01:00
parent 02c9e18094
commit c191ad7e13
2 changed files with 41 additions and 6 deletions

View File

@ -105,9 +105,10 @@ interface dns
DNS_QTYPE_NSEC = 0x002F,
DNS_QTYPE_DNSKEY = 0x0030,
DNS_QTYPE_DHCID = 0x0031,
DNS_QTYPE_ALL = 0x00FF,
DNS_QTYPE_WINS = 0xFF01,
DNS_QTYPE_WINSR = 0xFF02
DNS_QTYPE_AXFR = 0x00FC,
DNS_QTYPE_MAILB = 0x00FD,
DNS_QTYPE_MAILA = 0x00FE,
DNS_QTYPE_ALL = 0x00FF
} dns_qtype;
typedef [public] struct {

View File

@ -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);