mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-12 09:24:26 -05:00
ported trunk commit 2689,90,91,92 into branch
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2701 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9f7e9517a6
commit
504d6654b2
@ -71,7 +71,7 @@ class RsInit
|
|||||||
/* Login SSL */
|
/* Login SSL */
|
||||||
static bool LoadPassword(std::string id, std::string passwd) ;
|
static bool LoadPassword(std::string id, std::string passwd) ;
|
||||||
|
|
||||||
/* Final Certificate load. This can be called if:
|
/** Final Certificate load. This can be called if:
|
||||||
* a) InitRetroshare() returns true -> autoLoad/password Set.
|
* a) InitRetroshare() returns true -> autoLoad/password Set.
|
||||||
* b) SelectGPGAccount() && LoadPassword()
|
* b) SelectGPGAccount() && LoadPassword()
|
||||||
*/
|
*/
|
||||||
@ -83,6 +83,11 @@ class RsInit
|
|||||||
static std::string RsProfileConfigDirectory();
|
static std::string RsProfileConfigDirectory();
|
||||||
static bool setStartMinimised() ;
|
static bool setStartMinimised() ;
|
||||||
|
|
||||||
|
static int getSslPwdLen();
|
||||||
|
static bool getAutoLogin();
|
||||||
|
static void setAutoLogin(bool autoLogin);
|
||||||
|
static bool RsClearAutoLogin() ;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* PreLogin */
|
/* PreLogin */
|
||||||
@ -98,9 +103,10 @@ class RsInit
|
|||||||
/* Auto Login */
|
/* Auto Login */
|
||||||
static bool RsStoreAutoLogin() ;
|
static bool RsStoreAutoLogin() ;
|
||||||
static bool RsTryAutoLogin() ;
|
static bool RsTryAutoLogin() ;
|
||||||
static bool RsClearAutoLogin() ;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "pqi/authssl.h"
|
#include "pqi/authssl.h"
|
||||||
#include "pqi/authgpg.h"
|
#include "pqi/authgpg.h"
|
||||||
|
#include "rsiface/rsinit.h"
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
const int p3facemsgzone = 11453;
|
const int p3facemsgzone = 11453;
|
||||||
|
|
||||||
@ -157,6 +157,8 @@ void RsServer::ConfigFinalSave()
|
|||||||
{
|
{
|
||||||
/* force saving of transfers TODO */
|
/* force saving of transfers TODO */
|
||||||
//ftserver->saveFileTransferStatus();
|
//ftserver->saveFileTransferStatus();
|
||||||
|
if(!RsInit::getAutoLogin())
|
||||||
|
RsInit::RsClearAutoLogin();
|
||||||
|
|
||||||
//AuthSSL::getAuthSSL()->FinalSaveCertificates();
|
//AuthSSL::getAuthSSL()->FinalSaveCertificates();
|
||||||
mConfigMgr->completeConfiguration();
|
mConfigMgr->completeConfiguration();
|
||||||
@ -164,6 +166,8 @@ void RsServer::ConfigFinalSave()
|
|||||||
|
|
||||||
void RsServer::rsGlobalShutDown()
|
void RsServer::rsGlobalShutDown()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
ConfigFinalSave(); // save configuration before exit
|
ConfigFinalSave(); // save configuration before exit
|
||||||
mConnMgr->shutdown(); /* Handles UPnP */
|
mConnMgr->shutdown(); /* Handles UPnP */
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,7 @@ static const std::string configKeyDir = "keys";
|
|||||||
static const std::string configCaFile = "cacerts.pem";
|
static const std::string configCaFile = "cacerts.pem";
|
||||||
static const std::string configLogFileName = "retro.log";
|
static const std::string configLogFileName = "retro.log";
|
||||||
static const std::string configHelpName = "retro.htm";
|
static const std::string configHelpName = "retro.htm";
|
||||||
|
static const int SSLPWD_LEN = 6;
|
||||||
|
|
||||||
std::list<accountId> RsInitConfig::accountIds;
|
std::list<accountId> RsInitConfig::accountIds;
|
||||||
std::string RsInitConfig::preferedId;
|
std::string RsInitConfig::preferedId;
|
||||||
@ -193,7 +194,7 @@ void RsInit::InitRsConfig()
|
|||||||
strcpy(RsInitConfig::inet, "127.0.0.1");
|
strcpy(RsInitConfig::inet, "127.0.0.1");
|
||||||
strcpy(RsInitConfig::logfname, "");
|
strcpy(RsInitConfig::logfname, "");
|
||||||
|
|
||||||
RsInitConfig::autoLogin = true; // Always on now.
|
RsInitConfig::autoLogin = false; // .
|
||||||
RsInitConfig::startMinimised = false;
|
RsInitConfig::startMinimised = false;
|
||||||
RsInitConfig::passwd = "";
|
RsInitConfig::passwd = "";
|
||||||
RsInitConfig::havePasswd = false;
|
RsInitConfig::havePasswd = false;
|
||||||
@ -503,12 +504,17 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored)
|
|||||||
/* if existing user, and havePasswd .... we can skip the login prompt */
|
/* if existing user, and havePasswd .... we can skip the login prompt */
|
||||||
if (existingUser)
|
if (existingUser)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (RsInitConfig::havePasswd)
|
if (RsInitConfig::havePasswd)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsInit::LoadPassword(RsInitConfig::preferedId, "");
|
||||||
|
|
||||||
if (RsTryAutoLogin())
|
if (RsTryAutoLogin())
|
||||||
{
|
{
|
||||||
|
RsInit::setAutoLogin(true);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1047,6 +1053,7 @@ bool RsInit::LoadPassword(std::string id, std::string inPwd)
|
|||||||
RsInitConfig::preferedId = id;
|
RsInitConfig::preferedId = id;
|
||||||
RsInitConfig::configDir = RsInitConfig::basedir + RsInitConfig::dirSeperator + id;
|
RsInitConfig::configDir = RsInitConfig::basedir + RsInitConfig::dirSeperator + id;
|
||||||
RsInitConfig::passwd = inPwd;
|
RsInitConfig::passwd = inPwd;
|
||||||
|
|
||||||
RsInitConfig::havePasswd = true;
|
RsInitConfig::havePasswd = true;
|
||||||
|
|
||||||
// Create the filename.
|
// Create the filename.
|
||||||
@ -1071,6 +1078,7 @@ bool RsInit::LoadPassword(std::string id, std::string inPwd)
|
|||||||
|
|
||||||
int RsInit::LoadCertificates(bool autoLoginNT)
|
int RsInit::LoadCertificates(bool autoLoginNT)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (RsInitConfig::load_cert == "")
|
if (RsInitConfig::load_cert == "")
|
||||||
{
|
{
|
||||||
std::cerr << "RetroShare needs a certificate" << std::endl;
|
std::cerr << "RetroShare needs a certificate" << std::endl;
|
||||||
@ -1083,15 +1091,29 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsInitConfig::autoLogin = autoLoginNT;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
bool have_help = false;
|
||||||
|
|
||||||
|
// Check if help file exists
|
||||||
|
std::string help_file_name = RsInitConfig::configDir + RsInitConfig::dirSeperator +
|
||||||
|
configKeyDir + RsInitConfig::dirSeperator + "help.dta";
|
||||||
|
FILE* helpFile = fopen(help_file_name.c_str(), "r");
|
||||||
|
|
||||||
|
if(helpFile != NULL){
|
||||||
|
have_help = true;
|
||||||
|
fclose(helpFile);
|
||||||
|
}
|
||||||
|
|
||||||
/* The SSL / SSL + PGP version requires, SSL init + PGP init. */
|
/* The SSL / SSL + PGP version requires, SSL init + PGP init. */
|
||||||
const char* sslPassword;
|
const char* sslPassword;
|
||||||
sslPassword = RsInitConfig::passwd.c_str();
|
sslPassword = RsInitConfig::passwd.c_str();
|
||||||
|
|
||||||
|
|
||||||
//check if password is already in memory
|
//check if password is already in memory
|
||||||
if ((RsInitConfig::havePasswd) && (RsInitConfig::passwd != ""))
|
if (((RsInitConfig::havePasswd) && (RsInitConfig::passwd != "")) && !have_help)
|
||||||
{
|
{
|
||||||
std::cerr << "RetroShare have a ssl Password" << std::endl;
|
std::cerr << "RetroShare has a ssl Password" << std::endl;
|
||||||
sslPassword = RsInitConfig::passwd.c_str();
|
sslPassword = RsInitConfig::passwd.c_str();
|
||||||
|
|
||||||
std::cerr << "let's store the ssl Password into a pgp ecrypted file" << std::endl;
|
std::cerr << "let's store the ssl Password into a pgp ecrypted file" << std::endl;
|
||||||
@ -1110,7 +1132,10 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
|||||||
gpgme_data_release (plain);
|
gpgme_data_release (plain);
|
||||||
fclose(sslPassphraseFile);
|
fclose(sslPassphraseFile);
|
||||||
|
|
||||||
} else {
|
} else
|
||||||
|
if(!have_help) {
|
||||||
|
|
||||||
|
|
||||||
//let's read the password from an encrypted file
|
//let's read the password from an encrypted file
|
||||||
//let's check if there's a ssl_passpharese_file that we can decrypt with PGP
|
//let's check if there's a ssl_passpharese_file that we can decrypt with PGP
|
||||||
FILE *sslPassphraseFile = fopen(RsInitConfig::ssl_passphrase_file.c_str(), "r");
|
FILE *sslPassphraseFile = fopen(RsInitConfig::ssl_passphrase_file.c_str(), "r");
|
||||||
@ -1133,6 +1158,7 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
|||||||
std::cerr << "Decrypting went ok !" << std::endl;
|
std::cerr << "Decrypting went ok !" << std::endl;
|
||||||
gpgme_data_write (plain, "", 1);
|
gpgme_data_write (plain, "", 1);
|
||||||
sslPassword = gpgme_data_release_and_get_mem(plain, NULL);
|
sslPassword = gpgme_data_release_and_get_mem(plain, NULL);
|
||||||
|
std::cerr << "sslpassword: " << sslPassword << std::endl;
|
||||||
} else {
|
} else {
|
||||||
gpgme_data_release (plain);
|
gpgme_data_release (plain);
|
||||||
std::cerr << "Error : decrypting went wrong !" << std::endl;
|
std::cerr << "Error : decrypting went wrong !" << std::endl;
|
||||||
@ -1143,7 +1169,19 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(have_help){
|
||||||
|
sslPassword = RsInitConfig::passwd.c_str();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
RsInitConfig::passwd.insert(0, sslPassword, RsInit::getSslPwdLen());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::cerr << "RsInitConfig::load_key.c_str() : " << RsInitConfig::load_key.c_str() << std::endl;
|
std::cerr << "RsInitConfig::load_key.c_str() : " << RsInitConfig::load_key.c_str() << std::endl;
|
||||||
|
|
||||||
if (0 < AuthSSL::getAuthSSL() -> InitAuth(RsInitConfig::load_cert.c_str(), RsInitConfig::load_key.c_str(), sslPassword))
|
if (0 < AuthSSL::getAuthSSL() -> InitAuth(RsInitConfig::load_cert.c_str(), RsInitConfig::load_key.c_str(), sslPassword))
|
||||||
{
|
{
|
||||||
ok = true;
|
ok = true;
|
||||||
@ -1156,7 +1194,7 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
|||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
if (autoLoginNT)
|
if (autoLoginNT && (!have_help))
|
||||||
{
|
{
|
||||||
std::cerr << "RetroShare will AutoLogin next time";
|
std::cerr << "RetroShare will AutoLogin next time";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -1289,6 +1327,9 @@ std::string make_path_unix(std::string path)
|
|||||||
/* WINDOWS STRUCTURES FOR DPAPI */
|
/* WINDOWS STRUCTURES FOR DPAPI */
|
||||||
|
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
#ifndef WINDOWS_SYS /* UNIX */
|
||||||
|
|
||||||
|
#include <openssl/rc4.h>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
|
|
||||||
@ -1358,11 +1399,44 @@ extern BOOL WINAPI CryptUnprotectData(
|
|||||||
bool RsInit::RsStoreAutoLogin()
|
bool RsInit::RsStoreAutoLogin()
|
||||||
{
|
{
|
||||||
std::cerr << "RsStoreAutoLogin()" << std::endl;
|
std::cerr << "RsStoreAutoLogin()" << std::endl;
|
||||||
/* Windows only */
|
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
#ifndef WINDOWS_SYS /* UNIX */
|
||||||
return false;
|
|
||||||
|
/* WARNING: Autologin is inherently unsafe */
|
||||||
|
std::string helpFileName = RsInitConfig::configDir + RsInitConfig::dirSeperator +
|
||||||
|
configKeyDir + RsInitConfig::dirSeperator + "help.dta";
|
||||||
|
FILE* helpFile = fopen(helpFileName.c_str(), "w");
|
||||||
|
|
||||||
|
if(helpFile == NULL){
|
||||||
|
std::cerr << "\nRsStoreAutoLogin(): Failed to open help file\n" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* encrypt help */
|
||||||
|
|
||||||
|
const int DAT_LEN = RsInitConfig::passwd.length();
|
||||||
|
const int KEY_DAT_LEN = RsInitConfig::load_cert.length();
|
||||||
|
unsigned char* key_data = (unsigned char*)RsInitConfig::load_cert.c_str();
|
||||||
|
unsigned char* indata = (unsigned char*)RsInitConfig::passwd.c_str();
|
||||||
|
unsigned char* outdata = new unsigned char[DAT_LEN];
|
||||||
|
|
||||||
|
RC4_KEY* key = new RC4_KEY;
|
||||||
|
RC4_set_key(key, KEY_DAT_LEN, key_data);
|
||||||
|
|
||||||
|
RC4(key, DAT_LEN, indata, outdata);
|
||||||
|
|
||||||
|
|
||||||
|
fprintf(helpFile, "%s", outdata);
|
||||||
|
fclose(helpFile);
|
||||||
|
|
||||||
|
delete key;
|
||||||
|
delete[] outdata;
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* store password encrypted in a file */
|
/* store password encrypted in a file */
|
||||||
std::string entropy = RsInitConfig::load_cert;
|
std::string entropy = RsInitConfig::load_cert;
|
||||||
|
|
||||||
@ -1415,7 +1489,7 @@ bool RsInit::RsStoreAutoLogin()
|
|||||||
|
|
||||||
/* save the data to the file */
|
/* save the data to the file */
|
||||||
std::string passwdfile = RsInitConfig::configDir;
|
std::string passwdfile = RsInitConfig::configDir;
|
||||||
passwdfile += RsInitConfig::dirSeperator;
|
passwdfile += RsInitConfig::dirSeperator + configKeyDir + RsInitConfig::dirSeperator;
|
||||||
passwdfile += "help.dta";
|
passwdfile += "help.dta";
|
||||||
|
|
||||||
//std::cerr << "Save to: " << passwdfile;
|
//std::cerr << "Save to: " << passwdfile;
|
||||||
@ -1440,7 +1514,6 @@ bool RsInit::RsStoreAutoLogin()
|
|||||||
free(pbDataInput);
|
free(pbDataInput);
|
||||||
free(pbDataEnt);
|
free(pbDataEnt);
|
||||||
LocalFree(DataOut.pbData);
|
LocalFree(DataOut.pbData);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
|
|
||||||
@ -1451,25 +1524,55 @@ bool RsInit::RsStoreAutoLogin()
|
|||||||
|
|
||||||
bool RsInit::RsTryAutoLogin()
|
bool RsInit::RsTryAutoLogin()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::cerr << "RsTryAutoLogin()" << std::endl;
|
std::cerr << "RsTryAutoLogin()" << std::endl;
|
||||||
/* Windows only */
|
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
#ifndef WINDOWS_SYS /* UNIX */
|
||||||
return false;
|
std::string helpFileName = RsInitConfig::basedir + RsInitConfig::dirSeperator + RsInitConfig::preferedId + RsInitConfig::dirSeperator +
|
||||||
#else
|
configKeyDir + RsInitConfig::dirSeperator + "help.dta";
|
||||||
/* Require a AutoLogin flag in the config to do this */
|
|
||||||
if (!RsInitConfig::autoLogin)
|
FILE* helpFile = fopen(helpFileName.c_str(), "r");
|
||||||
{
|
|
||||||
|
if(helpFile == NULL){
|
||||||
|
std::cerr << "\nFailed to open help file\n" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* decrypt help */
|
||||||
|
|
||||||
|
const int DAT_LEN = RsInit::getSslPwdLen();
|
||||||
|
const int KEY_DAT_LEN = RsInitConfig::load_cert.length();
|
||||||
|
unsigned char* key_data = (unsigned char*)RsInitConfig::load_cert.c_str();
|
||||||
|
unsigned char* indata = new unsigned char[DAT_LEN];
|
||||||
|
unsigned char* outdata = new unsigned char[DAT_LEN];
|
||||||
|
|
||||||
|
fscanf(helpFile, "%s", indata);
|
||||||
|
|
||||||
|
RC4_KEY* key = new RC4_KEY;
|
||||||
|
RC4_set_key(key, KEY_DAT_LEN, key_data);
|
||||||
|
|
||||||
|
RC4(key, DAT_LEN, indata, outdata);
|
||||||
|
|
||||||
|
RsInitConfig::passwd.clear();
|
||||||
|
RsInitConfig::passwd.insert(0, (char*)outdata, DAT_LEN);
|
||||||
|
|
||||||
|
|
||||||
|
fclose(helpFile);
|
||||||
|
|
||||||
|
delete[] indata;
|
||||||
|
delete[] outdata;
|
||||||
|
delete key;
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
|
||||||
/* try to load from file */
|
/* try to load from file */
|
||||||
std::string entropy = RsInitConfig::load_cert;
|
std::string entropy = RsInitConfig::load_cert;
|
||||||
/* get the data out */
|
/* get the data out */
|
||||||
|
|
||||||
/* open the data to the file */
|
/* open the data to the file */
|
||||||
std::string passwdfile = RsInitConfig::configDir;
|
std::string passwdfile = RsInitConfig::configDir;
|
||||||
passwdfile += RsInitConfig::dirSeperator;
|
passwdfile += RsInitConfig::dirSeperator + configKeyDir + RsInitConfig::dirSeperator;
|
||||||
passwdfile += "help.dta";
|
passwdfile += "help.dta";
|
||||||
|
|
||||||
DATA_BLOB DataIn;
|
DATA_BLOB DataIn;
|
||||||
@ -1575,12 +1678,8 @@ bool RsInit::RsTryAutoLogin()
|
|||||||
|
|
||||||
bool RsInit::RsClearAutoLogin()
|
bool RsInit::RsClearAutoLogin()
|
||||||
{
|
{
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
|
||||||
#ifndef WINDOWS_SYS /* UNIX */
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
std::string passwdfile = RsInitConfig::configDir;
|
std::string passwdfile = RsInitConfig::configDir;
|
||||||
passwdfile += RsInitConfig::dirSeperator;
|
passwdfile += RsInitConfig::dirSeperator + configKeyDir + RsInitConfig::dirSeperator;
|
||||||
passwdfile += "help.dta";
|
passwdfile += "help.dta";
|
||||||
|
|
||||||
FILE *fp = fopen(passwdfile.c_str(), "wb");
|
FILE *fp = fopen(passwdfile.c_str(), "wb");
|
||||||
@ -1588,15 +1687,18 @@ bool RsInit::RsClearAutoLogin()
|
|||||||
{
|
{
|
||||||
fwrite(" ", 1, 1, fp);
|
fwrite(" ", 1, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
bool removed = remove(passwdfile.c_str());
|
||||||
|
|
||||||
std::cerr << "AutoLogin Data cleared! ";
|
if(removed != 0)
|
||||||
|
std::cerr << "RsClearAutoLogin(): Failed to Removed help file" << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "AutoLogin Data cleared ";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1631,6 +1733,17 @@ bool RsInit::setStartMinimised()
|
|||||||
return RsInitConfig::startMinimised;
|
return RsInitConfig::startMinimised;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RsInit::getSslPwdLen(){
|
||||||
|
return SSLPWD_LEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RsInit::getAutoLogin(){
|
||||||
|
return RsInitConfig::autoLogin;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RsInit::setAutoLogin(bool autoLogin){
|
||||||
|
RsInitConfig::autoLogin = autoLogin;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -210,7 +210,9 @@ void GenCertDialog::genPerson()
|
|||||||
std::cerr << " generating sslPasswd." << std::endl;
|
std::cerr << " generating sslPasswd." << std::endl;
|
||||||
qsrand(time(NULL));
|
qsrand(time(NULL));
|
||||||
std::string sslPasswd = "";
|
std::string sslPasswd = "";
|
||||||
for( int i = 0 ; i < 6 ; ++i )
|
const int PWD_LEN = RsInit::getSslPwdLen();
|
||||||
|
|
||||||
|
for( int i = 0 ; i < PWD_LEN ; ++i )
|
||||||
{
|
{
|
||||||
int iNumber;
|
int iNumber;
|
||||||
iNumber = qrand()%25 + 65;
|
iNumber = qrand()%25 + 65;
|
||||||
|
@ -401,7 +401,7 @@ QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *gro
|
|||||||
{
|
{
|
||||||
QAction *action = new QAction(img, text, group);
|
QAction *action = new QAction(img, text, group);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setFont(FONT);
|
// action->setFont(FONT);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *gro
|
|||||||
* the specified slot (if given). */
|
* the specified slot (if given). */
|
||||||
void MainWindow::addAction(QAction *action, const char *slot)
|
void MainWindow::addAction(QAction *action, const char *slot)
|
||||||
{
|
{
|
||||||
action->setFont(FONT);
|
// action->setFont(FONT);
|
||||||
ui.toolBar->addAction(action);
|
ui.toolBar->addAction(action);
|
||||||
connect(action, SIGNAL(triggered()), this, slot);
|
connect(action, SIGNAL(triggered()), this, slot);
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ border: 1px solid #CCCCCC;}</string>
|
|||||||
<height>16</height>
|
<height>16</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<!-- <property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Arial</family>
|
<family>Arial</family>
|
||||||
<pointsize>10</pointsize>
|
<pointsize>10</pointsize>
|
||||||
@ -565,7 +565,7 @@ border: 1px solid #CCCCCC;}</string>
|
|||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Arial'; font-size:11pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Arial'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-weight:600;">Files</span></p></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-weight:600;">Files</span></p></body></html></string>
|
||||||
</property>
|
</property>-->
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
|
@ -55,7 +55,9 @@ StartDialog::StartDialog(QWidget *parent, Qt::WFlags flags)
|
|||||||
|
|
||||||
ui.loadButton->setFocus();
|
ui.loadButton->setFocus();
|
||||||
|
|
||||||
|
|
||||||
connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
|
connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(loadPerson()));
|
||||||
|
connect(ui.autologin_checkbox, SIGNAL(clicked()), this, SLOT(notSecureWarning()));
|
||||||
|
|
||||||
/* load the Certificate File name */
|
/* load the Certificate File name */
|
||||||
std::string userName;
|
std::string userName;
|
||||||
@ -154,7 +156,8 @@ void StartDialog::loadPerson()
|
|||||||
void StartDialog::loadCertificates()
|
void StartDialog::loadCertificates()
|
||||||
{
|
{
|
||||||
/* Final stage of loading */
|
/* Final stage of loading */
|
||||||
if (RsInit::LoadCertificates(false))
|
|
||||||
|
if (RsInit::LoadCertificates(ui.autologin_checkbox->isChecked()))
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@ -168,13 +171,15 @@ void StartDialog::loadCertificates()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void StartDialog::on_labelProfile_linkActivated(QString link)
|
void StartDialog::on_labelProfile_linkActivated(QString link)
|
||||||
{
|
{
|
||||||
//static GenCertDialog *gencertdialog = new GenCertDialog();
|
//static GenCertDialog *gencertdialog = new GenCertDialog();
|
||||||
//gencertdialog->show();
|
//gencertdialog->show();
|
||||||
|
|
||||||
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
QMessageBox::StandardButton sb = QMessageBox::question ( NULL,
|
||||||
tr("Create a New Profil"),
|
tr("Create a New Profile"),
|
||||||
tr("This will generate a new Profile\n Are you sure you want to continue"),
|
tr("This will generate a new Profile\n Are you sure you want to continue"),
|
||||||
(QMessageBox::Ok | QMessageBox::No));
|
(QMessageBox::Ok | QMessageBox::No));
|
||||||
|
|
||||||
@ -200,3 +205,15 @@ LogoBar & StartDialog::getLogoBar() const {
|
|||||||
return *_rsLogoBar;
|
return *_rsLogoBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StartDialog::notSecureWarning() {
|
||||||
|
|
||||||
|
/* some error msg */
|
||||||
|
if(ui.autologin_checkbox->isChecked()){
|
||||||
|
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
|
||||||
|
tr("Insecure"),
|
||||||
|
tr("Auto Login is not Secure: Password stored on disk"),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@ -61,6 +61,11 @@ private slots:
|
|||||||
void closeinfodlg();
|
void closeinfodlg();
|
||||||
void loadPerson();
|
void loadPerson();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warns the user that autologin is not secure
|
||||||
|
*/
|
||||||
|
void notSecureWarning();
|
||||||
|
|
||||||
void on_labelProfile_linkActivated(QString link);
|
void on_labelProfile_linkActivated(QString link);
|
||||||
void on_labelInfo_linkActivated(QString link);
|
void on_labelInfo_linkActivated(QString link);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>291</width>
|
<width>291</width>
|
||||||
<height>403</height>
|
<height>433</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="palette">
|
<property name="palette">
|
||||||
@ -435,7 +435,7 @@
|
|||||||
<string>RetroShare</string>
|
<string>RetroShare</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="images.qrc">
|
<iconset resource="../../../../retroshare-v0.5.0/retroshare-gui/src/gui/images.qrc">
|
||||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
@ -498,7 +498,7 @@ border-image: url(:/images/avatar_background.png);
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="images.qrc">
|
<iconset resource="../../../../retroshare-v0.5.0/retroshare-gui/src/gui/images.qrc">
|
||||||
<normaloff>:/images/user/personal64.png</normaloff>:/images/user/personal64.png</iconset>
|
<normaloff>:/images/user/personal64.png</normaloff>:/images/user/personal64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
@ -581,6 +581,44 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0" colspan="4">
|
||||||
|
<widget class="QFrame" name="callBarFrame">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>65</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="2">
|
||||||
|
<widget class="QLabel" name="labelInfo">
|
||||||
|
<property name="text">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="Info"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">Info...</span></a></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLabel" name="labelProfile">
|
||||||
|
<property name="text">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="Create new Profile..."><span style=" text-decoration: underline; color:#0000ff;">Create new Profile...</span></a></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="5" column="0" colspan="4">
|
<item row="5" column="0" colspan="4">
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
@ -630,86 +668,47 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="4">
|
<item row="3" column="1" rowspan="2" colspan="2">
|
||||||
<widget class="QFrame" name="callBarFrame">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>65</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLabel" name="labelProfile">
|
|
||||||
<property name="text">
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="Create new Profile..."><span style=" text-decoration: underline; color:#0000ff;">Create new Profile...</span></a></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="2">
|
|
||||||
<widget class="QLabel" name="labelInfo">
|
|
||||||
<property name="text">
|
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
|
||||||
p, li { white-space: pre-wrap; }
|
|
||||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="Info"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">Info...</span></a></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1" colspan="2">
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item row="1" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QComboBox" name="loadName"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Name (GPG Id) - location:</string>
|
<string>Name (GPG Id) - location:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="loadName"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="autologin_checkbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remember Password</string>
|
||||||
|
</property>
|
||||||
|
<property name="tristate">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>loadName</tabstop>
|
|
||||||
<tabstop>loadButton</tabstop>
|
<tabstop>loadButton</tabstop>
|
||||||
<tabstop>toolButton</tabstop>
|
<tabstop>toolButton</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc"/>
|
<include location="../../../../retroshare-v0.5.0/retroshare-gui/src/gui/images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include "rshare.h"
|
#include <iostream>
|
||||||
|
#include <rshare.h>
|
||||||
|
#include <rsiface/rsinit.h>
|
||||||
#include "GeneralPage.h"
|
#include "GeneralPage.h"
|
||||||
#include <util/stringutil.h>
|
#include <util/stringutil.h>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
@ -34,12 +36,16 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
|
|||||||
/* Create RshareSettings object */
|
/* Create RshareSettings object */
|
||||||
_settings = new RshareSettings();
|
_settings = new RshareSettings();
|
||||||
|
|
||||||
|
connect(ui.autoLogin, SIGNAL(clicked()), this, SLOT(setAutoLogin()));
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
ui.chkRunRetroshareAtSystemStartup->setVisible(false);
|
ui.chkRunRetroshareAtSystemStartup->setVisible(false);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ui.autoLogin->setChecked(RsInit::getAutoLogin());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
@ -103,3 +109,7 @@ GeneralPage::toggleShowOnStartup(bool checked)
|
|||||||
//RshareSettings _settings;
|
//RshareSettings _settings;
|
||||||
_settings->setShowMainWindowAtStart(checked);
|
_settings->setShowMainWindowAtStart(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralPage::setAutoLogin(){
|
||||||
|
RsInit::setAutoLogin(ui.autoLogin->isChecked());
|
||||||
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
#include "rsharesettings.h"
|
#include "rsharesettings.h"
|
||||||
|
#include "rsiface/rsiface.h"
|
||||||
|
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include "ui_GeneralPage.h"
|
#include "ui_GeneralPage.h"
|
||||||
@ -57,6 +58,11 @@ private slots:
|
|||||||
/** Called when the "show on startup" checkbox is toggled. */
|
/** Called when the "show on startup" checkbox is toggled. */
|
||||||
void toggleShowOnStartup(bool checked);
|
void toggleShowOnStartup(bool checked);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setAutoLogin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** A RetroShare Settings object used for saving/loading settings */
|
/** A RetroShare Settings object used for saving/loading settings */
|
||||||
RshareSettings *_settings;
|
RshareSettings *_settings;
|
||||||
|
@ -555,6 +555,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="autoLogin">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto Login</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -116,8 +116,18 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* don't save auto login details */
|
|
||||||
RsInit::LoadCertificates(false);
|
std::string preferredId, gpgId, gpgName, gpgEmail, sslName;
|
||||||
|
RsInit::getPreferedAccountId(preferredId);
|
||||||
|
|
||||||
|
if (RsInit::getAccountDetails(preferredId,
|
||||||
|
gpgId, gpgName, gpgEmail, sslName))
|
||||||
|
{
|
||||||
|
RsInit::SelectGPGAccount(gpgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// true: note auto-login is active
|
||||||
|
RsInit::LoadCertificates(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
rsicontrol->StartupRetroShare();
|
rsicontrol->StartupRetroShare();
|
||||||
|
Loading…
Reference in New Issue
Block a user