some simplifications to trusted_enumerator_t

This commit is contained in:
Martin Willi
2008-04-01 10:56:08 +00:00
parent 1bb85edffe
commit 45d66f5af6
+7 -8
View File
@@ -970,8 +970,6 @@ typedef struct {
bool crl; bool crl;
/** TRUE to do OCSP checking */ /** TRUE to do OCSP checking */
bool ocsp; bool ocsp;
/** currently enumerating certificate */
certificate_t *current;
/** pretrusted certificate we have served at first invocation */ /** pretrusted certificate we have served at first invocation */
certificate_t *pretrusted; certificate_t *pretrusted;
/** currently enumerating auth info */ /** currently enumerating auth info */
@@ -984,6 +982,8 @@ typedef struct {
static bool trusted_enumerate(trusted_enumerator_t *this, static bool trusted_enumerate(trusted_enumerator_t *this,
certificate_t **cert, auth_info_t **auth) certificate_t **cert, auth_info_t **auth)
{ {
certificate_t *current;
DESTROY_IF(this->auth); DESTROY_IF(this->auth);
this->auth = auth_info_create(); this->auth = auth_info_create();
@@ -1016,20 +1016,20 @@ static bool trusted_enumerate(trusted_enumerator_t *this,
} }
} }
/* try to verify the trust chain for each certificate found */ /* try to verify the trust chain for each certificate found */
while (this->candidates->enumerate(this->candidates, &this->current)) while (this->candidates->enumerate(this->candidates, &current))
{ {
if (this->pretrusted && if (this->pretrusted &&
this->pretrusted->equals(this->pretrusted, this->current)) this->pretrusted->equals(this->pretrusted, current))
{ /* skip pretrusted certificate we already served */ { /* skip pretrusted certificate we already served */
continue; continue;
} }
DBG1(DBG_CFG, " using certificate \"%D\"", DBG1(DBG_CFG, " using certificate \"%D\"",
this->current->get_subject(this->current)); current->get_subject(current));
if (verify_trust_chain(this->this, this->current, this->auth, FALSE, if (verify_trust_chain(this->this, current, this->auth, FALSE,
this->crl, this->ocsp)) this->crl, this->ocsp))
{ {
*cert = this->current; *cert = current;
if (auth) if (auth)
{ {
*auth = this->auth; *auth = this->auth;
@@ -1069,7 +1069,6 @@ static enumerator_t *create_trusted_enumerator(private_credential_manager_t *thi
enumerator->crl = crl; enumerator->crl = crl;
enumerator->ocsp = ocsp; enumerator->ocsp = ocsp;
enumerator->pretrusted = NULL; enumerator->pretrusted = NULL;
enumerator->current = NULL;
enumerator->auth = NULL; enumerator->auth = NULL;
return &enumerator->public; return &enumerator->public;