From 90b5e76f25cf84545c622723508380341c71083b Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 8 Jun 2013 20:48:02 +0000 Subject: [PATCH] fixed bug in anti-search-by-depth mechanism; removed some compiation warnings git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6416 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/turtle/p3turtle.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/turtle/p3turtle.cc b/libretroshare/src/turtle/p3turtle.cc index 0604db3a7..9b53f1ce9 100644 --- a/libretroshare/src/turtle/p3turtle.cc +++ b/libretroshare/src/turtle/p3turtle.cc @@ -871,7 +871,7 @@ void p3turtle::handleSearchRequest(RsTurtleSearchRequestItem *item) // We use a random factor on the depth test that is biased by a mix between the session id and the partial tunnel id // to scramble a possible search-by-depth attack. // - bool random_bypass = (item->depth == TURTLE_MAX_SEARCH_DEPTH && (((_random_bias ^ item->request_id)&0x7)==2)) ; + bool random_bypass = (item->depth >= TURTLE_MAX_SEARCH_DEPTH && (((_random_bias ^ item->request_id)&0x7)==2)) ; bool random_dshift = (item->depth == 1 && (((_random_bias ^ item->request_id)&0x7)==6)) ; if(item->depth < TURTLE_MAX_SEARCH_DEPTH || random_bypass) @@ -1123,7 +1123,7 @@ bool p3turtle::getTunnelServiceInfo(TurtleTunnelId tunnel_id,std::string& vpid,s if(it == _incoming_file_hashes.end()) { - std::cerr << "p3turtle::handleRecvGenericTunnelItem(): hash " << hash << " for tunnel " << (void*)(it2->first) << " has no attached service! Dropping the item. This is a serious consistency error." << std::endl; + std::cerr << "p3turtle::handleRecvGenericTunnelItem(): hash " << hash << " for tunnel " << std::hex << it2->first << std::dec << " has no attached service! Dropping the item. This is a serious consistency error." << std::endl; return false; } @@ -1135,7 +1135,7 @@ bool p3turtle::getTunnelServiceInfo(TurtleTunnelId tunnel_id,std::string& vpid,s if(it == _outgoing_file_hashes.end()) { - std::cerr << "p3turtle::handleRecvGenericTunnelItem(): hash " << hash << " for tunnel " << (void*)(it2->first) << " has no attached service! Dropping the item. This is a serious consistency error." << std::endl; + std::cerr << "p3turtle::handleRecvGenericTunnelItem(): hash " << hash << " for tunnel " << std::hex << it2->first << std::dec<< " has no attached service! Dropping the item. This is a serious consistency error." << std::endl; return false; } @@ -1143,7 +1143,7 @@ bool p3turtle::getTunnelServiceInfo(TurtleTunnelId tunnel_id,std::string& vpid,s } else { - std::cerr << "p3turtle::handleRecvGenericTunnelItem(): hash " << hash << " for tunnel " << (void*)(it2->first) << ". Tunnel is not a end-point or a starting tunnel!! This is a serious consistency error." << std::endl; + std::cerr << "p3turtle::handleRecvGenericTunnelItem(): hash " << hash << " for tunnel " << std::hex << it2->first << std::dec << ". Tunnel is not a end-point or a starting tunnel!! This is a serious consistency error." << std::endl; return false ; }