- xfr-tsig, fix notify tsig answer, fix parse edns allows TSIG,

unit test for auth zone with notify with tsig and notify answer with tsig.
This commit is contained in:
W.C.A. Wijngaards
2025-09-11 16:21:38 +02:00
parent bebd6c0f96
commit 64e102aacb
3 changed files with 152 additions and 4 deletions
+26 -4
View File
@@ -1282,10 +1282,32 @@ parse_edns_from_query_pkt(sldns_buffer* pkt, struct edns_data* edns,
return LDNS_RCODE_FORMERR;
}
/* check edns section is present */
if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) > 1) {
return LDNS_RCODE_FORMERR;
}
if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) == 0) {
if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) > 0) {
int i, edns_found = 0;
for(i=0; i<(int)LDNS_ARCOUNT(sldns_buffer_begin(pkt)); i++) {
if(sldns_buffer_remaining(pkt) < 1)
return LDNS_RCODE_FORMERR;
if(sldns_buffer_current(pkt)[0] == 0) {
/* The domain name is the root of length 1. */
/* See if the RR Type is OPT. */
if(sldns_buffer_remaining(pkt) < 3)
return LDNS_RCODE_FORMERR;
if(sldns_buffer_read_u16_at(pkt,
sldns_buffer_position(pkt)+1) ==
LDNS_RR_TYPE_OPT) {
/* This is the EDNS OPT record */
edns_found = 1;
break;
}
}
if(!skip_pkt_rrs(pkt, 1))
return LDNS_RCODE_FORMERR;
}
if(!edns_found) {
edns->udp_size = 512;
return 0;
}
} else if(LDNS_ARCOUNT(sldns_buffer_begin(pkt)) == 0) {
edns->udp_size = 512;
return 0;
}