mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 09:26:18 -05:00
Merge branch 'master'
This commit is contained in:
commit
1c94ff743b
@ -2844,11 +2844,11 @@ void RsGenExchange::processRecvdGroups()
|
|||||||
|
|
||||||
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
|
if(gpsi.mAttempts == VALIDATE_MAX_ATTEMPTS)
|
||||||
{
|
{
|
||||||
delete grp;
|
|
||||||
erase = true;
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " max attempts " << VALIDATE_MAX_ATTEMPTS << " reached. Will delete group " << grp->grpId << std::endl;
|
std::cerr << " max attempts " << VALIDATE_MAX_ATTEMPTS << " reached. Will delete group " << grp->grpId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
delete grp;
|
||||||
|
erase = true;
|
||||||
}
|
}
|
||||||
else
|
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 encrypted_size = data_size - GXS_TUNNEL_ENCRYPTION_IV_SIZE - GXS_TUNNEL_ENCRYPTION_HMAC_SIZE;
|
||||||
uint32_t decrypted_size = RsAES::get_buffer_size(encrypted_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 *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] ;
|
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) ;
|
std::map<TurtleVirtualPeerId,GxsTunnelDHInfo>::iterator it = _gxs_tunnel_virtual_peer_ids.find(virtual_peer_id) ;
|
||||||
|
|
||||||
if(it == _gxs_tunnel_virtual_peer_ids.end())
|
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;
|
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 ;
|
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())
|
if(it2 == _gxs_tunnel_contacts.end())
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) no tunnel data for tunnel ID=" << tunnel_id << ". This is a bug." << std::endl;
|
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) ;
|
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) 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;
|
std::cerr << "(EE) resetting new DH session." << std::endl;
|
||||||
|
|
||||||
delete[] decrypted_data ;
|
|
||||||
|
|
||||||
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
|
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
|
||||||
|
|
||||||
return false ;
|
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) packet decryption failed." << std::endl;
|
||||||
std::cerr << "(EE) resetting new DH session." << std::endl;
|
std::cerr << "(EE) resetting new DH session." << std::endl;
|
||||||
|
|
||||||
delete[] decrypted_data ;
|
|
||||||
|
|
||||||
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
|
locked_restartDHSession(virtual_peer_id,it2->second.own_gxs_id) ;
|
||||||
|
|
||||||
return false ;
|
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)) ;
|
citem = dynamic_cast<RsGxsTunnelItem*>(RsGxsTunnelSerialiser().deserialise(decrypted_data,&decrypted_size)) ;
|
||||||
|
|
||||||
delete[] decrypted_data ;
|
|
||||||
|
|
||||||
if(citem == NULL)
|
if(citem == NULL)
|
||||||
{
|
{
|
||||||
std::cerr << "(EE) item could not be de-serialized. That is an error." << std::endl;
|
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
|
#ifdef DEBUG_GXS_TUNNEL
|
||||||
std::cerr << " DH key computed. Tunnel is now secured!" << std::endl;
|
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;
|
std::cerr << " Sending a ACK packet." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1258,6 +1258,9 @@ int RsServer::StartupRetroShare()
|
|||||||
|
|
||||||
std::vector<std::string> plugins_directories ;
|
std::vector<std::string> plugins_directories ;
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
plugins_directories.push_back(rsAccounts->PathDataDirectory()) ;
|
||||||
|
#endif
|
||||||
#ifndef WINDOWS_SYS
|
#ifndef WINDOWS_SYS
|
||||||
plugins_directories.push_back(std::string(PLUGIN_DIR)) ;
|
plugins_directories.push_back(std::string(PLUGIN_DIR)) ;
|
||||||
#endif
|
#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*> >
|
mKvData.insert(std::pair<std::string, std::pair<uint32_t, char*> >
|
||||||
(key, std::pair<uint32_t, char*>(len, dest)));
|
(key, std::pair<uint32_t, char*>(len, dest)));
|
||||||
|
//delete[] dest; //Deleted by clearData()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContentValue::getAsBool(const std::string &key, bool& value) const{
|
bool ContentValue::getAsBool(const std::string &key, bool& value) const{
|
||||||
|
@ -572,7 +572,15 @@ static int parse_headers(dearmour_arg_t *arg,ops_error_t **errors,
|
|||||||
if(size <= nbuf+1)
|
if(size <= nbuf+1)
|
||||||
{
|
{
|
||||||
size+=size+80;
|
size+=size+80;
|
||||||
buf=realloc(buf,size);
|
char *nbuf;
|
||||||
|
nbuf=realloc(buf,size);
|
||||||
|
if (nbuf == NULL)
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
rtn=-1;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
buf = nbuf;
|
||||||
}
|
}
|
||||||
buf[nbuf++]=c;
|
buf[nbuf++]=c;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
temp = "";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 4; ++i) {
|
||||||
if (fileSize < 1024) {
|
if (fileSize < 1024) {
|
||||||
fileSize = index.data().toLongLong();
|
fileSize = index.data().toLongLong();
|
||||||
temp.sprintf("%.2f ", fileSize / multi);
|
temp.sprintf("%.2f ", fileSize / multi);
|
||||||
@ -115,7 +115,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
temp = "";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 4; ++i) {
|
||||||
if (remaining < 1024) {
|
if (remaining < 1024) {
|
||||||
remaining = index.data().toLongLong();
|
remaining = index.data().toLongLong();
|
||||||
temp.sprintf("%.2f ", remaining / multi);
|
temp.sprintf("%.2f ", remaining / multi);
|
||||||
@ -134,7 +134,7 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
temp = "";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 4; ++i) {
|
||||||
if (completed < 1024) {
|
if (completed < 1024) {
|
||||||
completed = index.data().toLongLong();
|
completed = index.data().toLongLong();
|
||||||
temp.sprintf("%.2f ", completed / multi);
|
temp.sprintf("%.2f ", completed / multi);
|
||||||
|
@ -85,7 +85,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
temp = "";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 4; ++i) {
|
||||||
if (fileSize < 1024) {
|
if (fileSize < 1024) {
|
||||||
fileSize = index.data().toLongLong();
|
fileSize = index.data().toLongLong();
|
||||||
temp.sprintf("%.2f ", fileSize / multi);
|
temp.sprintf("%.2f ", fileSize / multi);
|
||||||
@ -104,7 +104,7 @@ void ULListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
|
|||||||
temp = "";
|
temp = "";
|
||||||
} else {
|
} else {
|
||||||
multi = 1.0;
|
multi = 1.0;
|
||||||
for(int i = 0; i < 5; ++i) {
|
for(int i = 0; i < 4; ++i) {
|
||||||
if (transferred < 1024) {
|
if (transferred < 1024) {
|
||||||
transferred = index.data().toLongLong();
|
transferred = index.data().toLongLong();
|
||||||
temp.sprintf("%.2f ", transferred / multi);
|
temp.sprintf("%.2f ", transferred / multi);
|
||||||
|
@ -768,7 +768,7 @@ void PeopleDialog::pf_dropEventOccursExt(QDropEvent *event)
|
|||||||
|
|
||||||
QWidget *wid =
|
QWidget *wid =
|
||||||
qobject_cast<QWidget *>(event->source());//QT5 return QObject
|
qobject_cast<QWidget *>(event->source());//QT5 return QObject
|
||||||
FlowLayout *layout;
|
FlowLayout *layout = NULL;
|
||||||
if (wid) layout =
|
if (wid) layout =
|
||||||
qobject_cast<FlowLayout *>(wid->layout());
|
qobject_cast<FlowLayout *>(wid->layout());
|
||||||
if (layout) {
|
if (layout) {
|
||||||
@ -858,7 +858,7 @@ void PeopleDialog::pf_dropEventOccursInt(QDropEvent *event)
|
|||||||
|
|
||||||
QWidget *wid =
|
QWidget *wid =
|
||||||
qobject_cast<QWidget *>(event->source());//QT5 return QObject
|
qobject_cast<QWidget *>(event->source());//QT5 return QObject
|
||||||
FlowLayout *layout;
|
FlowLayout *layout = NULL;
|
||||||
if (wid) layout =
|
if (wid) layout =
|
||||||
qobject_cast<FlowLayout *>(wid->layout());
|
qobject_cast<FlowLayout *>(wid->layout());
|
||||||
if (layout) {
|
if (layout) {
|
||||||
|
@ -177,7 +177,7 @@ void AvatarWidget::refreshStatus()
|
|||||||
}
|
}
|
||||||
case STATUS_FRAME:
|
case STATUS_FRAME:
|
||||||
{
|
{
|
||||||
uint32_t status ;
|
uint32_t status = 0;
|
||||||
|
|
||||||
if(mId.isNotSet())
|
if(mId.isNotSet())
|
||||||
return ;
|
return ;
|
||||||
|
@ -1818,7 +1818,7 @@ bool FriendList::importExportFriendlistFileDialog(QString &fileName, bool import
|
|||||||
{
|
{
|
||||||
if(!misc::getSaveFileName(this,
|
if(!misc::getSaveFileName(this,
|
||||||
RshareSettings::LASTDIR_CERT,
|
RshareSettings::LASTDIR_CERT,
|
||||||
(import ? tr("Select file for importing yoour friendlist from") :
|
(import ? tr("Select file for importing your friendlist from") :
|
||||||
tr("Select a file for exporting your friendlist to")),
|
tr("Select a file for exporting your friendlist to")),
|
||||||
tr("XML File (*.xml);;All Files (*)"),
|
tr("XML File (*.xml);;All Files (*)"),
|
||||||
fileName,
|
fileName,
|
||||||
|
@ -802,6 +802,7 @@ bool fill_stream_data(rsctrl::stream::StreamData &data, const RpcStream &stream)
|
|||||||
{
|
{
|
||||||
std::cerr << "fill_stream_data() Failed to get data. data_size=" << data_size << ", base_loc=" << base_loc << " !";
|
std::cerr << "fill_stream_data() Failed to get data. data_size=" << data_size << ", base_loc=" << base_loc << " !";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
free(buffer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +147,7 @@ void g_string_append_printf(GString* baseString, char* format, ...)
|
|||||||
g_string_append(baseString, formattedString);
|
g_string_append(baseString, formattedString);
|
||||||
free(formattedString);
|
free(formattedString);
|
||||||
}
|
}
|
||||||
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void g_string_prepend(GString* baseString, char* prependedString)
|
void g_string_prepend(GString* baseString, char* prependedString)
|
||||||
|
@ -187,12 +187,11 @@ bool operator==(const RsTurtleStringSearchRequestItem& it1,const RsTurtleStringS
|
|||||||
return false ;
|
return false ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
RsSerialType* init_item(TurtleFileInfo& info)
|
void init_item(TurtleFileInfo& info)
|
||||||
{
|
{
|
||||||
info.hash = RsFileHash("3f753e8ac3b94ab9fddfad94480f747bf4418370");
|
info.hash = RsFileHash("3f753e8ac3b94ab9fddfad94480f747bf4418370");
|
||||||
info.name = "toto.png";
|
info.name = "toto.png";
|
||||||
info.size = 0x3392085443897ull ;
|
info.size = 0x3392085443897ull ;
|
||||||
return new RsTurtleSerialiser();
|
|
||||||
}
|
}
|
||||||
bool operator==(const TurtleFileInfo& it1,const TurtleFileInfo& it2)
|
bool operator==(const TurtleFileInfo& it1,const TurtleFileInfo& it2)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user