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
|
#ifdef GPG_DEBUG2
|
||||||
fprintf(stderr, "pgp_pwd_callback() called.\n");
|
fprintf(stderr, "pgp_pwd_callback() called.\n");
|
||||||
#endif
|
#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
|
#ifdef GPG_DEBUG2
|
||||||
std::cerr << "pgp_pwd_callback() got GPG passwd from gui." << std::endl;
|
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)
|
if((void*)fd != NULL)
|
||||||
{
|
{
|
||||||
#ifndef WINDOWS_SYS
|
#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? */
|
write(fd, "\n", 1); /* needs a new line? */
|
||||||
#else
|
#else
|
||||||
DWORD written = 0;
|
DWORD written = 0;
|
||||||
HANDLE winFd = (HANDLE) fd;
|
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);
|
WriteFile(winFd, "\n", 1, &written, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ class NotifyBase
|
|||||||
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};
|
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};
|
||||||
virtual void notifyDownloadCompleteCount(uint32_t /* count */) {};
|
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;
|
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||||
|
@ -1481,10 +1481,17 @@ int RsInit::LoadCertificates(bool autoLoginNT)
|
|||||||
|
|
||||||
//check if password is already in memory
|
//check if password is already in memory
|
||||||
|
|
||||||
if(RsInitConfig::passwd == "")
|
if(RsInitConfig::passwd == "") {
|
||||||
RsLoginHandler::getSSLPassword(RsInitConfig::preferedId,true,RsInitConfig::passwd) ;
|
if (RsLoginHandler::getSSLPassword(RsInitConfig::preferedId,true,RsInitConfig::passwd) == false) {
|
||||||
else
|
std::cerr << "RsLoginHandler::getSSLPassword() Failed!";
|
||||||
RsLoginHandler::checkAndStoreSSLPasswdIntoGPGFile(RsInitConfig::preferedId,RsInitConfig::passwd) ;
|
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;
|
std::cerr << "RsInitConfig::load_key.c_str() : " << RsInitConfig::load_key.c_str() << std::endl;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ void NotifyQt::notifyOwnAvatarChanged()
|
|||||||
emit ownAvatarChanged() ;
|
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() ;
|
RsAutoUpdatePage::lockAllEvents() ;
|
||||||
|
|
||||||
@ -139,11 +139,12 @@ std::string NotifyQt::askForPassword(const std::string& key_details,bool prev_is
|
|||||||
|
|
||||||
RsAutoUpdatePage::unlockAllEvents() ;
|
RsAutoUpdatePage::unlockAllEvents() ;
|
||||||
|
|
||||||
if (ret) {
|
if (ret == QDialog::Accepted) {
|
||||||
return dialog.textValue().toStdString();
|
password = dialog.textValue().toStdString();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyQt::notifyDiscInfoChanged()
|
void NotifyQt::notifyDiscInfoChanged()
|
||||||
|
@ -52,7 +52,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||||||
virtual void notifyDiscInfoChanged() ;
|
virtual void notifyDiscInfoChanged() ;
|
||||||
virtual void notifyDownloadComplete(const std::string& fileHash);
|
virtual void notifyDownloadComplete(const std::string& fileHash);
|
||||||
virtual void notifyDownloadCompleteCount(uint32_t count);
|
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 */
|
/* Notify from GUI */
|
||||||
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||||
|
Loading…
Reference in New Issue
Block a user