From 6a12f450e67997f747bd8b264a717adb4459fd22 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Fri, 28 Jan 2022 21:28:01 -0500 Subject: [PATCH] Fix access denied errors when using KeeShare export/sync (#7322) --- src/keeshare/ShareExport.cpp | 7 ------- src/keeshare/ShareImport.cpp | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/keeshare/ShareExport.cpp b/src/keeshare/ShareExport.cpp index 55c4ca711..a457033af 100644 --- a/src/keeshare/ShareExport.cpp +++ b/src/keeshare/ShareExport.cpp @@ -155,13 +155,6 @@ ShareObserver::Result ShareExport::intoContainer(const QString& resolvedPath, const KeeShareSettings::Reference& reference, const Group* group) { - QFile file(resolvedPath); - const bool fileOpened = file.open(QIODevice::WriteOnly); - if (!fileOpened) { - qWarning("Opening export file failed"); - return {resolvedPath, ShareObserver::Result::Error, file.errorString()}; - } - QScopedPointer targetDb(extractIntoDatabase(reference, group)); if (resolvedPath.endsWith(".kdbx.share")) { // Write database to memory and sign it diff --git a/src/keeshare/ShareImport.cpp b/src/keeshare/ShareImport.cpp index 71d02b74f..123486456 100644 --- a/src/keeshare/ShareImport.cpp +++ b/src/keeshare/ShareImport.cpp @@ -47,7 +47,6 @@ ShareObserver::Result ShareImport::containerInto(const QString& resolvedPath, const KeeShareSettings::Reference& reference, Group* targetGroup) { - // TODO: Read signing certificate as well, but don't check validity QByteArray dbData; auto uf = unzOpen64(resolvedPath.toLatin1().constData()); @@ -71,6 +70,7 @@ ShareObserver::Result ShareImport::containerInto(const QString& resolvedPath, return {reference.path, ShareObserver::Result::Error, file.errorString()}; } dbData = file.readAll(); + file.close(); } QBuffer buffer(&dbData);