Fixed default data rates to sensible options: 200 kB/s down, 50 kB/s up.

Added StoreAllKeys() call after adding new GPG Certificate.
Added Check for successful Req creation (was crashing with NULL pointer).
Switched std::vector.data => &(std::vector[0]) to remove linuxism in radix64.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4851 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-01-27 13:03:59 +00:00
parent e6816c9d6f
commit 00ff694e10
4 changed files with 44 additions and 30 deletions

View File

@ -1117,8 +1117,9 @@ bool AuthGPGimpl::active()
return ((gpgmeInit) && (gpgmeKeySelected)); return ((gpgmeInit) && (gpgmeKeySelected));
} }
bool AuthGPGimpl::GeneratePGPCertificate(std::string name, std::string email, std::string passwd, std::string &pgpId, std::string &/*errString*/) { bool AuthGPGimpl::GeneratePGPCertificate(std::string name, std::string email, std::string passwd, std::string &pgpId, std::string &/*errString*/)
{
{
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/ RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
gpgme_key_t newKey; gpgme_key_t newKey;
@ -1143,7 +1144,10 @@ bool AuthGPGimpl::GeneratePGPCertificate(std::string name, std::string email,
return 0; return 0;
} }
pgpId = newKey->subkeys->keyid; pgpId = newKey->subkeys->keyid;
}
// reload keys - so yours is now there.
storeAllKeys();
return true; return true;
} }

View File

@ -46,6 +46,9 @@ static std::list<std::string> waitingIds;
****/ ****/
//#define PGRP_DEBUG 1 //#define PGRP_DEBUG 1
#define DEFAULT_DOWNLOAD_KB_RATE (200.0)
#define DEFAULT_UPLOAD_KB_RATE (50.0)
/* MUTEX NOTES: /* MUTEX NOTES:
* Functions like GetRsRawItem() lock itself (pqihandler) and * Functions like GetRsRawItem() lock itself (pqihandler) and
* likewise ServiceServer and ConfigMgr mutex themselves. * likewise ServiceServer and ConfigMgr mutex themselves.
@ -265,8 +268,9 @@ int pqipersongrp::load_config()
pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone, pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone,
"pqipersongrp::load_config() Loading Default Rates!"); "pqipersongrp::load_config() Loading Default Rates!");
setMaxRate(true, 500.0);
setMaxRate(false, 500.0); setMaxRate(true, DEFAULT_DOWNLOAD_KB_RATE);
setMaxRate(false, DEFAULT_UPLOAD_KB_RATE);
} }
return 1; return 1;

View File

@ -1284,6 +1284,12 @@ bool RsInit::GenerateSSLCertificate(const std::string& gpg_id, const std::st
country.c_str(), country.c_str(),
nbits, errString); nbits, errString);
if (req == NULL)
{
fprintf(stderr,"RsGenerateCert() Couldn't create Request. Reason: %s\n", errString.c_str());
return false;
}
long days = 3000; long days = 3000;
X509 *x509 = AuthSSL::getAuthSSL()->SignX509ReqWithGPG(req, days); X509 *x509 = AuthSSL::getAuthSSL()->SignX509ReqWithGPG(req, days);

View File

@ -97,7 +97,7 @@ again:
len = buf.size() ; len = buf.size() ;
out = new char[len] ; out = new char[len] ;
memcpy(out,buf.data(),len) ; memcpy(out,&buf[0],len) ;
} }
/**************** /****************