credmgr: introduce a hook function to catch trust chain validation errors
This commit is contained in:
@@ -94,7 +94,12 @@ METHOD(cert_validator_t, validate, bool,
|
||||
if (subject->get_type(subject) == CERT_X509 &&
|
||||
issuer->get_type(issuer) == CERT_X509)
|
||||
{
|
||||
return check_addrblock((x509_t*)subject, (x509_t*)issuer);
|
||||
if (!check_addrblock((x509_t*)subject, (x509_t*)issuer))
|
||||
{
|
||||
lib->credmgr->call_hook(lib->credmgr, CRED_HOOK_POLICY_VIOLATION,
|
||||
subject);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -167,6 +167,8 @@ METHOD(cert_validator_t, validate, bool,
|
||||
{
|
||||
DBG1(DBG_CFG, "coupling new certificate '%Y' failed",
|
||||
subject->get_subject(subject));
|
||||
lib->credmgr->call_hook(lib->credmgr
|
||||
CRED_HOOK_POLICY_VIOLATION, subject);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -174,6 +176,8 @@ METHOD(cert_validator_t, validate, bool,
|
||||
DBG1(DBG_CFG, "coupling new certificate '%Y' failed, limit of %d "
|
||||
"couplings reached", subject->get_subject(subject),
|
||||
this->max_couplings);
|
||||
lib->credmgr->call_hook(lib->credmgr, CRED_HOOK_POLICY_VIOLATION,
|
||||
subject);
|
||||
}
|
||||
this->mutex->unlock(this->mutex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user