From c2187c87599c60b9c47dd9d01244ce1ffd105fea Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 14 Aug 2014 19:52:22 -0400 Subject: (1) distribute default root-topology in new dictionary format, (2) bump peer serialization version to force obsolescence of old supernodes, (3) stop outputting a log message every time we poll for software updates --- node/Topology.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'node/Topology.cpp') diff --git a/node/Topology.cpp b/node/Topology.cpp index 4fae1372..6fcb17af 100644 --- a/node/Topology.cpp +++ b/node/Topology.cpp @@ -27,6 +27,8 @@ #include +#include "Constants.hpp" +#include "Defaults.hpp" #include "Topology.hpp" #include "NodeConfig.hpp" #include "CMWC4096.hpp" @@ -239,6 +241,24 @@ void Topology::clean() } } +bool Topology::authenticateRootTopology(const Dictionary &rt) +{ + try { + std::string signer(rt.signingIdentity()); + if (!signer.length()) + return false; + Identity signerId(signer); + std::map< Address,Identity >::const_iterator authority(ZT_DEFAULTS.rootTopologyAuthorities.find(signerId.address())); + if (authority == ZT_DEFAULTS.rootTopologyAuthorities.end()) + return false; + if (signerId != authority->second) + return false; + return rt.verify(authority->second); + } catch ( ... ) { + return false; + } +} + void Topology::_dumpPeers() { Buffer buf; -- cgit v1.2.3