mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-24 00:29:58 -05:00
Fix validation of queries with wildcard names (*.example).
git-svn-id: file:///svn/unbound/trunk@2070 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
553e2de09b
commit
bec7e7a552
1 changed files with 11 additions and 4 deletions
|
|
@ -558,7 +558,8 @@ val_rrset_wildcard(struct ub_packed_rrset_key* rrset, uint8_t** wc)
|
||||||
entry.data;
|
entry.data;
|
||||||
uint8_t labcount;
|
uint8_t labcount;
|
||||||
int labdiff;
|
int labdiff;
|
||||||
size_t i;
|
uint8_t* wn;
|
||||||
|
size_t i, wl;
|
||||||
if(d->rrsig_count == 0) {
|
if(d->rrsig_count == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -573,10 +574,16 @@ val_rrset_wildcard(struct ub_packed_rrset_key* rrset, uint8_t** wc)
|
||||||
/* if the RRSIG label count is shorter than the number of actual
|
/* if the RRSIG label count is shorter than the number of actual
|
||||||
* labels, then this rrset was synthesized from a wildcard.
|
* labels, then this rrset was synthesized from a wildcard.
|
||||||
* Note that the RRSIG label count doesn't count the root label. */
|
* Note that the RRSIG label count doesn't count the root label. */
|
||||||
labdiff = (dname_count_labels(rrset->rk.dname) - 1) - (int)labcount;
|
wn = rrset->rk.dname;
|
||||||
|
wl = rrset->rk.dname_len;
|
||||||
|
/* skip a leading wildcard label in the dname (RFC4035 2.2) */
|
||||||
|
if(dname_is_wild(wn)) {
|
||||||
|
wn += 2;
|
||||||
|
wl -= 2;
|
||||||
|
}
|
||||||
|
labdiff = (dname_count_labels(wn) - 1) - (int)labcount;
|
||||||
if(labdiff > 0) {
|
if(labdiff > 0) {
|
||||||
size_t wl = rrset->rk.dname_len;
|
*wc = wn;
|
||||||
*wc = rrset->rk.dname;
|
|
||||||
dname_remove_labels(wc, &wl, labdiff);
|
dname_remove_labels(wc, &wl, labdiff);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue