mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-07 00:25:16 -04:00
prevent subscribing to a signed chat room without a signed identity
This commit is contained in:
parent
eea0c64d1c
commit
0f6006d140
3 changed files with 46 additions and 6 deletions
|
@ -1403,13 +1403,33 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
|
|||
return false;
|
||||
}
|
||||
|
||||
std::map<ChatLobbyId,VisibleChatLobbyRecord>::const_iterator vid = _visible_lobbies.find(lobby_id) ;
|
||||
|
||||
if(_visible_lobbies.end() == vid)
|
||||
{
|
||||
std::cerr << " (EE) Cannot subscribe a non visible chat lobby!!" << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
RsIdentityDetails det ;
|
||||
if( (!rsIdentity->getIdDetails(identity,det)) || !(det.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID))
|
||||
{
|
||||
std::cerr << " (EE) Cannot subscribe with identity " << identity << " because it is not ours! Something's wrong here." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
if( (vid->second.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ) && !(det.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||
{
|
||||
std::cerr << " (EE) Cannot subscribe with identity " << identity << " because it is unsigned and the lobby requires signed ids only." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
if(_chat_lobbys.find(lobby_id) != _chat_lobbys.end())
|
||||
{
|
||||
std::cerr << " (II) Lobby already exists. Weird." << std::endl;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new Lobby entry." << std::endl;
|
||||
#endif
|
||||
|
@ -1491,11 +1511,12 @@ void DistributedChatService::denyLobbyInvite(const ChatLobbyId& lobby_id)
|
|||
|
||||
bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& gxs_id)
|
||||
{
|
||||
if(!mGixs->isOwnId(gxs_id))
|
||||
{
|
||||
std::cerr << "(EE) Cannot lobby using gxs id " << gxs_id << std::endl;
|
||||
return false ;
|
||||
}
|
||||
RsIdentityDetails det ;
|
||||
if( (!rsIdentity->getIdDetails(gxs_id,det)) || !(det.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID))
|
||||
{
|
||||
std::cerr << " (EE) Cannot subscribe with identity " << gxs_id << " because it is not ours! Something's wrong here." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "Joining public chat lobby " << std::hex << lobby_id << std::dec << std::endl;
|
||||
|
@ -1527,6 +1548,12 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
|
|||
return true ;
|
||||
}
|
||||
|
||||
if( (it->second.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ) && !(det.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
|
||||
{
|
||||
std::cerr << " (EE) Cannot subscribe with identity " << gxs_id << " because it is unsigned and the lobby requires signed ids only." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new lobby entry." << std::endl;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue