mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-08 14:22:31 -04:00
Merge branch 'master'
This commit is contained in:
commit
1c94ff743b
13 changed files with 35 additions and 24 deletions
|
@ -2844,11 +2844,11 @@ void RsGenExchange::processRecvdGroups()
|
|||
|
||||
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
|
||||
{
|
||||
delete grp;
|
||||
erase = true;
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " max attempts " << VALIDATE_MAX_ATTEMPTS << " reached. Will delete group " << grp->grpId << std::endl;
|
||||
#endif
|
||||
delete grp;
|
||||
erase = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -763,15 +763,19 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
|
|||
uint32_t encrypted_size = data_size - GXS_TUNNEL_ENCRYPTION_IV_SIZE - GXS_TUNNEL_ENCRYPTION_HMAC_SIZE;
|
||||
uint32_t decrypted_size = RsAES::get_buffer_size(encrypted_size);
|
||||
uint8_t *encrypted_data = (uint8_t*)data_bytes+GXS_TUNNEL_ENCRYPTION_IV_SIZE+GXS_TUNNEL_ENCRYPTION_HMAC_SIZE;
|
||||
uint8_t *decrypted_data = new uint8_t[decrypted_size];
|
||||
|
||||
RsTemporaryMemory decrypted_data(decrypted_size);
|
||||
uint8_t aes_key[GXS_TUNNEL_AES_KEY_SIZE] ;
|
||||
|
||||
if(!decrypted_data)
|
||||
return false ;
|
||||
|
||||
std::map<TurtleVirtualPeerId,GxsTunnelDHInfo>::iterator it = _gxs_tunnel_virtual_peer_ids.find(virtual_peer_id) ;
|
||||
|
||||
if(it == _gxs_tunnel_virtual_peer_ids.end())
|
||||
{
|
||||
std::cerr << "(EE) item is not coming out of a registered tunnel. Weird. hash=" << hash << ", peer id = " << virtual_peer_id << std::endl;
|
||||
return true ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
tunnel_id = it->second.tunnel_id ;
|
||||
|
@ -780,7 +784,7 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
|
|||
if(it2 == _gxs_tunnel_contacts.end())
|
||||
{
|
||||
std::cerr << "(EE) no tunnel data for tunnel ID=" << tunnel_id << ". This is a bug." << std::endl;
|
||||
return true ;
|
||||
return false ;
|
||||
}
|
||||
memcpy(aes_key,it2->second.aes_key,GXS_TUNNEL_AES_KEY_SIZE) ;
|
||||
|
||||
|
@ -800,8 +804,6 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
|
|||
std::cerr << "(EE) packet HMAC does not match. Computed HMAC=" << RsUtil::BinToHex((char*)hm,GXS_TUNNEL_ENCRYPTION_HMAC_SIZE) << std::endl;
|
||||
std::cerr << "(EE) resetting new DH session." << std::endl;
|
||||
|
||||
delete[] decrypted_data ;
|
||||
|
||||
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
|
||||
|
||||
return false ;
|
||||
|
@ -812,8 +814,6 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
|
|||
std::cerr << "(EE) packet decryption failed." << std::endl;
|
||||
std::cerr << "(EE) resetting new DH session." << std::endl;
|
||||
|
||||
delete[] decrypted_data ;
|
||||
|
||||
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
|
||||
|
||||
return false ;
|
||||
|
@ -829,8 +829,6 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
|
|||
//
|
||||
citem = dynamic_cast<RsGxsTunnelItem*>(RsGxsTunnelSerialiser().deserialise(decrypted_data,&decrypted_size)) ;
|
||||
|
||||
delete[] decrypted_data ;
|
||||
|
||||
if(citem == NULL)
|
||||
{
|
||||
std::cerr << "(EE) item could not be de-serialized. That is an error." << std::endl;
|
||||
|
@ -1003,7 +1001,7 @@ void p3GxsTunnelService::handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item)
|
|||
|
||||
#ifdef DEBUG_GXS_TUNNEL
|
||||
std::cerr << " DH key computed. Tunnel is now secured!" << std::endl;
|
||||
std::cerr << " Key computed: " << RsUtil::BinToHex((char*)pinfo.aes_key,16) << std::cerr << std::endl;
|
||||
std::cerr << " Key computed: " << RsUtil::BinToHex((char*)pinfo.aes_key,16) << std::endl;
|
||||
std::cerr << " Sending a ACK packet." << std::endl;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1258,6 +1258,9 @@ int RsServer::StartupRetroShare()
|
|||
|
||||
std::vector<std::string> plugins_directories ;
|
||||
|
||||
#ifdef __APPLE__
|
||||
plugins_directories.push_back(rsAccounts->PathDataDirectory()) ;
|
||||
#endif
|
||||
#ifndef WINDOWS_SYS
|
||||
plugins_directories.push_back(std::string(PLUGIN_DIR)) ;
|
||||
#endif
|
||||
|
|
|
@ -182,6 +182,7 @@ void ContentValue::put(const std::string &key, uint32_t len, const char* value){
|
|||
|
||||
mKvData.insert(std::pair<std::string, std::pair<uint32_t, char*> >
|
||||
(key, std::pair<uint32_t, char*>(len, dest)));
|
||||
//delete[] dest; //Deleted by clearData()
|
||||
}
|
||||
|
||||
bool ContentValue::getAsBool(const std::string &key, bool& value) const{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue