security: Add 'type any' for trust-anchor in ValidatorConfig
Refs: #1482
Change-Id: Ida78f392799f0f2e578e1bdc6735bbfc68e1617e
diff --git a/src/security/validator-config.cpp b/src/security/validator-config.cpp
index 054c843..80d2fb1 100644
--- a/src/security/validator-config.cpp
+++ b/src/security/validator-config.cpp
@@ -28,6 +28,7 @@
const shared_ptr<CertificateCache>& certificateCache,
const int stepLimit)
: Validator(face)
+ , m_shouldValidate(true)
, m_stepLimit(stepLimit)
, m_certificateCache(certificateCache)
{
@@ -275,6 +276,10 @@
return;
}
+ else if (boost::iequals(type, "any"))
+ {
+ m_shouldValidate = false;
+ }
else
throw Error("Unsupported trust-anchor.type: " + type);
}
@@ -286,6 +291,9 @@
const OnDataValidationFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
+ if (!m_shouldValidate)
+ return onValidated(data.shared_from_this());
+
if (m_stepLimit == nSteps)
return onValidationFailed(data.shared_from_this(),
"Maximum steps of validation reached");
@@ -322,6 +330,9 @@
const OnInterestValidationFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
+ if (!m_shouldValidate)
+ return onValidated(interest.shared_from_this());
+
if (m_stepLimit == nSteps)
return onValidationFailed(interest.shared_from_this(),
"Maximum steps of validation reached");