From 39afb24982865268cc51b5564c03ab847abfdcf2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 15 Nov 2016 10:37:19 -0800 Subject: [PATCH] explictly remove Agent from NIS for other Agents --- domain-server/src/DomainGatekeeper.cpp | 9 ++++++++- domain-server/src/DomainServer.cpp | 12 +++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/domain-server/src/DomainGatekeeper.cpp b/domain-server/src/DomainGatekeeper.cpp index abe7ed176a..051465efd2 100644 --- a/domain-server/src/DomainGatekeeper.cpp +++ b/domain-server/src/DomainGatekeeper.cpp @@ -109,7 +109,14 @@ void DomainGatekeeper::processConnectRequestPacket(QSharedPointer(node->getLinkedData()); nodeData->setSendingSockAddr(message->getSenderSockAddr()); - nodeData->setNodeInterestSet(nodeConnection.interestList.toSet()); + + // guard against patched agents asking to hear about other agents + auto safeInterestSet = nodeConnection.interestList.toSet(); + if (nodeConnection.nodeType == NodeType::Agent) { + safeInterestSet.remove(NodeType::Agent); + } + + nodeData->setNodeInterestSet(safeInterestSet); nodeData->setPlaceName(nodeConnection.placeName); // signal that we just connected a node so the DomainServer can get it a list diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 7d031c5be5..6668ed54dc 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -843,7 +843,14 @@ void DomainServer::processListRequestPacket(QSharedPointer mess // update the NodeInterestSet in case there have been any changes DomainServerNodeData* nodeData = reinterpret_cast(sendingNode->getLinkedData()); - nodeData->setNodeInterestSet(nodeRequestData.interestList.toSet()); + + // guard against patched agents asking to hear about other agents + auto safeInterestSet = nodeRequestData.interestList.toSet(); + if (sendingNode->getType() == NodeType::Agent) { + safeInterestSet.remove(NodeType::Agent); + } + + nodeData->setNodeInterestSet(safeInterestSet); // update the connecting hostname in case it has changed nodeData->setPlaceName(nodeRequestData.placeName); @@ -951,8 +958,7 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif // if this authenticated node has any interest types, send back those nodes as well limitedNodeList->eachNode([&](const SharedNodePointer& otherNode){ if (otherNode->getUUID() != node->getUUID() - && nodeInterestSet.contains(otherNode->getType()) - && (node->getType() != NodeType::Agent || otherNode->getType() != NodeType::Agent)) { + && nodeInterestSet.contains(otherNode->getType())) { // since we're about to add a node to the packet we start a segment domainListPackets->startSegment();