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;
diff --git a/tests/daemon/mgmt/face-manager-update-face.t.cpp b/tests/daemon/mgmt/face-manager-update-face.t.cpp
index b380419..7b3859f 100644
--- a/tests/daemon/mgmt/face-manager-update-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-update-face.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -46,7 +46,7 @@
class FaceManagerUpdateFixture : public FaceManagerCommandFixture
{
public:
- ~FaceManagerUpdateFixture()
+ ~FaceManagerUpdateFixture() override
{
destroyFace();
}
@@ -110,7 +110,7 @@
if (isForOnDemandFace) {
auto face = target.faceTable.get(static_cast<FaceId>(this->faceId));
// to force creation of on-demand face
- face->sendInterest(*make_shared<Interest>("/hello/world"));
+ face->sendInterest(*makeInterest("/hello/world"));
}
});
diff --git a/tests/daemon/table/cs-fixture.hpp b/tests/daemon/table/cs-fixture.hpp
index 15bf89e..4ed5346 100644
--- a/tests/daemon/table/cs-fixture.hpp
+++ b/tests/daemon/table/cs-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -64,8 +64,7 @@
Interest&
startInterest(const Name& name)
{
- interest = make_shared<Interest>(name);
- interest->setCanBePrefix(false);
+ interest = makeInterest(name);
return *interest;
}
@@ -74,7 +73,7 @@
{
bool hasResult = false;
cs.find(*interest,
- [&] (const Interest& interest, const Data& data) {
+ [&] (const Interest&, const Data& data) {
hasResult = true;
const Block& content = data.getContent();
uint32_t found = 0;
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index 267dfd9..200ae75 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -115,7 +115,7 @@
{
ControlParameters parameters;
parameters.setName(HUB_DISCOVERY_PREFIX)
- .setStrategy("/localhost/nfd/strategy/multicast"),
+ .setStrategy("/localhost/nfd/strategy/multicast");
m_controller.start<nfd::StrategyChoiceSetCommand>(
parameters,