Corrected multiple Yubikey bugs (#880)

* Fixed database not showing modified after failed save
* Fixed Yubikey not being redetected after replug
* Fixed single shot challenge resulting in failed saves
This commit is contained in:
Jonathan White 2017-09-23 11:45:20 -04:00 committed by louib
parent df3051038e
commit 8e7fa3d3d6
3 changed files with 5 additions and 3 deletions

View file

@ -363,6 +363,8 @@ bool DatabaseTabWidget::saveDatabase(Database* db)
emit messageDismissTab(); emit messageDismissTab();
return true; return true;
} else { } else {
dbStruct.modified = true;
updateTabName(db);
emit messageTab(tr("Writing the database failed.").append("\n").append(errorMessage), emit messageTab(tr("Writing the database failed.").append("\n").append(errorMessage),
MessageWidget::Error); MessageWidget::Error);
return false; return false;

View file

@ -50,7 +50,7 @@ QByteArray YkChallengeResponseKey::rawKey() const
*/ */
bool YkChallengeResponseKey::challenge(const QByteArray& challenge) bool YkChallengeResponseKey::challenge(const QByteArray& challenge)
{ {
return this->challenge(challenge, 1); return this->challenge(challenge, 2);
} }
bool YkChallengeResponseKey::challenge(const QByteArray& challenge, unsigned retries) bool YkChallengeResponseKey::challenge(const QByteArray& challenge, unsigned retries)
@ -70,8 +70,8 @@ bool YkChallengeResponseKey::challenge(const QByteArray& challenge, unsigned ret
QEventLoop loop; QEventLoop loop;
QFutureWatcher<YubiKey::ChallengeResult> watcher; QFutureWatcher<YubiKey::ChallengeResult> watcher;
watcher.setFuture(future);
connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit())); connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit()));
watcher.setFuture(future);
loop.exec(); loop.exec();
if (m_blocking) { if (m_blocking) {

View file

@ -154,7 +154,7 @@ YubiKey::ChallengeResult YubiKey::challenge(int slot, bool mayBlock, const QByte
QByteArray paddedChallenge = challenge; QByteArray paddedChallenge = challenge;
// ensure that YubiKey::init() succeeded // ensure that YubiKey::init() succeeded
if (m_yk == NULL) { if (!init()) {
m_mutex.unlock(); m_mutex.unlock();
return ERROR; return ERROR;
} }