review comments

git-svn-id: file:///svn/unbound/trunk@1850 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-09-23 15:15:41 +00:00
parent 430a6bd697
commit c467aabbf1
2 changed files with 11 additions and 29 deletions

View 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 */

View 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);