]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
review comments
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 23 Sep 2009 15:15:41 +0000 (15:15 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 23 Sep 2009 15:15:41 +0000 (15:15 +0000)
git-svn-id: file:///svn/unbound/trunk@1850 be551aaa-1e26-0410-a405-d3ace91eadb9

validator/autotrust.c
validator/autotrust.h

index 1220f78694e627ca06a18a608921e16ca5b66359..3266585f30c84398a3cfaa0f3603cf30be236a34 100644 (file)
@@ -38,6 +38,7 @@
  *
  * Contains autotrust implementation. The implementation was taken from 
  * the autotrust daemon (BSD licensed), written by Matthijs Mekking.
+ * It was modified to fit into unbound. The state table process is the same.
  */
 #include "config.h"
 #include "validator/autotrust.h"
@@ -78,7 +79,7 @@ void autr_global_delete(struct autr_global_data* global)
 {
        if(!global)
                return;
-       /* elements deleted by parent, nothing to do */
+       /* elements deleted by parent */
        memset(global, 0, sizeof(*global));
        free(global);
 }
@@ -111,31 +112,10 @@ autr_get_num_anchors(struct val_anchors* anchors)
 static int
 position_in_string(char *str, const char* sub)
 {
-        int pos = -1, i = 0, j = 0;
-        char* walk;
-        const char* restore = sub;
-        while (*str != '\0')
-        {
-                walk = str;
-                j = 0;
-                while (*sub != '\0' && *walk == *sub)
-                {
-                        sub++;
-                        walk++;
-                        j++;
-                }
-
-                if (*sub == '\0' && j > 0)
-                        pos = i;
-
-                sub = restore;
-                j = 0;
-                i++;
-                str++;
-        }
-        if (pos < 0)
-                return pos;
-        return pos + (int)strlen(sub);
+       char* pos = strstr(str, sub);
+       if(pos)
+               return (int)(pos-str)+(int)strlen(sub);
+       return -1;
 }
 
 /** Debug routine to print pretty key information */
@@ -922,7 +902,8 @@ static void
 seen_trustanchor(struct autr_ta* ta, uint8_t seen)
 {
        ta->fetched = seen;
-       ta->pending_count++;
+       if(ta->pending_count < 250) /* no numerical overflow, please */
+               ta->pending_count++;
 }
 
 /** set revoked value */
index 1620160053552745b2a5234f52f6330f1de97a4e..cb2c6e77b3ca2855a8d91bdfd8aa1b5a313e19f5 100644 (file)
@@ -67,7 +67,7 @@ struct autr_ta {
        struct autr_ta* next;
        /** the RR */
        ldns_rr* rr;
-       /** last update of key state (not the pending count) */
+       /** last update of key state (new pending count keeps date the same) */
        time_t last_change;
        /** 5011 state */
        autr_state_t s;
@@ -94,7 +94,7 @@ struct autr_point_data {
 
        /** last queried DNSKEY set 
         * Not all failures are captured in this entry.
-        * If the validator did not even start (e.g. timeout or servfail),
+        * If the validator did not even start (e.g. timeout or localservfail),
         * then the last_queried and query_failed values are not updated.
         */
        time_t last_queried;
@@ -186,6 +186,7 @@ void autr_point_delete(struct trust_anchor* tp);
  *     allocated in a region. Has not been validated yet.
  * @return false if trust anchor was revoked completely.
  *     Otherwise logs errors to log, does not change return value.
+ *     On errors, likely the trust point has been unchanged.
  */
 int autr_process_prime(struct module_env* env, struct val_env* ve,
        struct trust_anchor* tp, struct ub_packed_rrset_key* dnskey_rrset);