return trusted;
}
+/**
+ * List find match function for certificates
+ */
+static bool cert_equals(certificate_t *a, certificate_t *b)
+{
+ return a->equals(a, b);
+}
+
/**
* enumerator for trusted certificates
*/
certificate_t *pretrusted;
/** currently enumerating auth config */
auth_cfg_t *auth;
+ /** list of failed candidates */
+ linked_list_t *failed;
} trusted_enumerator_t;
METHOD(enumerator_t, trusted_enumerate, bool,
continue;
}
+ if (this->failed->find_first(this->failed, (void*)cert_equals,
+ NULL, current) == SUCCESS)
+ { /* check each candidate only once */
+ continue;
+ }
+
DBG1(DBG_CFG, " using certificate \"%Y\"",
current->get_subject(current));
if (verify_trust_chain(this->this, current, this->auth, FALSE,
}
return TRUE;
}
+ this->failed->insert_last(this->failed, current->get_ref(current));
}
return FALSE;
}
DESTROY_IF(this->pretrusted);
DESTROY_IF(this->auth);
DESTROY_IF(this->candidates);
+ this->failed->destroy_offset(this->failed, offsetof(certificate_t, destroy));
free(this);
}
.type = type,
.id = id,
.online = online,
+ .failed = linked_list_create(),
);
return &enumerator->public;
}