resolved: when validating an RRset, store information about the synthesizing source and zone in each RR
Having this information available is useful when we need to check whether various RRs are suitable for proofs. This information is stored in the RRs as number of labels to skip from the beginning of the owner name to reach the synthesizing source/signer. Simple accessor calls are then added to retrieve the signer/source from the RR using this information. This also moves validation of a a number of RRSIG parameters into a new call dnssec_rrsig_prepare() that as side-effect initializes the two numeric values.
This commit is contained in:
+23
-8
@@ -1189,6 +1189,26 @@ int dns_name_suffix(const char *name, unsigned n_labels, const char **ret) {
|
||||
return (int) (n - n_labels);
|
||||
}
|
||||
|
||||
int dns_name_skip(const char *a, unsigned n_labels, const char **ret) {
|
||||
int r;
|
||||
|
||||
assert(a);
|
||||
assert(ret);
|
||||
|
||||
for (; n_labels > 0; n_labels --) {
|
||||
r = dns_name_parent(&a);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0) {
|
||||
*ret = "";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*ret = a;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int dns_name_count_labels(const char *name) {
|
||||
unsigned n = 0;
|
||||
const char *p;
|
||||
@@ -1219,14 +1239,9 @@ int dns_name_equal_skip(const char *a, unsigned n_labels, const char *b) {
|
||||
assert(a);
|
||||
assert(b);
|
||||
|
||||
while (n_labels > 0) {
|
||||
|
||||
r = dns_name_parent(&a);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
n_labels --;
|
||||
}
|
||||
r = dns_name_skip(a, n_labels, &a);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
return dns_name_equal(a, b);
|
||||
}
|
||||
|
||||
@@ -104,4 +104,5 @@ int dns_service_split(const char *joined, char **name, char **type, char **domai
|
||||
int dns_name_suffix(const char *name, unsigned n_labels, const char **ret);
|
||||
int dns_name_count_labels(const char *name);
|
||||
|
||||
int dns_name_skip(const char *a, unsigned n_labels, const char **ret);
|
||||
int dns_name_equal_skip(const char *a, unsigned n_labels, const char *b);
|
||||
|
||||
Reference in New Issue
Block a user