]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
added DS validating function for use in secure tracing
authorMiek Gieben <miekg@NLnetLabs.nl>
Wed, 24 May 2006 11:20:05 +0000 (11:20 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Wed, 24 May 2006 11:20:05 +0000 (11:20 +0000)
drill/securetrace.c

index 6d2c08ba4d72705cf3988479b517c92570c2e2d5..889d386ccca3b6028590cbe3ab97e82cdd18dd16 100644 (file)
 
 #define VAL " [VALIDATED]" 
 
+
+/* See if there is a key/ds in trusted that matches
+ * a ds in *ds. If so, we have a trusted path. If 
+ * not something is the matter
+ */
+ldns_rr_list *
+ds_key_match(ldns_rr_list *ds, ldns_rr_list *trusted)
+{
+       size_t i, j;
+       bool match;
+       ldns_rr *rr_i, *rr_j;
+       ldns_rr_list *trusted_ds;
+
+       match = false;
+       trusted_ds = ldns_rr_list_new();
+       if (!trusted_ds) {
+               return NULL;
+       }
+
+       for (i = 0; i < ldns_rr_list_rr_count(trusted); i++) {
+               rr_i = ldns_rr_list_rr(trusted, i);
+               for (j = 0; j < ldns_rr_list_rr_count(ds); j++) {
+                       rr_j = ldns_rr_list_rr(ds, i);
+                       if (ldns_rr_compare_ds(rr_i, rr_j)) {
+                               match = true;
+                               printf("MATCH! :-)\n");
+                               ldns_rr_list_push_rr(trusted_ds, rr_j);
+                       }
+               }
+       }
+
+       if (match) {
+               return trusted_ds;
+       } else {
+               return NULL;
+       }
+}
+
+
 /*
  * generic function to get some RRset from a nameserver
  * and possible some signatures too (that would be the day...)