From 0c138d70ada7cb181e31a85a6571190cca843835 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 26 Mar 2016 18:36:52 -0400 Subject: [PATCH] moved discarding of banned identities from lobbies before signature checking, so as to avoid to time stamp their GXSId keys --- libretroshare/src/chat/distributedchat.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index 76d0edade..c730a4a91 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -138,6 +138,12 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci) std::cerr << std::endl; return false ; } + + if(rsReputations->isIdentityBanned(cli->signature.keyId)) + { + std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl; + return false ; + } if(!checkSignature(cli,cli->PeerId())) // check the object's signature and possibly request missing keys { std::cerr << "Signature mismatched for this lobby event item. Item will be dropped: " << std::endl; @@ -184,11 +190,6 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci) return false ; } } - if(rsReputations->isIdentityBanned(cli->signature.keyId)) - { - std::cerr << "(WW) Received lobby msg/item from banned identity " << cli->signature.keyId << ". Dropping it." << std::endl; - return false ; - } if(!bounceLobbyObject(cli,cli->PeerId())) // forwards the message to friends, keeps track of subscribers, etc. return false; @@ -648,6 +649,11 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem * #endif time_t now = time(NULL) ; + if(rsReputations->isIdentityBanned(item->signature.keyId)) + { + std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl; + return ; + } if(!checkSignature(item,item->PeerId())) // check the object's signature and possibly request missing keys { std::cerr << "Signature mismatched for this lobby event item: " << std::endl; @@ -675,11 +681,6 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem * return ; } } - if(rsReputations->isIdentityBanned(item->signature.keyId)) - { - std::cerr << "(WW) Received lobby msg/item from banned identity " << item->signature.keyId << ". Dropping it." << std::endl; - return ; - } addTimeShiftStatistics((int)now - (int)item->sendTime) ; if(now+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!