mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -05:00
Changed parameter of the methods of pqiNotify from "std::string" to "const std::string&"
Stops loading of a cache in p3GroupDistrib::loadFileMsgs on shutdown of RetroShare. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4363 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
04ce05025f
commit
aab46a5295
@ -128,7 +128,7 @@ bool p3Notify::SetPopupMessageMode(uint32_t ptype, uint32_t mode)
|
||||
|
||||
|
||||
/* Input from libretroshare */
|
||||
bool p3Notify::AddPopupMessage(uint32_t ptype, std::string name, std::string title, std::string msg)
|
||||
bool p3Notify::AddPopupMessage(uint32_t ptype, const std::string& name, const std::string& title, const std::string& msg)
|
||||
{
|
||||
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
|
||||
|
||||
@ -136,7 +136,7 @@ bool p3Notify::AddPopupMessage(uint32_t ptype, std::string name, std::string tit
|
||||
|
||||
pmsg.type = ptype;
|
||||
pmsg.name = name;
|
||||
pmsg.title = title;
|
||||
pmsg.title = title;
|
||||
pmsg.msg = msg;
|
||||
|
||||
pendingPopupMsgs.push_back(pmsg);
|
||||
@ -145,8 +145,7 @@ bool p3Notify::AddPopupMessage(uint32_t ptype, std::string name, std::string tit
|
||||
}
|
||||
|
||||
|
||||
bool p3Notify::AddSysMessage(uint32_t sysid, uint32_t type,
|
||||
std::string title, std::string msg)
|
||||
bool p3Notify::AddSysMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg)
|
||||
{
|
||||
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
|
||||
|
||||
@ -162,8 +161,7 @@ bool p3Notify::AddSysMessage(uint32_t sysid, uint32_t type,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Notify::AddLogMessage(uint32_t sysid, uint32_t type,
|
||||
std::string title, std::string msg)
|
||||
bool p3Notify::AddLogMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg)
|
||||
{
|
||||
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
|
||||
|
||||
@ -195,7 +193,7 @@ bool p3Notify::GetFeedItem(RsFeedItem &item)
|
||||
}
|
||||
|
||||
|
||||
bool p3Notify::AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3)
|
||||
bool p3Notify::AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3)
|
||||
{
|
||||
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
|
||||
pendingNewsFeed.push_back(RsFeedItem(type, id1, id2, id3));
|
||||
|
@ -70,8 +70,7 @@ class p3Notify: public RsNotify, public pqiNotify
|
||||
virtual ~p3Notify() { return; }
|
||||
|
||||
/* Output for retroshare-gui */
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg);
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg);
|
||||
virtual bool NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &title, std::string &msg);
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg);
|
||||
|
||||
@ -85,10 +84,10 @@ virtual bool SetPopupMessageMode(uint32_t ptype, uint32_t mode);
|
||||
virtual bool GetFeedItem(RsFeedItem &item);
|
||||
|
||||
/* Overloaded from pqiNotify */
|
||||
virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string title, std::string msg);
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg);
|
||||
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg);
|
||||
virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3);
|
||||
virtual bool AddPopupMessage(uint32_t ptype, const std::string& name, const std::string& title, const std::string& msg);
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3);
|
||||
virtual bool ClearFeedItems(uint32_t type);
|
||||
|
||||
private:
|
||||
|
@ -40,10 +40,10 @@ class pqiNotify
|
||||
virtual ~pqiNotify() { return; }
|
||||
|
||||
/* Input from libretroshare */
|
||||
virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string title, std::string msg) = 0;
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg) = 0;
|
||||
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg) = 0;
|
||||
virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3) = 0;
|
||||
virtual bool AddPopupMessage(uint32_t ptype, const std::string& name, const std::string& title, const std::string& msg) = 0;
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg) = 0;
|
||||
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg) = 0;
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3) = 0;
|
||||
virtual bool ClearFeedItems(uint32_t type) = 0;
|
||||
};
|
||||
|
||||
|
@ -292,14 +292,14 @@ const uint32_t DOWNLOAD_PERIOD = 7 * 24 * 3600;
|
||||
*
|
||||
*/
|
||||
|
||||
bool p3Blogs::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std::string id, bool historical)
|
||||
bool p3Blogs::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
bool p3Blogs::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, std::string id, bool historical)
|
||||
bool p3Blogs::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
std::string grpId = msg->grpId;
|
||||
std::string msgId = msg->msgId;
|
||||
|
@ -115,8 +115,8 @@ virtual bool isReply(BlogMsgInfo& info);
|
||||
|
||||
protected:
|
||||
virtual void locked_notifyGroupChanged(GroupInfo &info, uint32_t flags, bool historical);
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, std::string, bool historical);
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, std::string, bool historical);
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, const std::string&, bool historical);
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, const std::string&, bool historical);
|
||||
|
||||
|
||||
/****************************************/
|
||||
|
@ -727,7 +727,7 @@ const uint32_t DOWNLOAD_PERIOD = 7 * 24 * 3600;
|
||||
* on a subscription to a channel..
|
||||
*/
|
||||
|
||||
bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std::string id, bool historical)
|
||||
bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
std::string grpId = msg->grpId;
|
||||
std::string msgId = msg->msgId;
|
||||
@ -882,7 +882,7 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
|
||||
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, std::string id, bool historical)
|
||||
bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
std::string grpId = msg->grpId;
|
||||
std::string msgId = msg->msgId;
|
||||
|
@ -92,8 +92,8 @@ virtual bool channelGetAutoDl(const std::string& chId, bool& autoDl);
|
||||
|
||||
protected:
|
||||
virtual void locked_notifyGroupChanged(GroupInfo &info, uint32_t flags, bool historical);
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, std::string, bool historical);
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, std::string, bool historical);
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, const std::string&, bool historical);
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, const std::string&, bool historical);
|
||||
|
||||
|
||||
/****************************************/
|
||||
|
@ -912,39 +912,39 @@ void p3GroupDistrib::run() /* called once the thread is started */
|
||||
bool isLocal = false;
|
||||
bool isHistorical = false;
|
||||
{
|
||||
RsStackMutex stack(distribMtx);
|
||||
if(!mHistoricalCaches){
|
||||
RsStackMutex stack(distribMtx);
|
||||
if(!mHistoricalCaches){
|
||||
|
||||
|
||||
if(mPendingHistCaches.size() > 0){
|
||||
if(mPendingHistCaches.size() > 0){
|
||||
|
||||
// std::cerr << "loaded pending caches: " << mPendingHistCaches.size() << std::endl;
|
||||
CacheDataPending &pendingCache = mPendingHistCaches.front();
|
||||
cache = pendingCache.mData;
|
||||
isLocal = pendingCache.mLocal;
|
||||
isHistorical = pendingCache.mHistorical;
|
||||
// std::cerr << "loaded pending caches: " << mPendingHistCaches.size() << std::endl;
|
||||
CacheDataPending &pendingCache = mPendingHistCaches.front();
|
||||
cache = pendingCache.mData;
|
||||
isLocal = pendingCache.mLocal;
|
||||
isHistorical = pendingCache.mHistorical;
|
||||
|
||||
validCache = true;
|
||||
mPendingHistCaches.pop_front();
|
||||
}
|
||||
else if (mPendingCaches.size() > 0)
|
||||
{
|
||||
CacheDataPending &pendingCache = mPendingCaches.front();
|
||||
cache = pendingCache.mData;
|
||||
isLocal = pendingCache.mLocal;
|
||||
isHistorical = pendingCache.mHistorical;
|
||||
validCache = true;
|
||||
mPendingHistCaches.pop_front();
|
||||
}
|
||||
else if (mPendingCaches.size() > 0)
|
||||
{
|
||||
CacheDataPending &pendingCache = mPendingCaches.front();
|
||||
cache = pendingCache.mData;
|
||||
isLocal = pendingCache.mLocal;
|
||||
isHistorical = pendingCache.mHistorical;
|
||||
|
||||
validCache = true;
|
||||
mPendingCaches.pop_front();
|
||||
validCache = true;
|
||||
mPendingCaches.pop_front();
|
||||
|
||||
#ifdef DISTRIB_THREAD_DEBUG
|
||||
std::cerr << "p3GroupDistrib::run() found pendingCache";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "p3GroupDistrib::run() found pendingCache";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validCache)
|
||||
{
|
||||
loadAnyCache(cache, isLocal, isHistorical);
|
||||
@ -1000,16 +1000,15 @@ int p3GroupDistrib::loadAnyCache(const CacheData &data, bool local, bool his
|
||||
std::cerr << "Cid: " << data.cid.type << ":" << data.cid.subid << std::endl;
|
||||
#endif
|
||||
|
||||
if (data.cid.subid == 1)
|
||||
{
|
||||
|
||||
cidPair = std::make_pair(data.pid, data.cid.subid);
|
||||
loadFileGroups(file, data.pid, local, historical, cidPair);
|
||||
}
|
||||
else
|
||||
{
|
||||
loadFileMsgs(file, data.cid.subid, data.pid, data.recvd, local, historical);
|
||||
}
|
||||
if (data.cid.subid == 1)
|
||||
{
|
||||
cidPair = std::make_pair(data.pid, data.cid.subid);
|
||||
loadFileGroups(file, data.pid, local, historical, cidPair);
|
||||
}
|
||||
else
|
||||
{
|
||||
loadFileMsgs(file, data.cid.subid, data.pid, data.recvd, local, historical);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1141,9 +1140,7 @@ void p3GroupDistrib::loadFileMsgs(const std::string &filename, uint16_t cacheSub
|
||||
RsDistribSignedMsg *newMsg;
|
||||
std::string grpId;
|
||||
|
||||
|
||||
|
||||
while(NULL != (item = store->GetItem()))
|
||||
while(isRunning() && (NULL != (item = store->GetItem())))
|
||||
{
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::loadFileMsgs() Got Item:";
|
||||
@ -1157,13 +1154,11 @@ void p3GroupDistrib::loadFileMsgs(const std::string &filename, uint16_t cacheSub
|
||||
grpId = newMsg->grpId;
|
||||
if(loadMsg(newMsg, src, local, historical))
|
||||
{
|
||||
|
||||
if(cache)
|
||||
{
|
||||
msgCacheMap.insert(grpCachePair(grpId, pCacheId(src, cacheSubId)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1198,8 +1193,6 @@ void p3GroupDistrib::loadFileMsgs(const std::string &filename, uint16_t cacheSub
|
||||
mMsgHistPending.push_back(grpCachePair(failedCacheId, failedCache));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (local)
|
||||
{
|
||||
/* now we create a map of time -> subid
|
||||
@ -1277,8 +1270,6 @@ void p3GroupDistrib::locked_loadFileMsgs(const std::string &filename, uint16_t c
|
||||
RsDistribSignedMsg *newMsg;
|
||||
std::string grpId;
|
||||
|
||||
|
||||
|
||||
while(NULL != (item = store->GetItem()))
|
||||
{
|
||||
#ifdef DISTRIB_DEBUG
|
||||
@ -1293,13 +1284,11 @@ void p3GroupDistrib::locked_loadFileMsgs(const std::string &filename, uint16_t c
|
||||
grpId = newMsg->grpId;
|
||||
if(locked_loadMsg(newMsg, src, local, historical))
|
||||
{
|
||||
|
||||
if(cache)
|
||||
{
|
||||
msgCacheMap.insert(grpCachePair(grpId, pCacheId(src, cacheSubId)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1332,8 +1321,6 @@ void p3GroupDistrib::locked_loadFileMsgs(const std::string &filename, uint16_t c
|
||||
mMsgHistPending.push_back(grpCachePair(failedCacheId, failedCache));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (local)
|
||||
{
|
||||
/* now we create a map of time -> subid
|
||||
@ -1519,18 +1506,15 @@ bool p3GroupDistrib::loadGroupKey(RsDistribGrpKey *newKey, bool historical)
|
||||
{
|
||||
|
||||
#ifdef DISTRIB_DEBUG
|
||||
|
||||
std::cerr << "p3GroupDistrib::loadGroupKey() Group for key not found: discarding";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "p3GroupDistrib::loadGroupKey() Group for key not found: discarding";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
delete newKey;
|
||||
newKey = NULL;
|
||||
return false;
|
||||
|
||||
delete newKey;
|
||||
newKey = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* have the group -> add in the key */
|
||||
bool updateOk = false;
|
||||
if (newKey->key.keyFlags & RSTLV_KEY_DISTRIB_ADMIN)
|
||||
@ -1549,7 +1533,7 @@ bool p3GroupDistrib::loadGroupKey(RsDistribGrpKey *newKey, bool historical)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!locked_updateGroupPublishKey(it->second, newKey))
|
||||
if(!locked_updateGroupPublishKey(it->second, newKey))
|
||||
{
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::loadGroupKey() Failed Publish Key Update";
|
||||
@ -1559,27 +1543,22 @@ bool p3GroupDistrib::loadGroupKey(RsDistribGrpKey *newKey, bool historical)
|
||||
else
|
||||
{
|
||||
updateOk = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (updateOk)
|
||||
locked_notifyGroupChanged(it->second, GRP_LOAD_KEY, historical);
|
||||
|
||||
|
||||
if (updateOk)
|
||||
locked_notifyGroupChanged(it->second, GRP_LOAD_KEY, historical);
|
||||
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::loadGroupKey() Done - Cleaning up.";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
// if(!updateOk)
|
||||
delete newKey;
|
||||
// if(!updateOk)
|
||||
delete newKey;
|
||||
|
||||
newKey = NULL;
|
||||
return updateOk;
|
||||
newKey = NULL;
|
||||
return updateOk;
|
||||
}
|
||||
|
||||
|
||||
@ -1620,7 +1599,6 @@ bool p3GroupDistrib::loadMsg(RsDistribSignedMsg *newMsg, const std::string &src,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/****************** check the msg ******************/
|
||||
/* check for duplicate message, do this first to ensure minimal signature validations.
|
||||
* therefore, duplicateMsg... could potentially be called on a dodgey msg (not a big problem!)
|
||||
@ -1651,26 +1629,24 @@ bool p3GroupDistrib::loadMsg(RsDistribSignedMsg *newMsg, const std::string &src,
|
||||
return false;
|
||||
}
|
||||
|
||||
void *temp_ptr = newMsg->packet.bin_data;
|
||||
int temp_len = newMsg->packet.bin_len;
|
||||
void *temp_ptr = newMsg->packet.bin_data;
|
||||
int temp_len = newMsg->packet.bin_len;
|
||||
|
||||
if(git->second.grpFlags & RS_DISTRIB_ENCRYPTED){
|
||||
void *out_data = NULL;
|
||||
int out_len = 0;
|
||||
|
||||
void *out_data = NULL;
|
||||
int out_len = 0;
|
||||
|
||||
if(decrypt(out_data, out_len, newMsg->packet.bin_data, newMsg->packet.bin_len, newMsg->grpId)){
|
||||
newMsg->packet.TlvShallowClear();
|
||||
newMsg->packet.setBinData(out_data, out_len);
|
||||
delete[] (unsigned char*) out_data;
|
||||
|
||||
if(decrypt(out_data, out_len, newMsg->packet.bin_data, newMsg->packet.bin_len, newMsg->grpId)){
|
||||
newMsg->packet.TlvShallowClear();
|
||||
newMsg->packet.setBinData(out_data, out_len);
|
||||
delete[] (unsigned char*) out_data;
|
||||
}else{
|
||||
if((out_data != NULL) && (out_len != 0))
|
||||
delete[] (unsigned char*) out_data;
|
||||
|
||||
if((out_data != NULL) && (out_len != 0))
|
||||
delete[] (unsigned char*) out_data;
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::loadMsg() Failed to decrypt" << std::endl;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "p3GroupDistrib::loadMsg() Failed to decrypt" << std::endl;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -1718,7 +1694,6 @@ bool p3GroupDistrib::loadMsg(RsDistribSignedMsg *newMsg, const std::string &src,
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
/* Callback for any derived classes to play with */
|
||||
locked_eventNewMsg(&(git->second), msg, src, historical);
|
||||
|
||||
@ -1731,10 +1706,10 @@ bool p3GroupDistrib::loadMsg(RsDistribSignedMsg *newMsg, const std::string &src,
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if(git->second.grpFlags & RS_DISTRIB_ENCRYPTED){
|
||||
newMsg->packet.TlvClear();
|
||||
newMsg->packet.setBinData(temp_ptr, temp_len);
|
||||
}
|
||||
if(git->second.grpFlags & RS_DISTRIB_ENCRYPTED){
|
||||
newMsg->packet.TlvClear();
|
||||
newMsg->packet.setBinData(temp_ptr, temp_len);
|
||||
}
|
||||
|
||||
locked_toPublishMsg(newMsg);
|
||||
}
|
||||
@ -4302,8 +4277,7 @@ bool p3GroupDistrib::locked_choosePublishKey(GroupInfo &info)
|
||||
|
||||
/********************/
|
||||
|
||||
bool p3GroupDistrib::locked_validateDistribSignedMsg(
|
||||
GroupInfo &info, RsDistribSignedMsg *newMsg)
|
||||
bool p3GroupDistrib::locked_validateDistribSignedMsg(GroupInfo &info, RsDistribSignedMsg *newMsg)
|
||||
{
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::locked_validateDistribSignedMsg()";
|
||||
@ -4351,12 +4325,11 @@ bool p3GroupDistrib::locked_validateDistribSignedMsg(
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* decode key */
|
||||
const unsigned char *keyptr = (const unsigned char *) kit->second.keyData.bin_data;
|
||||
long keylen = kit->second.keyData.bin_len;
|
||||
unsigned int siglen = newMsg->publishSignature.signData.bin_len;
|
||||
unsigned char *sigbuf = (unsigned char *) newMsg->publishSignature.signData.bin_data;
|
||||
unsigned char *sigbuf = (unsigned char *) newMsg->publishSignature.signData.bin_data;
|
||||
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::locked_validateDistribSignedMsg() Decode Key";
|
||||
@ -4397,14 +4370,13 @@ bool p3GroupDistrib::locked_validateDistribSignedMsg(
|
||||
EVP_PKEY_free(signKey);
|
||||
EVP_MD_CTX_destroy(mdctx);
|
||||
|
||||
|
||||
/* now verify Personal signature */
|
||||
if ((signOk == 1) && ((info.grpFlags & RS_DISTRIB_AUTHEN_MASK) & RS_DISTRIB_AUTHEN_REQ))
|
||||
if ((signOk == 1) && ((info.grpFlags & RS_DISTRIB_AUTHEN_MASK) & RS_DISTRIB_AUTHEN_REQ))
|
||||
{
|
||||
unsigned int personalsiglen =
|
||||
newMsg->personalSignature.signData.bin_len;
|
||||
unsigned char *personalsigbuf = (unsigned char *)
|
||||
newMsg->personalSignature.signData.bin_data;
|
||||
unsigned int personalsiglen =
|
||||
newMsg->personalSignature.signData.bin_len;
|
||||
unsigned char *personalsigbuf = (unsigned char *)
|
||||
newMsg->personalSignature.signData.bin_data;
|
||||
|
||||
RsPeerDetails signerDetails;
|
||||
std::string gpg_fpr;
|
||||
@ -4413,20 +4385,20 @@ bool p3GroupDistrib::locked_validateDistribSignedMsg(
|
||||
gpg_fpr = signerDetails.fpr;
|
||||
}
|
||||
|
||||
bool gpgSign = AuthGPG::getAuthGPG()->VerifySignBin(
|
||||
newMsg->packet.bin_data, newMsg->packet.bin_len,
|
||||
personalsigbuf, personalsiglen, gpg_fpr);
|
||||
if (gpgSign) {
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::locked_validateDistribSignedMsg() Success for gpg signature." << std::endl;
|
||||
#endif
|
||||
signOk = 1;
|
||||
} else {
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::locked_validateDistribSignedMsg() Fail for gpg signature." << std::endl;
|
||||
#endif
|
||||
signOk = 0;
|
||||
}
|
||||
bool gpgSign = AuthGPG::getAuthGPG()->VerifySignBin(
|
||||
newMsg->packet.bin_data, newMsg->packet.bin_len,
|
||||
personalsigbuf, personalsiglen, gpg_fpr);
|
||||
if (gpgSign) {
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::locked_validateDistribSignedMsg() Success for gpg signature." << std::endl;
|
||||
#endif
|
||||
signOk = 1;
|
||||
} else {
|
||||
#ifdef DISTRIB_DEBUG
|
||||
std::cerr << "p3GroupDistrib::locked_validateDistribSignedMsg() Fail for gpg signature." << std::endl;
|
||||
#endif
|
||||
signOk = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (signOk == 1)
|
||||
|
@ -580,7 +580,7 @@ class p3GroupDistrib: public CacheSource, public CacheStore, public p3Config, pu
|
||||
* @param historical: is this msg from an historical cache
|
||||
* @return successfully executed or not
|
||||
*/
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, std::string id, bool historical) = 0;
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, const std::string& id, bool historical) = 0;
|
||||
|
||||
/*!
|
||||
* Inheriting class should implement this as a response to a new msg arriving
|
||||
@ -590,7 +590,7 @@ class p3GroupDistrib: public CacheSource, public CacheStore, public p3Config, pu
|
||||
* @param historical: is this msg from an historical cache
|
||||
* @return
|
||||
*/
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, std::string id, bool historical) = 0;
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, const std::string& id, bool historical) = 0;
|
||||
|
||||
/***************************************************************************************/
|
||||
/********************************* p3Config ********************************************/
|
||||
|
@ -634,12 +634,12 @@ void p3Forums::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool h
|
||||
return p3GroupDistrib::locked_notifyGroupChanged(grp, flags, historical);
|
||||
}
|
||||
|
||||
bool p3Forums::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std::string id, bool historical)
|
||||
bool p3Forums::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Forums::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, std::string id, bool historical)
|
||||
bool p3Forums::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
std::string grpId = msg->grpId;
|
||||
std::string msgId = msg->msgId;
|
||||
|
@ -69,8 +69,8 @@ virtual bool getMessageCount(const std::string &fId, unsigned int &newCount, uns
|
||||
/***************************************************************************************/
|
||||
|
||||
virtual void locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool historical);
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, std::string, bool historical);
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, std::string, bool historical);
|
||||
virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, const std::string&, bool historical);
|
||||
virtual bool locked_eventNewMsg(GroupInfo *, RsDistribMsg *, const std::string&, bool historical);
|
||||
|
||||
|
||||
/****************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user