fixed checking of signature for own ids when loading in cache

This commit is contained in:
csoler 2018-09-09 21:22:08 +02:00
parent 3402f7d9b5
commit 59a76a9418
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 26 additions and 9 deletions

View File

@ -262,10 +262,6 @@ int p3discovery2::handleIncoming()
{
RsItem *item = NULL;
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::handleIncoming()" << std::endl;
#endif
int nhandled = 0;
// While messages read
while(NULL != (item = recvItem()))
@ -324,10 +320,6 @@ int p3discovery2::handleIncoming()
}
}
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::handleIncoming() finished." << std::endl;
#endif
return nhandled;
}
@ -372,6 +364,11 @@ void p3discovery2::sendOwnContactInfo(const SSLID &sslid)
rsIdentity->getOwnIds(pkt2->ownIdentityList,true);
pkt2->PeerId(sslid) ;
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::sendOwnContactInfo() sending own signed identity list:" << std::endl;
for(auto it(pkt2->ownIdentityList.begin());it!=pkt2->ownIdentityList.end();++it)
std::cerr << " identity: " << (*it).toStdString() << std::endl;
#endif
sendItem(pkt2);
}
}
@ -454,11 +451,20 @@ void p3discovery2::recvIdentityList(const RsPeerId& pid,const std::list<RsGxsId>
std::list<RsPeerId> peers;
peers.push_back(pid);
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::recvIdentityList(): from peer " << pid << ": " << ids.size() << " identities" << std::endl;
#endif
RsIdentityUsage use_info(RS_SERVICE_TYPE_DISC,RsIdentityUsage::IDENTITY_DATA_UPDATE);
for(auto it(ids.begin());it!=ids.end();++it)
{
#ifdef P3DISC_DEBUG
std::cerr << " identity: " << (*it).toStdString() << std::endl;
#endif
mGixs->requestKey(*it,peers,use_info) ;
}
}
void p3discovery2::updatePeerAddresses(const RsDiscContactItem *item)
{

View File

@ -2826,8 +2826,17 @@ bool p3IdService::cache_load_ownids(uint32_t token)
{
mOwnIds.push_back(RsGxsId(item->meta.mGroupId));
if(item->meta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
SSGxsIdGroup ssdata;
std::cerr << "Adding own ID " << item->meta.mGroupId << " mGroupFlags=" << std::hex << item->meta.mGroupFlags << std::dec;
if (ssdata.load(item->meta.mServiceString) && ssdata.pgp.validatedSignature) // (cyril) note: we cannot use if(item->meta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{ // or we need to cmbine it with the deprecated value that overlaps with GXS_SERV::FLAG_PRIVACY_PRIVATE
std::cerr << " signed = YES" << std::endl; // see comments line 799 in ::createIdentity();
mOwnSignedIds.push_back(RsGxsId(item->meta.mGroupId));
}
else
std::cerr << " signed = NO" << std::endl;
// This prevents automatic deletion to get rid of them.
// In other words, own ids are always used.
@ -2837,6 +2846,8 @@ bool p3IdService::cache_load_ownids(uint32_t token)
delete item ;
}
mOwnIdsLoaded = true ;
std::cerr << mOwnIds.size() << " own Ids loaded, " << mOwnSignedIds.size() << " of which are signed" << std::endl;
}
// No need to cache these items...