mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-03 11:54:30 -04:00
Improvements for V0.6 logins to support hidden nodes.
- Separated Acount stuff from rsinit.cc => rsaccounts.cc - Moved Account Directory to HID06_xxxxxxx, or STD06_xxxxx This allows us to check for Hidden immediately And prevents v0.5 accounts being used with 0.6 - Added functions to support Proxy, and Hidden stuff. - Changed Minimum port to 10 to allow port 80 to be used by those who must. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@7027 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9d78ad8942
commit
39db508ce7
15 changed files with 1783 additions and 1177 deletions
|
@ -73,69 +73,27 @@ class RsInit
|
|||
static bool isPortable();
|
||||
static bool isWindowsXP();
|
||||
|
||||
/*!
|
||||
* Account Details (Combined GPG+SSL Setup)
|
||||
*/
|
||||
static bool getPreferedAccountId(std::string &id);
|
||||
static bool getPGPEngineFileName(std::string &fileName);
|
||||
static bool getAccountIds(std::list<std::string> &ids);
|
||||
static bool getAccountDetails(const std::string &id, std::string &gpgId, std::string &gpgName, std::string &gpgEmail, std::string &sslName);
|
||||
|
||||
static bool ValidateCertificate(std::string &userName) ;
|
||||
|
||||
static bool exportIdentity(const std::string& fname,const std::string& pgp_id) ;
|
||||
static bool importIdentity(const std::string& fname,std::string& imported_pgp_id,std::string& import_error) ;
|
||||
|
||||
/*!
|
||||
* Generating GPGme Account
|
||||
*/
|
||||
static int GetPGPLogins(std::list<std::string> &pgpIds);
|
||||
static int GetPGPLoginDetails(const std::string& id, std::string &name, std::string &email);
|
||||
static bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, std::string &pgpId, std::string &errString);
|
||||
|
||||
// copies existing gnupg keyrings to the new place of the OpenPGP-SDK version. Returns true on success.
|
||||
static bool copyGnuPGKeyrings() ;
|
||||
|
||||
|
||||
/*!
|
||||
* Setup Hidden Location;
|
||||
*/
|
||||
static bool SetHiddenLocation(const std::string& hiddenaddress, uint16_t port);
|
||||
|
||||
/*!
|
||||
* Login GGP
|
||||
*/
|
||||
static bool SelectGPGAccount(const std::string& gpgId);
|
||||
static bool LoadGPGPassword(const std::string& passwd);
|
||||
|
||||
/*!
|
||||
* Create SSL Certificates
|
||||
*/
|
||||
static bool GenerateSSLCertificate(const std::string& name, const std::string& org, const std::string& loc, const std::string& country, const std::string& passwd, std::string &sslId, std::string &errString);
|
||||
|
||||
/*!
|
||||
* intialises directories for passwords and ssl keys
|
||||
*/
|
||||
static bool LoadPassword(const std::string& id, const std::string& passwd) ;
|
||||
static bool LoadPassword(const std::string& passwd) ;
|
||||
|
||||
/*!
|
||||
* Final Certificate load. This can be called if:
|
||||
* a) InitRetroshare() returns RS_INIT_HAVE_ACCOUNT -> autoLoad/password Set.
|
||||
* b) SelectGPGAccount() && LoadPassword()
|
||||
* b) or LoadPassword()
|
||||
*
|
||||
* This wrapper is used to lock the profile first before
|
||||
* finalising the login
|
||||
* This uses the preferredId from RsAccounts.
|
||||
* This wrapper also locks the profile before finalising the login
|
||||
*/
|
||||
static int LockAndLoadCertificates(bool autoLoginNT, std::string& lockFilePath);
|
||||
|
||||
/*!
|
||||
* Post Login Options
|
||||
*/
|
||||
static std::string RsConfigDirectory();
|
||||
static std::string RsConfigKeysDirectory();
|
||||
static std::string RsPGPDirectory();
|
||||
|
||||
static std::string RsProfileConfigDirectory();
|
||||
static bool getStartMinimised() ;
|
||||
static std::string getRetroShareLink();
|
||||
|
||||
|
@ -144,26 +102,15 @@ class RsInit
|
|||
static void setAutoLogin(bool autoLogin);
|
||||
static bool RsClearAutoLogin() ;
|
||||
|
||||
/* used for static install data */
|
||||
static std::string getRetroshareDataDirectory();
|
||||
|
||||
static std::map<std::string,std::vector<std::string> > unsupported_keys ;
|
||||
private:
|
||||
|
||||
/* PreLogin */
|
||||
static std::string getHomePath() ;
|
||||
static bool setupBaseDir();
|
||||
|
||||
/* Account Details */
|
||||
static bool get_configinit(const std::string& dir, std::string &id);
|
||||
static bool create_configinit(const std::string& dir, const std::string& id);
|
||||
|
||||
static bool setupAccount(const std::string& accountdir);
|
||||
|
||||
#if 0
|
||||
/* Auto Login */
|
||||
static bool RsStoreAutoLogin() ;
|
||||
static bool RsTryAutoLogin() ;
|
||||
#endif
|
||||
|
||||
// THESE CAN BE REMOVED FROM THE CLASS TOO.
|
||||
/* Lock/unlock profile directory */
|
||||
static int LockConfigDirectory(const std::string& accountDir, std::string& lockFilePath);
|
||||
static void UnlockConfigDirectory();
|
||||
|
@ -173,4 +120,43 @@ class RsInit
|
|||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Seperate Class for dealing with Accounts */
|
||||
|
||||
namespace RsAccounts
|
||||
{
|
||||
// Directories.
|
||||
std::string ConfigDirectory(); // aka Base Directory. (normally ~/.retroshare)
|
||||
std::string DataDirectory();
|
||||
std::string PGPDirectory();
|
||||
std::string AccountDirectory();
|
||||
|
||||
// PGP Accounts.
|
||||
int GetPGPLogins(std::list<std::string> &pgpIds);
|
||||
int GetPGPLoginDetails(const std::string& id, std::string &name, std::string &email);
|
||||
bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, std::string &pgpId, std::string &errString);
|
||||
|
||||
// PGP Support Functions.
|
||||
bool ExportIdentity(const std::string& fname,const std::string& pgp_id) ;
|
||||
bool ImportIdentity(const std::string& fname,std::string& imported_pgp_id,std::string& import_error) ;
|
||||
void GetUnsupportedKeys(std::map<std::string,std::vector<std::string> > &unsupported_keys);
|
||||
bool CopyGnuPGKeyrings() ;
|
||||
|
||||
// Rs Accounts
|
||||
bool SelectAccount(const std::string &id);
|
||||
|
||||
bool GetPreferredAccountId(std::string &id);
|
||||
bool GetAccountIds(std::list<std::string> &ids);
|
||||
bool GetAccountDetails(const std::string &id,
|
||||
std::string &gpgId, std::string &gpgName,
|
||||
std::string &gpgEmail, std::string &location);
|
||||
|
||||
bool GenerateSSLCertificate(const std::string& name, const std::string& org, const std::string& loc, const std::string& country, const bool ishiddenloc, const std::string& passwd, std::string &sslId, std::string &errString);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -214,6 +214,7 @@ class RsPeerDetails
|
|||
|
||||
bool isHiddenNode;
|
||||
std::string hiddenNodeAddress;
|
||||
uint16_t hiddenNodePort;
|
||||
|
||||
// Filled in for Standard Node.
|
||||
std::string localAddr;
|
||||
|
@ -322,7 +323,9 @@ class RsPeers
|
|||
/* Network Stuff */
|
||||
virtual bool connectAttempt(const std::string &ssl_id) = 0;
|
||||
virtual bool setLocation(const std::string &ssl_id, const std::string &location) = 0;//location is shown in the gui to differentiate ssl certs
|
||||
|
||||
virtual bool setHiddenNode(const std::string &id, const std::string &hidden_node_address) = 0;
|
||||
virtual bool setHiddenNode(const std::string &id, const std::string &address, uint16_t port) = 0;
|
||||
|
||||
virtual bool setLocalAddress(const std::string &ssl_id, const std::string &addr, uint16_t port) = 0;
|
||||
virtual bool setExtAddress( const std::string &ssl_id, const std::string &addr, uint16_t port) = 0;
|
||||
|
@ -330,6 +333,9 @@ class RsPeers
|
|||
virtual bool setNetworkMode(const std::string &ssl_id, uint32_t netMode) = 0;
|
||||
virtual bool setVisState(const std::string &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
|
||||
|
||||
virtual bool getProxyServer(std::string &addr, uint16_t &port) = 0;
|
||||
virtual bool setProxyServer(const std::string &addr, const uint16_t port) = 0;
|
||||
|
||||
virtual void getIPServersList(std::list<std::string>& ip_servers) = 0;
|
||||
virtual void allowServerIPDetermination(bool) = 0;
|
||||
virtual bool getAllowServerIPDetermination() = 0 ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue