From 02234325cc8b3dbaec637b5f4e036899bbcfc49c Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 16 Jan 2010 22:03:33 +0000 Subject: [PATCH] fixed startup password handling, so that it wont ask for passwd again, hence preventing deadlocks when the gui is running git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2057 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/authgpg.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libretroshare/src/pqi/authgpg.cc b/libretroshare/src/pqi/authgpg.cc index 91ae70629..19bf7cb55 100644 --- a/libretroshare/src/pqi/authgpg.cc +++ b/libretroshare/src/pqi/authgpg.cc @@ -68,16 +68,21 @@ gpgcert::~gpgcert() gpg_error_t pgp_pwd_callback(void *hook, const char *uid_hint, const char *passphrase_info, int prev_was_bad, int fd) { - std::string text = rsicontrol->getNotify().askForPassword("GPG key passphrase","GPG key passphrase") ; + static std::string sp = "" ; -// QString text = QInputDialog::getText(NULL, "GPG key passphrase", -// "GPG key passphrase", QLineEdit::Password, -// NULL, NULL); + std::string text ; + if(sp == "" || prev_was_bad) + { + if(prev_was_bad) + text = rsicontrol->getNotify().askForPassword("GPG key passphrase",std::string("Wrong password !\n\nPlease enter the password to unlock the following GPG key:\n\n ")+uid_hint+"\n") ; + else + text = rsicontrol->getNotify().askForPassword("GPG key passphrase",std::string("Please enter the password to unlock the following GPG key:\n\n")+uid_hint+"\n") ; + sp = text ; + } + else + text = sp ; - if (prev_was_bad) - fprintf(stderr, "pgp_pwd_callback() Prev was bad!\n"); - //fprintf(stderr, "pgp_pwd_callback() Set Password to:\"%s\"\n", passwd); fprintf(stderr, "pgp_pwd_callback() Set Password\n"); #ifndef WINDOWS_SYS