switch to ndn-cxx KeyChain v2
ValidatorConfig is temporarily disabled. All commands are
authorized without validation.
refs #4091
Change-Id: I4eea8cd954761424d2d084bda4e8510320b5fb46
diff --git a/src/common.hpp b/src/common.hpp
index 3611c02..efeabe6 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2017, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -27,7 +27,7 @@
#include <ndn-cxx/selectors.hpp>
#include <ndn-cxx/key-locator.hpp>
#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/security/validator-config.hpp>
+#include <ndn-cxx/security/validator.hpp>
#include <ndn-cxx/util/time.hpp>
#include <ndn-cxx/util/scheduler.hpp>
@@ -59,7 +59,7 @@
using ndn::KeyLocator;
using ndn::KeyChain;
using ndn::Scheduler;
-using ndn::ValidatorConfig;
+using ndn::Validator;
using std::shared_ptr;
using std::make_shared;
diff --git a/src/handles/delete-handle.cpp b/src/handles/delete-handle.cpp
index 5cfbea2..f39856f 100644
--- a/src/handles/delete-handle.cpp
+++ b/src/handles/delete-handle.cpp
@@ -22,8 +22,8 @@
namespace repo {
DeleteHandle::DeleteHandle(Face& face, RepoStorage& storageHandle, KeyChain& keyChain,
- Scheduler& scheduler,// RepoStorage& storeindex,
- ValidatorConfig& validator)
+ Scheduler& scheduler,
+ Validator& validator)
: BaseHandle(face, storageHandle, keyChain, scheduler)
, m_validator(validator)
{
diff --git a/src/handles/delete-handle.hpp b/src/handles/delete-handle.hpp
index 5493d2e..0bb0e06 100644
--- a/src/handles/delete-handle.hpp
+++ b/src/handles/delete-handle.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2017, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -21,7 +21,6 @@
#define REPO_HANDLES_DELETE_HANDLE_HPP
#include "base-handle.hpp"
-#include <ndn-cxx/security/validator-config.hpp>
namespace repo {
@@ -41,7 +40,7 @@
public:
DeleteHandle(Face& face, RepoStorage& storageHandle, KeyChain& keyChain,
- Scheduler& scheduler, ValidatorConfig& validator);
+ Scheduler& scheduler, Validator& validator);
virtual void
listen(const Name& prefix);
@@ -85,7 +84,7 @@
processSegmentDeleteCommand(const Interest& interest, RepoCommandParameter& parameter);
private:
- ValidatorConfig& m_validator;
+ Validator& m_validator;
};
diff --git a/src/handles/tcp-bulk-insert-handle.cpp b/src/handles/tcp-bulk-insert-handle.cpp
index 1d81b17..53a60d6 100644
--- a/src/handles/tcp-bulk-insert-handle.cpp
+++ b/src/handles/tcp-bulk-insert-handle.cpp
@@ -99,7 +99,7 @@
m_acceptor.listen(255);
shared_ptr<ip::tcp::socket> clientSocket =
- make_shared<ip::tcp::socket>(boost::ref(m_acceptor.get_io_service()));
+ make_shared<ip::tcp::socket>(std::ref(m_acceptor.get_io_service()));
m_acceptor.async_accept(*clientSocket,
bind(&TcpBulkInsertHandle::handleAccept, this, _1,
clientSocket));
@@ -127,12 +127,12 @@
std::cerr << "New connection from " << socket->remote_endpoint() << std::endl;
shared_ptr<detail::TcpBulkInsertClient> client =
- make_shared<detail::TcpBulkInsertClient>(boost::ref(*this), socket);
+ make_shared<detail::TcpBulkInsertClient>(std::ref(*this), socket);
detail::TcpBulkInsertClient::startReceive(client);
// prepare accepting the next connection
shared_ptr<ip::tcp::socket> clientSocket =
- make_shared<ip::tcp::socket>(boost::ref(m_acceptor.get_io_service()));
+ make_shared<ip::tcp::socket>(std::ref(m_acceptor.get_io_service()));
m_acceptor.async_accept(*clientSocket,
bind(&TcpBulkInsertHandle::handleAccept, this, _1,
clientSocket));
diff --git a/src/handles/watch-handle.cpp b/src/handles/watch-handle.cpp
index 25ce278..97aea8f 100644
--- a/src/handles/watch-handle.cpp
+++ b/src/handles/watch-handle.cpp
@@ -25,7 +25,7 @@
static const milliseconds DEFAULT_INTEREST_LIFETIME(4000);
WatchHandle::WatchHandle(Face& face, RepoStorage& storageHandle, KeyChain& keyChain,
- Scheduler& scheduler, ValidatorConfig& validator)
+ Scheduler& scheduler, Validator& validator)
: BaseHandle(face, storageHandle, keyChain, scheduler)
, m_validator(validator)
, m_interestNum(0)
diff --git a/src/handles/watch-handle.hpp b/src/handles/watch-handle.hpp
index f34b1fb..a3e9e5f 100644
--- a/src/handles/watch-handle.hpp
+++ b/src/handles/watch-handle.hpp
@@ -34,11 +34,8 @@
* @brief WatchHandle provides a different way for repo to insert data.
*
* Repo keeps sending interest to request the data with same prefix,
- *
* but with different exclude selectors(updated every time). Repo will stop
- *
* watching the prefix until a command interest tell it to stop, the total
- *
* amount of sent interests reaches a specific number or time out.
*/
class WatchHandle : public BaseHandle
@@ -58,7 +55,7 @@
public:
WatchHandle(Face& face, RepoStorage& storageHandle, KeyChain& keyChain,
- Scheduler& scheduler, ValidatorConfig& validator);
+ Scheduler& scheduler, Validator& validator);
virtual void
listen(const Name& prefix);
@@ -155,8 +152,7 @@
onRunning(const Name& name);
private:
-
- ValidatorConfig& m_validator;
+ Validator& m_validator;
map<Name, std::pair<RepoCommandResponse, bool> > m_processes;
int64_t m_interestNum;
diff --git a/src/handles/write-handle.cpp b/src/handles/write-handle.cpp
index 16c622e..862616a 100644
--- a/src/handles/write-handle.cpp
+++ b/src/handles/write-handle.cpp
@@ -28,8 +28,8 @@
static const milliseconds DEFAULT_INTEREST_LIFETIME(4000);
WriteHandle::WriteHandle(Face& face, RepoStorage& storageHandle, KeyChain& keyChain,
- Scheduler& scheduler,// RepoStorage& storeindex,
- ValidatorConfig& validator)
+ Scheduler& scheduler,
+ Validator& validator)
: BaseHandle(face, storageHandle, keyChain, scheduler)
, m_validator(validator)
, m_retryTime(RETRY_TIMEOUT)
diff --git a/src/handles/write-handle.hpp b/src/handles/write-handle.hpp
index a02f675..1347470 100644
--- a/src/handles/write-handle.hpp
+++ b/src/handles/write-handle.hpp
@@ -22,8 +22,6 @@
#include "base-handle.hpp"
-#include <ndn-cxx/security/validator-config.hpp>
-
#include <queue>
namespace repo {
@@ -70,7 +68,7 @@
public:
WriteHandle(Face& face, RepoStorage& storageHandle, KeyChain& keyChain,
- Scheduler& scheduler, ValidatorConfig& validator);
+ Scheduler& scheduler, Validator& validator);
virtual void
listen(const Name& prefix);
@@ -228,8 +226,7 @@
negativeReply(const Interest& interest, int statusCode);
private:
-
- ValidatorConfig& m_validator;
+ Validator& m_validator;
map<ProcessId, ProcessInfo> m_processes;
diff --git a/src/repo.cpp b/src/repo.cpp
index dcf7007..ff2422d 100644
--- a/src/repo.cpp
+++ b/src/repo.cpp
@@ -118,7 +118,6 @@
, m_face(ioService)
, m_store(std::make_shared<SqliteStorage>(config.dbPath))
, m_storageHandle(config.nMaxPackets, *m_store)
- , m_validator(m_face)
, m_readHandle(m_face, m_storageHandle, m_keyChain, m_scheduler)
, m_writeHandle(m_face, m_storageHandle, m_keyChain, m_scheduler, m_validator)
, m_watchHandle(m_face, m_storageHandle, m_keyChain, m_scheduler, m_validator)
@@ -126,7 +125,7 @@
, m_tcpBulkInsertHandle(ioService, m_storageHandle)
{
- m_validator.load(config.validatorNode, config.repoConfigPath);
+ this->enableValidation();
}
void
@@ -173,7 +172,9 @@
void
Repo::enableValidation()
{
- m_validator.load(m_config.validatorNode, m_config.repoConfigPath);
+ std::cerr << "Validation is temporarily disabled. All commands will be authorized.\n";
+ /// \todo #4091 restore with ValidatorPolicyConf
+ // m_validator.load(m_config.validatorNode, m_config.repoConfigPath);
}
} // namespace repo
diff --git a/src/repo.hpp b/src/repo.hpp
index 754a63c..ef506a7 100644
--- a/src/repo.hpp
+++ b/src/repo.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California.
+ * Copyright (c) 2014-2017, Regents of the University of California.
*
* This file is part of NDN repo-ng (Next generation of NDN repository).
* See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -32,6 +32,7 @@
#include "common.hpp"
+#include <ndn-cxx/security/validator-null.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/info_parser.hpp>
@@ -85,7 +86,7 @@
std::shared_ptr<Storage> m_store;
RepoStorage m_storageHandle;
KeyChain m_keyChain;
- ValidatorConfig m_validator;
+ ndn::ValidatorNull m_validator;
ReadHandle m_readHandle;
WriteHandle m_writeHandle;
WatchHandle m_watchHandle;
diff --git a/src/storage/sqlite-storage.cpp b/src/storage/sqlite-storage.cpp
index ae380ea..034ae66 100644
--- a/src/storage/sqlite-storage.cpp
+++ b/src/storage/sqlite-storage.cpp
@@ -20,6 +20,7 @@
#include "../../build/src/config.hpp"
#include "sqlite-storage.hpp"
#include "index.hpp"
+#include <ndn-cxx/util/crypto.hpp>
#include <boost/filesystem.hpp>
#include <istream>