From 8e5ddcb0d6eb20d68a4b0e04032f39071afea64e Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 16 Sep 2012 14:43:38 +0000 Subject: [PATCH] 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 --- libretroshare/src/pqi/p3peermgr.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index 58f95e486..fbe1ce488 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -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= 'A' && id[i] <= 'F') + id[i] += 'a' - 'A' ; + + for(uint32_t i=0;i= 'a' && gpg_id[i] <= 'f') + gpg_id[i] += 'A' - 'a' ; { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/