added a flag in peerState specific to short invites, and several checks for consistency

This commit is contained in:
csoler 2019-05-22 21:46:11 +02:00
parent dac76439bd
commit 56e591f728
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
4 changed files with 91 additions and 13 deletions

View file

@ -571,7 +571,20 @@ bool p3Peers::isPgpFriend(const RsPgpId& pgpId)
{ return AuthGPG::getAuthGPG()->isGPGAccepted(pgpId); }
bool p3Peers::isSslOnlyFriend(const RsPeerId& sslId)
{ return isFriend(sslId) && !isPgpFriend(getGPGId(sslId)); }
{
bool has_ssl_only_flag = mPeerMgr->isSslOnlyFriend(sslId) ;
if(has_ssl_only_flag)
{
if(isPgpFriend(getGPGId(sslId)))
{
RsErr() << "Peer " << sslId << " has SSL-friend-only flag but his PGP id is in the list of friends. This is inconsistent (Bug in the code). Returning false for security reasons." << std::endl;
return false;
}
return true;
}
return false;
}
bool p3Peers::isGPGAccepted(const RsPgpId &gpg_id_is_friend)
{ return isPgpFriend(gpg_id_is_friend); }