mgmt: fix construction of CertificateRequest in CommandAuthenticatorValidationPolicy
Just pass the KeyLocator name and let CertificateRequest deal
with constructing the Interest and setting CanBePrefix
Refs: #4582
Change-Id: I323d8ac5e16605bb978addc623e525b2536238bf
diff --git a/daemon/mgmt/command-authenticator.cpp b/daemon/mgmt/command-authenticator.cpp
index db50e4d..2196889 100644
--- a/daemon/mgmt/command-authenticator.cpp
+++ b/daemon/mgmt/command-authenticator.cpp
@@ -83,7 +83,7 @@
auto state1 = dynamic_pointer_cast<security::InterestValidationState>(state);
state1->getOriginalInterest().setTag(make_shared<SignerTag>(klName));
- continueValidation(make_shared<security::CertificateRequest>(Interest(klName)), state);
+ continueValidation(make_shared<security::CertificateRequest>(klName), state);
}
void
@@ -115,7 +115,7 @@
CommandAuthenticator::processConfig(const ConfigSection& section, bool isDryRun, const std::string& filename)
{
if (!isDryRun) {
- NFD_LOG_INFO("clear-authorizations");
+ NFD_LOG_DEBUG("resetting authorizations");
for (auto& kv : m_validators) {
kv.second = make_shared<security::Validator>(
make_unique<security::ValidationPolicyCommandInterest>(make_unique<CommandAuthenticatorValidationPolicy>()),
@@ -212,6 +212,7 @@
const ndn::mgmt::AcceptContinuation& accept,
const ndn::mgmt::RejectContinuation& reject) {
auto validator = self->m_validators.at(module);
+
auto successCb = [accept, validator] (const Interest& interest1) {
auto signer1 = getSignerFromTag(interest1);
BOOST_ASSERT(signer1 || // signer must be available unless 'certfile any'
@@ -220,6 +221,7 @@
NFD_LOG_DEBUG("accept " << interest1.getName() << " signer=" << signer);
accept(signer);
};
+
auto failureCb = [reject] (const Interest& interest1, const security::ValidationError& err) {
using ndn::mgmt::RejectReply;
RejectReply reply = RejectReply::STATUS403;