mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-16 01:47:17 -05:00
more debugging of group update
- did not correctly perform sync - admin signature validation was being skipped! - still niggly issue with admin signature validation git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs_finale@6829 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
25d721b6fe
commit
fc1b7fcb5c
@ -663,9 +663,8 @@ int RsDataService::updateGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
||||
if(!validSize(grpPtr)) continue;
|
||||
|
||||
std::string grpFile = mServiceDir + "/" + grpPtr->grpId;
|
||||
std::fstream ostrm(grpFile.c_str(), std::ios::binary | std::ios::app | std::ios::trunc);
|
||||
ostrm.seekg(0, std::ios::end); // go to end to append
|
||||
uint32_t offset = ostrm.tellg(); // get fill offset
|
||||
std::fstream ostrm(grpFile.c_str(), std::ios::binary | std::ios::trunc);
|
||||
uint32_t offset = 0; // get file offset
|
||||
|
||||
/*!
|
||||
* STORE file offset, file length, file name,
|
||||
|
@ -316,6 +316,8 @@ void RsGenExchange::generatePublicFromPrivateKeys(const RsTlvSecurityKeySet &pri
|
||||
if(pubKey.keyFlags & RSTLV_KEY_DISTRIB_PRIVATE)
|
||||
pubKey.keyFlags = RSTLV_KEY_DISTRIB_PRIVATE | RSTLV_KEY_TYPE_PUBLIC_ONLY;
|
||||
|
||||
pubKey.endTS = pubKey.startTS + 60 * 60 * 24 * 365 * 5; /* approx 5 years */
|
||||
|
||||
publickeySet.keys.insert(std::make_pair(pubKey.keyId, pubKey));
|
||||
}
|
||||
|
||||
@ -2384,14 +2386,14 @@ void RsGenExchange::processRecvdGroups()
|
||||
meta->mGroupStatus = GXS_SERV::GXS_GRP_STATUS_UNPROCESSED | GXS_SERV::GXS_GRP_STATUS_UNREAD;
|
||||
meta->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED;
|
||||
|
||||
if(meta->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
||||
meta->mOriginator = grp->PeerId();
|
||||
|
||||
computeHash(grp->grp, meta->mHash);
|
||||
|
||||
// now check if group already existss
|
||||
if(std::find(existingGrpIds.begin(), existingGrpIds.end(), grp->grpId) == existingGrpIds.end())
|
||||
{
|
||||
if(meta->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
||||
meta->mOriginator = grp->PeerId();
|
||||
|
||||
grps.insert(std::make_pair(grp, meta));
|
||||
grpIds.push_back(grp->grpId);
|
||||
}
|
||||
@ -2455,6 +2457,9 @@ void RsGenExchange::processRecvdGroups()
|
||||
|
||||
void RsGenExchange::performUpdateValidation()
|
||||
{
|
||||
|
||||
RsStackMutex stack(mGenMtx);
|
||||
|
||||
#ifdef GXS_GENX_DEBUG
|
||||
std::cerr << "RsGenExchange::performUpdateValidation() " << std::endl;
|
||||
#endif
|
||||
@ -2492,7 +2497,19 @@ void RsGenExchange::performUpdateValidation()
|
||||
for(; vit != mGroupUpdates.end(); vit++)
|
||||
{
|
||||
GroupUpdate& gu = *vit;
|
||||
grps.insert(std::make_pair(gu.newGrp, gu.newGrp->metaData));
|
||||
|
||||
if(gu.validUpdate)
|
||||
{
|
||||
if(gu.newGrp->metaData->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY)
|
||||
gu.newGrp->metaData->mOriginator = gu.newGrp->PeerId();
|
||||
|
||||
grps.insert(std::make_pair(gu.newGrp, gu.newGrp->metaData));
|
||||
}
|
||||
else
|
||||
{
|
||||
delete gu.newGrp;
|
||||
}
|
||||
|
||||
delete gu.oldGrpMeta;
|
||||
}
|
||||
|
||||
|
@ -1383,12 +1383,11 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
|
||||
const std::string& grpId = grpSyncItem->grpId;
|
||||
metaIter = grpMetaMap.find(grpId);
|
||||
bool haveItem = metaIter != grpMetaMap.end();
|
||||
bool latestItem = false;
|
||||
bool latestVersion = false;
|
||||
|
||||
if(!haveItem)
|
||||
latestItem = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
||||
latestVersion = grpSyncItem->publishTs > metaIter->second->mPublishTs;
|
||||
|
||||
if(haveItem && latestItem){
|
||||
if(!haveItem || (haveItem && latestVersion) ){
|
||||
|
||||
// determine if you need to check reputation
|
||||
bool checkRep = !grpSyncItem->authorId.empty();
|
||||
|
Loading…
Reference in New Issue
Block a user