ensure that ssl id is always converted to lower case before being used to add a new friend. This fixes the bug allowing to add multiple times the same friend by changing the case is the SSL id

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5557 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-09-16 14:43:38 +00:00
parent 8767989975
commit 8e5ddcb0d6

View File

@ -441,12 +441,23 @@ bool p3PeerMgrIMPL::haveOnceConnected()
/*******************************************************************/
/*******************************************************************/
bool p3PeerMgrIMPL::addFriend(const std::string &id, const std::string &gpg_id, uint32_t netMode, uint32_t visState, time_t lastContact)
bool p3PeerMgrIMPL::addFriend(const std::string& input_id, const std::string& input_gpg_id, uint32_t netMode, uint32_t visState, time_t lastContact)
{
bool notifyLinkMgr = false;
std::string id = input_id ;
std::string gpg_id = input_gpg_id ;
rslog(RSL_WARNING, p3peermgrzone, "p3PeerMgr::addFriend() id: " + id);
rslog(RSL_WARNING, p3peermgrzone, "p3PeerMgr::addFriend() id: " + id);
// For safety, make sure ssl_id is lower case and GPG id is upper case.
//
for(uint32_t i=0;i<id.length();++i)
if(id[i] >= 'A' && id[i] <= 'F')
id[i] += 'a' - 'A' ;
for(uint32_t i=0;i<gpg_id.length();++i)
if(gpg_id[i] >= 'a' && gpg_id[i] <= 'f')
gpg_id[i] += 'A' - 'a' ;
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/