mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-21 04:44:25 -04:00
fixed bug due to misinterpreting non SSLid drectories as potential locations
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5328 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
49ef54dc26
commit
10eab84b7c
1 changed files with 26 additions and 10 deletions
|
@ -63,6 +63,10 @@
|
||||||
|
|
||||||
#include "tcponudp/udpstunner.h"
|
#include "tcponudp/udpstunner.h"
|
||||||
|
|
||||||
|
// #define GPG_DEBUG
|
||||||
|
// #define AUTHSSL_DEBUG
|
||||||
|
// #define FIM_DEBUG
|
||||||
|
|
||||||
class accountId
|
class accountId
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1012,7 +1016,14 @@ std::string RsInit::getRetroshareDataDirectory()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool isHexaString(const std::string& s)
|
||||||
|
{
|
||||||
|
for(uint32_t i=0;i<s.length();++i)
|
||||||
|
if(!(s[i] >= 'A' && s[i] <= 'F' || s[i] >= '0' && s[i] <= '9' || s[i] >= 'a' && s[i] <= 'f'))
|
||||||
|
return false ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
/* directories with valid certificates in the expected location */
|
/* directories with valid certificates in the expected location */
|
||||||
bool getAvailableAccounts(std::list<accountId> &ids,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys)
|
bool getAvailableAccounts(std::list<accountId> &ids,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys)
|
||||||
|
@ -1086,23 +1097,28 @@ bool getAvailableAccounts(std::list<accountId> &ids,int& failing_accounts,std::m
|
||||||
dirIt.closedir();
|
dirIt.closedir();
|
||||||
|
|
||||||
for(it = directories.begin(); it != directories.end(); it++)
|
for(it = directories.begin(); it != directories.end(); it++)
|
||||||
{
|
if(isHexaString(*it) && (*it).length() == 32)
|
||||||
std::string accountdir = RsInitConfig::basedir + "/" + *it;
|
{
|
||||||
|
std::string accountdir = RsInitConfig::basedir + "/" + *it;
|
||||||
#ifdef GPG_DEBUG
|
#ifdef GPG_DEBUG
|
||||||
std::cerr << "getAvailableAccounts() Checking: " << *it << std::endl;
|
std::cerr << "getAvailableAccounts() Checking: " << *it << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
accountId tmpId;
|
accountId tmpId;
|
||||||
if (checkAccount(accountdir, tmpId,unsupported_keys))
|
if (checkAccount(accountdir, tmpId,unsupported_keys))
|
||||||
{
|
{
|
||||||
#ifdef GPG_DEBUG
|
#ifdef GPG_DEBUG
|
||||||
std::cerr << "getAvailableAccounts() Accepted: " << *it << std::endl;
|
std::cerr << "getAvailableAccounts() Accepted: " << *it << std::endl;
|
||||||
#endif
|
#endif
|
||||||
ids.push_back(tmpId);
|
ids.push_back(tmpId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++failing_accounts ;
|
||||||
}
|
}
|
||||||
|
#ifdef GPG_DEBUG
|
||||||
else
|
else
|
||||||
++failing_accounts ;
|
std::cerr << "Skipped non SSLid directory " << *it << std::endl;
|
||||||
}
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue