mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
block the notify callback of authgpg when the main windows is launched
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2698 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ffdd38ddd5
commit
9f8a032d93
@ -88,7 +88,7 @@ gpg_error_t pgp_pwd_callback(void *hook, const char *uid_hint, const char *passp
|
||||
#endif
|
||||
text = gpg_password_static;
|
||||
} else {
|
||||
if(prev_was_bad) {
|
||||
if(prev_was_bad || !AuthGPG::getAuthGPG()->getAutorisePasswordCallbackNotify()) {
|
||||
#ifdef GPG_DEBUG
|
||||
fprintf(stderr, "pgp_pwd_callback() allow only one try to be consistent with gpg agent.\n");
|
||||
#endif
|
||||
@ -124,7 +124,7 @@ static char *PgpPassword = NULL;
|
||||
|
||||
|
||||
AuthGPG::AuthGPG()
|
||||
:gpgmeInit(false),gpgmeKeySelected(false),p3Config(CONFIG_TYPE_AUTHGPG)
|
||||
:gpgmeInit(false),gpgmeKeySelected(false),autorisePasswordCallbackNotify(true),p3Config(CONFIG_TYPE_AUTHGPG)
|
||||
{
|
||||
{
|
||||
RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK); /******* LOCKED ******/
|
||||
@ -274,7 +274,7 @@ int AuthGPG::GPGInit(std::string ownId)
|
||||
std::cerr << "AuthGPG::GPGInit() called with own gpg id : " << ownId << std::endl;
|
||||
|
||||
{
|
||||
RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK); /******* LOCKED ******/
|
||||
RsStackReadWriteMutex stack(pgpMtx, RsReadWriteMutex::WRITE_LOCK); /******* LOCKED ******/
|
||||
is_set_gpg_password_static= false;
|
||||
if (!gpgmeInit) {
|
||||
return 0;
|
||||
@ -2157,3 +2157,12 @@ bool AuthGPG::loadList(std::list<RsItem*> load)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AuthGPG::setAutorisePasswordCallbackNotify(bool autorise) {
|
||||
autorisePasswordCallbackNotify = autorise;
|
||||
return;
|
||||
}
|
||||
|
||||
bool AuthGPG::getAutorisePasswordCallbackNotify() {
|
||||
return autorisePasswordCallbackNotify;
|
||||
}
|
||||
|
@ -120,6 +120,9 @@ class AuthGPG : public p3Config
|
||||
|
||||
bool printKeys();
|
||||
|
||||
void setAutorisePasswordCallbackNotify(bool);
|
||||
bool getAutorisePasswordCallbackNotify();
|
||||
|
||||
/*********************************************************************************/
|
||||
/************************* STAGE 1 ***********************************************/
|
||||
/*********************************************************************************/
|
||||
@ -240,6 +243,8 @@ private:
|
||||
|
||||
bool gpgmeKeySelected;
|
||||
|
||||
bool autorisePasswordCallbackNotify;
|
||||
|
||||
gpgme_engine_info_t INFO;
|
||||
gpgme_ctx_t CTX;
|
||||
|
||||
|
@ -830,25 +830,6 @@ bool RsInit::SelectGPGAccount(std::string id)
|
||||
}
|
||||
|
||||
|
||||
//bool RsInit::LoadGPGPassword(std::string inPGPpasswd)
|
||||
//{
|
||||
//
|
||||
// bool ok = false;
|
||||
// if (0 < AuthGPG::getAuthGPG() -> LoadGPGPassword(inPGPpasswd))
|
||||
// {
|
||||
// ok = true;
|
||||
// std::cerr << "PGP LoadPwd Success!";
|
||||
// std::cerr << std::endl;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// std::cerr << "PGP LoadPwd Failed!";
|
||||
// std::cerr << std::endl;
|
||||
// }
|
||||
// return ok;
|
||||
//}
|
||||
|
||||
|
||||
bool RsInit::GeneratePGPCertificate(std::string name, std::string email, std::string passwd, std::string &pgpId, std::string &errString) {
|
||||
return AuthGPG::getAuthGPG()->GeneratePGPCertificate(name, email, passwd, pgpId, errString);
|
||||
}
|
||||
@ -1223,6 +1204,8 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
||||
/* wipe password */
|
||||
RsInitConfig::passwd = "";
|
||||
create_configinit(RsInitConfig::basedir, RsInitConfig::preferedId);
|
||||
//don't autorise the password callback again because it will lead to deadlock due to QT reentrance
|
||||
AuthGPG::getAuthGPG()->setAutorisePasswordCallbackNotify(false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user