Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct multiple issues with Yubikey integration #880

Merged
merged 1 commit into from Sep 23, 2017

Conversation

droidmonkey
Copy link
Member

@droidmonkey droidmonkey commented Aug 18, 2017

Description

How has this been tested?

Manually using a Yubikey Neo

Types of changes

  • ✅ Bug fix (non-breaking change which fixes an issue)

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ✅ I have compiled and verified my code with -DWITH_ASAN=ON. [REQUIRED]

@bullet64
Copy link

Hello,

i have tested this pull and all work's fine for me. I will do some more tests.
Keep up the good work!

KeePassXC - Version 2.2.0
Revision: dfbf50d3454f8ad5b44e9c5b8f1cbcb1c40600dd

Bibliotheken:
- Qt 5.5.1
- libgcrypt 1.6.5

Betriebssystem: Linux Mint 18.2
CPU-Architektur: x86_64
Kernel: linux 4.11.0-14-generic

Aktivierte Erweiterungen:
- KeePassHTTP
- Auto-Type
- YubiKey

@cjustin88
Copy link

Hi,

What is the time-frame for the release that this pull request is targeting? The bug that this pull request fixes is particularly severe in that it can cause database corruption and interrupts database saving.

Thanks,
Justin

@phoerious
Copy link
Member

Target milestone is 2.2.1.

@droidmonkey
Copy link
Member Author

Basically I'd want to release shortly after this is merged.

@droidmonkey
Copy link
Member Author

@keepassxreboot/core-developers ready to merge this?

@@ -363,6 +363,8 @@ bool DatabaseTabWidget::saveDatabase(Database* db)
emit messageDismissTab();
return true;
} else {
dbStruct.modified = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@droidmonkey the only problem I have with that is that if the database file was not modified but the user tried to save manually, and the save fails, the db will be marked as dirty even though no changes have been made. You can try for example by removing write permission to the db file after opening it in keepassxc. Of course you could argue that it's not gonna happen often.

What about marking the database dirty before calling autosave in DatabaseTabWidget::modified():

diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -780,16 +780,17 @@ void DatabaseTabWidget::modified()
     Database* db = static_cast<Database*>(sender());
     DatabaseManagerStruct& dbStruct = m_dbList[db];
 
-    if (config()->get("AutoSaveAfterEveryChange").toBool() && dbStruct.saveToFilename) {
-        saveDatabase(db);
-        return;
-    }
-
     if (!dbStruct.modified) {
         dbStruct.modified = true;
         dbStruct.dbWidget->databaseModified();
         updateTabName(db);
     }
+
+    if (config()->get("AutoSaveAfterEveryChange").toBool() && dbStruct.saveToFilename) {
+        saveDatabase(db);
+    }
+
 }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole saving structure needs to be redone. I suggest moving this improvement edge case to then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@droidmonkey as you wish, but I thought the above diff was solving both problems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will need to think about that a little bit. The case I am trying to solve with my fix is the user requested a save and it failed to save so I am marking the database as dirty because I do not know if the state can be trusted. This incidentally fixes the issue when an auto save fails and never marks the database dirty (ie. the database != save file).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this ready to be merged?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I will be refactoring the code above with my database pointer fixes and will address it there for 2.3

* Fixed database not showing modified after failed save
* Fixed Yubikey not being redetected after replug
* Fixed single shot challenge resulting in failed saves
@louib louib merged commit 8e7fa3d into release/2.2.1 Sep 23, 2017
@droidmonkey droidmonkey deleted the hotfix/robust-yubikey branch September 23, 2017 16:16
droidmonkey added a commit that referenced this pull request Oct 1, 2017
- Corrected multiple snap issues [#934, #1011]
- Corrected multiple custom icon issues [#708, #719, #994]
- Corrected multiple Yubikey issues [#880]
- Fixed single instance preventing load on occasion [#997]
- Keep entry history when merging databases [#970]
- Prevent data loss if passwords were mismatched [#1007]
- Fixed crash after merge [#941]
- Added configurable auto-type default delay [#703]
- Unlock database dialog window comes to front [#663]
- Translation and compiling fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants