Skip to content

Correct multiple issues with Yubikey integration#880

Merged
louib merged 1 commit intorelease/2.2.1from
hotfix/robust-yubikey
Sep 23, 2017
Merged

Correct multiple issues with Yubikey integration#880
louib merged 1 commit intorelease/2.2.1from
hotfix/robust-yubikey

Conversation

@droidmonkey
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Member

Target milestone is 2.2.1.

@droidmonkey
Copy link
Copy Markdown
Member Author

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

@droidmonkey
Copy link
Copy Markdown
Member Author

@keepassxreboot/core-developers ready to merge this?

emit messageDismissTab();
return true;
} else {
dbStruct.modified = true;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

6 participants