mgmt: use a separate validator for prefix announcements

This commit also configures the default prefix_announcement_validation
section in nfd.conf.sample to accept any prefix announcement.

refs: #5031
Change-Id: I82e34ce783dfe77c170dd02e78a4bc86faa0147a
diff --git a/daemon/mgmt/rib-manager.cpp b/daemon/mgmt/rib-manager.cpp
index 81196dd..bf3b194 100644
--- a/daemon/mgmt/rib-manager.cpp
+++ b/daemon/mgmt/rib-manager.cpp
@@ -58,6 +58,7 @@
   , m_faceMonitor(face)
   , m_localhostValidator(face)
   , m_localhopValidator(make_unique<ndn::security::v2::CertificateFetcherDirectFetch>(face))
+  , m_paValidator(make_unique<ndn::security::v2::CertificateFetcherDirectFetch>(face))
   , m_isLocalhopEnabled(false)
 {
   registerCommandHandler<ndn::nfd::RibRegisterCommand>("register",
@@ -88,6 +89,12 @@
 }
 
 void
+RibManager::applyPaConfig(const ConfigSection& section, const std::string& filename)
+{
+  m_paValidator.load(section, filename);
+}
+
+void
 RibManager::registerWithNfd()
 {
   registerTopPrefix(LOCALHOST_TOP_PREFIX);
@@ -356,14 +363,7 @@
 {
   BOOST_ASSERT(pa.getData());
 
-  if (!m_isLocalhopEnabled) {
-    NFD_LOG_INFO("slAnnounce " << pa.getAnnouncedName() << " " << faceId <<
-                 ": localhop_security unconfigured");
-    cb(SlAnnounceResult::VALIDATION_FAILURE);
-    return;
-  }
-
-  m_localhopValidator.validate(*pa.getData(),
+  m_paValidator.validate(*pa.getData(),
     [=] (const Data&) {
       Route route(pa, faceId);
       route.expires = std::min(route.annExpires, time::steady_clock::now() + maxLifetime);