mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
The password dialog can be canceled.
Fixed an error when cancel the login password dialog at startup. RetroShare did not start after this. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4537 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b1ac8bc9d2
commit
687b2ecd36
@ -107,7 +107,10 @@ gpg_error_t pgp_pwd_callback(void *hook, const char *uid_hint, const char *passp
|
||||
#ifdef GPG_DEBUG2
|
||||
fprintf(stderr, "pgp_pwd_callback() called.\n");
|
||||
#endif
|
||||
std::string text = rsicontrol->getNotify().askForPassword(uid_hint,prev_was_bad);
|
||||
std::string password;
|
||||
if (rsicontrol->getNotify().askForPassword(uid_hint, prev_was_bad, password) == false) {
|
||||
return GPG_ERR_CANCELED;
|
||||
}
|
||||
|
||||
#ifdef GPG_DEBUG2
|
||||
std::cerr << "pgp_pwd_callback() got GPG passwd from gui." << std::endl;
|
||||
@ -116,12 +119,12 @@ gpg_error_t pgp_pwd_callback(void *hook, const char *uid_hint, const char *passp
|
||||
if((void*)fd != NULL)
|
||||
{
|
||||
#ifndef WINDOWS_SYS
|
||||
write(fd, text.c_str(), text.size());
|
||||
write(fd, password.c_str(), password.size());
|
||||
write(fd, "\n", 1); /* needs a new line? */
|
||||
#else
|
||||
DWORD written = 0;
|
||||
HANDLE winFd = (HANDLE) fd;
|
||||
WriteFile(winFd, text.c_str(), text.size(), &written, NULL);
|
||||
WriteFile(winFd, password.c_str(), password.size(), &written, NULL);
|
||||
WriteFile(winFd, "\n", 1, &written, NULL);
|
||||
#endif
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ class NotifyBase
|
||||
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};
|
||||
virtual void notifyDownloadCompleteCount(uint32_t /* count */) {};
|
||||
|
||||
virtual std::string askForPassword(const std::string& /* key_details */ ,bool /* prev_is_bad */ ) { return "" ;}
|
||||
virtual bool askForPassword(const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */ ) { return false ;}
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
|
@ -1481,10 +1481,17 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
||||
|
||||
//check if password is already in memory
|
||||
|
||||
if(RsInitConfig::passwd == "")
|
||||
RsLoginHandler::getSSLPassword(RsInitConfig::preferedId,true,RsInitConfig::passwd) ;
|
||||
else
|
||||
RsLoginHandler::checkAndStoreSSLPasswdIntoGPGFile(RsInitConfig::preferedId,RsInitConfig::passwd) ;
|
||||
if(RsInitConfig::passwd == "") {
|
||||
if (RsLoginHandler::getSSLPassword(RsInitConfig::preferedId,true,RsInitConfig::passwd) == false) {
|
||||
std::cerr << "RsLoginHandler::getSSLPassword() Failed!";
|
||||
return 0 ;
|
||||
}
|
||||
} else {
|
||||
if (RsLoginHandler::checkAndStoreSSLPasswdIntoGPGFile(RsInitConfig::preferedId,RsInitConfig::passwd) == false) {
|
||||
std::cerr << "RsLoginHandler::checkAndStoreSSLPasswdIntoGPGFile() Failed!";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "RsInitConfig::load_key.c_str() : " << RsInitConfig::load_key.c_str() << std::endl;
|
||||
|
||||
|
@ -124,7 +124,7 @@ void NotifyQt::notifyOwnAvatarChanged()
|
||||
emit ownAvatarChanged() ;
|
||||
}
|
||||
|
||||
std::string NotifyQt::askForPassword(const std::string& key_details,bool prev_is_bad)
|
||||
bool NotifyQt::askForPassword(const std::string& key_details, bool prev_is_bad, std::string& password)
|
||||
{
|
||||
RsAutoUpdatePage::lockAllEvents() ;
|
||||
|
||||
@ -139,11 +139,12 @@ std::string NotifyQt::askForPassword(const std::string& key_details,bool prev_is
|
||||
|
||||
RsAutoUpdatePage::unlockAllEvents() ;
|
||||
|
||||
if (ret) {
|
||||
return dialog.textValue().toStdString();
|
||||
if (ret == QDialog::Accepted) {
|
||||
password = dialog.textValue().toStdString();
|
||||
return true;
|
||||
}
|
||||
|
||||
return "";
|
||||
return false;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyDiscInfoChanged()
|
||||
|
@ -52,7 +52,7 @@ class NotifyQt: public QObject, public NotifyBase
|
||||
virtual void notifyDiscInfoChanged() ;
|
||||
virtual void notifyDownloadComplete(const std::string& fileHash);
|
||||
virtual void notifyDownloadCompleteCount(uint32_t count);
|
||||
virtual std::string askForPassword(const std::string& key_details,bool prev_is_bad) ;
|
||||
virtual bool askForPassword(const std::string& key_details, bool prev_is_bad, std::string& password);
|
||||
|
||||
/* Notify from GUI */
|
||||
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||
|
Loading…
Reference in New Issue
Block a user