mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added early removal of event items that do not belong to a subscribed lobby (causing signature check error)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8161 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a63829b4ec
commit
3e4d63f4ab
@ -28,6 +28,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
|
#include "util/rsmemory.h"
|
||||||
#include "distributedchat.h"
|
#include "distributedchat.h"
|
||||||
|
|
||||||
#include "pqi/p3historymgr.h"
|
#include "pqi/p3historymgr.h"
|
||||||
@ -173,7 +174,7 @@ bool DistributedChatService::checkSignature(RsChatLobbyBouncingObject *obj,const
|
|||||||
mGixs->requestKey(obj->signature.keyId,peer_list);
|
mGixs->requestKey(obj->signature.keyId,peer_list);
|
||||||
|
|
||||||
uint32_t size = obj->signed_serial_size() ;
|
uint32_t size = obj->signed_serial_size() ;
|
||||||
unsigned char *memory = (unsigned char *)malloc(size) ;
|
RsTemporaryMemory memory(size) ;
|
||||||
|
|
||||||
#ifdef DEBUG_CHAT_LOBBIES
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
std::cerr << "Checking object signature: " << std::endl;
|
std::cerr << "Checking object signature: " << std::endl;
|
||||||
@ -182,8 +183,7 @@ bool DistributedChatService::checkSignature(RsChatLobbyBouncingObject *obj,const
|
|||||||
|
|
||||||
if(!obj->serialise_signed_part(memory,size))
|
if(!obj->serialise_signed_part(memory,size))
|
||||||
{
|
{
|
||||||
std::cerr << " (EE) Cannot sign message item. " << std::endl;
|
std::cerr << " (EE) Cannot serialise message item. " << std::endl;
|
||||||
free(memory) ;
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,10 @@ bool DistributedChatService::checkSignature(RsChatLobbyBouncingObject *obj,const
|
|||||||
|
|
||||||
switch(error_status)
|
switch(error_status)
|
||||||
{
|
{
|
||||||
case RsGixs::RS_GIXS_ERROR_KEY_NOT_AVAILABLE: std::cerr << "(EE) Key is not available. Cannot verify." << std::endl;
|
case RsGixs::RS_GIXS_ERROR_KEY_NOT_AVAILABLE:
|
||||||
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
|
std::cerr << "(WW) Key is not is cache. Cannot verify." << std::endl;
|
||||||
|
#endif
|
||||||
res =true ;
|
res =true ;
|
||||||
break ;
|
break ;
|
||||||
case RsGixs::RS_GIXS_ERROR_SIGNATURE_MISMATCH: std::cerr << "(EE) Signature mismatch. Spoofing/MITM?." << std::endl;
|
case RsGixs::RS_GIXS_ERROR_SIGNATURE_MISMATCH: std::cerr << "(EE) Signature mismatch. Spoofing/MITM?." << std::endl;
|
||||||
@ -203,12 +206,8 @@ bool DistributedChatService::checkSignature(RsChatLobbyBouncingObject *obj,const
|
|||||||
break ;
|
break ;
|
||||||
default: break ;
|
default: break ;
|
||||||
}
|
}
|
||||||
free(memory) ;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
free(memory) ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_CHAT_LOBBIES
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
std::cerr << " signature: CHECKS" << std::endl;
|
std::cerr << " signature: CHECKS" << std::endl;
|
||||||
@ -596,6 +595,22 @@ void DistributedChatService::addTimeShiftStatistics(int D)
|
|||||||
|
|
||||||
void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item)
|
void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item)
|
||||||
{
|
{
|
||||||
|
// delete items that are not for us, as early as possible.
|
||||||
|
{
|
||||||
|
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
|
// send upward for display
|
||||||
|
|
||||||
|
if(_chat_lobbys.find(item->lobby_id) == _chat_lobbys.end())
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
|
std::cerr << "Chatlobby for id " << std::hex << item->lobby_id << " has no record. Dropping the msg." << std::dec << std::endl;
|
||||||
|
#endif
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_CHAT_LOBBIES
|
#ifdef DEBUG_CHAT_LOBBIES
|
||||||
std::cerr << "Received ChatLobbyEvent item of type " << (int)(item->event_type) << ", and string=" << item->string1 << std::endl;
|
std::cerr << "Received ChatLobbyEvent item of type " << (int)(item->event_type) << ", and string=" << item->string1 << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user