[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#729578: marked as done (keepassx: Store location of key file in bookmark)



Your message dated Tue, 30 Sep 2025 10:59:45 +0000
with message-id <[🔎] E1v3Y5B-003A8a-1E@fasolo.debian.org>
and subject line Bug#1116505: Removed package(s) from unstable
has caused the Debian Bug report #729578,
regarding keepassx: Store location of key file in bookmark
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
729578: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=729578
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: keepassx
Version: 0.4.3+dfsg-0.1
Severity: wishlist
Tags: patch upstream

Dear Maintainer,

I am using keepassx on a regular basis to store my credentials using
multiple databases. I am using passphrases as well as key files to
secure the individual kdb files, however switching between the different
databases is a hassle due to the need to re-select the key file everytime.

With the attached patch applied, keepassx optionally stores the path to the
appropiate keyfile with each bookmark, making switching between the different
databases easier.

-- System Information:
Debian Release: 7.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages keepassx depends on:
ii  libc6       2.13-38
ii  libgcc1     1:4.7.2-5
ii  libqt4-xml  4:4.8.2+dfsg-11
ii  libqtcore4  4:4.8.2+dfsg-11
ii  libqtgui4   4:4.8.2+dfsg-11
ii  libstdc++6  4.7.2-5
ii  libx11-6    2:1.5.0-1+deb7u1
ii  libxtst6    2:1.2.1-1+deb7u1

keepassx recommends no packages.

keepassx suggests no packages.

-- no debconf information
>From 35348384cfa4cb46d3184723dde504865c3a5463 Mon Sep 17 00:00:00 2001
From: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Date: Thu, 14 Nov 2013 15:03:32 +0100
Subject: [PATCH] store keyfile location in bookmark

This patch adds the location of the keyfile used to unlock the database to the
bookmark entry. This is especially useful if you use multiple databases and
switch between them on a regular basis.
---
 src/dialogs/AddBookmarkDlg.cpp     |   18 +++++++++++++++---
 src/dialogs/AddBookmarkDlg.h       |    3 ++-
 src/dialogs/ManageBookmarksDlg.cpp |    2 +-
 src/dialogs/PasswordDlg.cpp        |   12 +++++++++---
 src/dialogs/PasswordDlg.h          |    2 ++
 src/forms/AddBookmarkDlg.ui        |   23 ++++++++++++++++++++---
 src/lib/bookmarks.cpp              |   12 ++++++++++--
 src/lib/bookmarks.h                |    6 ++++--
 src/mainwindow.cpp                 |   10 +++++++---
 src/mainwindow.h                   |    1 +
 10 files changed, 71 insertions(+), 18 deletions(-)

diff --git a/src/dialogs/AddBookmarkDlg.cpp b/src/dialogs/AddBookmarkDlg.cpp
index c7337fb..78b1116 100644
--- a/src/dialogs/AddBookmarkDlg.cpp
+++ b/src/dialogs/AddBookmarkDlg.cpp
@@ -21,11 +21,12 @@
 #include "AddBookmarkDlg.h"
 
 
-AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _ItemID):QDialog(parent)
+AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, QString DefaultKeyFilename, int _ItemID):QDialog(parent)
 {
 	setupUi(this);
 	ItemID=_ItemID;
 	connect(Button_Browse,SIGNAL(clicked()),this,SLOT(OnButtonBrowse()));
+	connect(Button_Keyfile_Browse,SIGNAL(clicked()),this,SLOT(OnKeyfileButtonBrowse()));
 	connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnButtonOk()));
 	connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(reject()));
 	if(ItemID==-1){
@@ -35,12 +36,16 @@ AddBookmarkDlg::AddBookmarkDlg(QWidget* parent, QString DefaultFilename, int _It
 			QMetaObject::invokeMethod(this, "OnButtonBrowse", Qt::QueuedConnection);
 		else
 			Edit_Filename->setText(DefaultFilename);
+
+		if(!DefaultFilename.isEmpty())
+			Edit_Keyfile->setText(DefaultKeyFilename);
 	}
 	else {
 		createBanner(&BannerPixmap,getPixmap("bookmark_edit"),tr("Edit Bookmark"),width());
 
 		Edit_Title->setText(KpxBookmarks::title(ItemID));
 		Edit_Filename->setText(KpxBookmarks::path(ItemID));
+		Edit_Keyfile->setText(KpxBookmarks::keypath(ItemID));
 		setWindowTitle(tr("Edit Bookmark"));
 	}
 }
@@ -59,10 +64,17 @@ void AddBookmarkDlg::OnButtonBrowse(){
 		Edit_Filename->setText(path);
 }
 
+void AddBookmarkDlg::OnKeyfileButtonBrowse(){
+	QString path=KpxFileDialogs::openExistingFile(this,"AddBookmarkDlg", tr("Add Bookmark"),
+									              QStringList() << tr("All Files (*)"));
+	if(path!=QString())
+		Edit_Keyfile->setText(path);
+}
+
 void AddBookmarkDlg::OnButtonOk(){
 	if(ItemID==-1)
-		ItemID=KpxBookmarks::add(Edit_Title->text(),Edit_Filename->text());
+		ItemID=KpxBookmarks::add(Edit_Title->text(),Edit_Filename->text(),Edit_Keyfile->text());
 	else
-		KpxBookmarks::edit(Edit_Title->text(),Edit_Filename->text(),ItemID);
+		KpxBookmarks::edit(Edit_Title->text(),Edit_Filename->text(),Edit_Keyfile->text(),ItemID);
 	accept();
 }
diff --git a/src/dialogs/AddBookmarkDlg.h b/src/dialogs/AddBookmarkDlg.h
index 7786a62..26888f8 100644
--- a/src/dialogs/AddBookmarkDlg.h
+++ b/src/dialogs/AddBookmarkDlg.h
@@ -27,7 +27,7 @@ class AddBookmarkDlg : public QDialog, private Ui::AddBookmarkDlg
 	Q_OBJECT
 
 	public:
-		AddBookmarkDlg (QWidget* parent=0, QString DefaultFilename=QString(), int ItemID=-1);
+		AddBookmarkDlg (QWidget* parent=0, QString DefaultFilename=QString(), QString DefaultKeyFilename=QString(), int ItemID=-1);
 		int ItemID;
 
     private:
@@ -37,6 +37,7 @@ class AddBookmarkDlg : public QDialog, private Ui::AddBookmarkDlg
     private slots:
 		void OnButtonOk();
 		void OnButtonBrowse();
+		void OnKeyfileButtonBrowse();
 
 };
 
diff --git a/src/dialogs/ManageBookmarksDlg.cpp b/src/dialogs/ManageBookmarksDlg.cpp
index 21f467f..15ca7b4 100644
--- a/src/dialogs/ManageBookmarksDlg.cpp
+++ b/src/dialogs/ManageBookmarksDlg.cpp
@@ -112,7 +112,7 @@ void ManageBookmarksDlg::OnButtonDown(){
 
 void ManageBookmarksDlg::edit(QListWidgetItem* item){
 	int i=item->data(Qt::UserRole).toInt();
-	AddBookmarkDlg dlg(this,QString(),i);
+	AddBookmarkDlg dlg(this,QString(),QString(),i);
 	dlg.exec();
 	item->setText(KpxBookmarks::title(i));
 }
diff --git a/src/dialogs/PasswordDlg.cpp b/src/dialogs/PasswordDlg.cpp
index f9c3a30..0d80c94 100644
--- a/src/dialogs/PasswordDlg.cpp
+++ b/src/dialogs/PasswordDlg.cpp
@@ -136,7 +136,7 @@ PasswordDialog::PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const
 		// Adding all existing bookmarks
 		for(int i=0;i<KpxBookmarks::count();i++){
 			QAction* action=new QAction(this);
-			action->setData(KpxBookmarks::path(i));
+			action->setData(i);
 			action->setText(KpxBookmarks::title(i));
 			action->setIcon(getIcon("document"));
 			BookmarkMenu->addAction(action);		
@@ -172,6 +172,11 @@ PasswordDialog::PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const
 	OnCheckBoxesChanged();
 }
 
+void PasswordDialog::setKeyFile(QString keypath)
+{
+	Check_KeyFile->setChecked(! keypath.isEmpty());
+	Combo_KeyFile->setEditText(keypath);
+}
 
 void PasswordDialog::OnButtonBrowse()
 {
@@ -331,9 +336,10 @@ void PasswordDialog::OnBookmarkTriggered(QAction* action){
 	if(action->data().toString()==QString())
 		setWindowTitle(Filename);
 	else
-		setWindowTitle(action->data().toString());
+		setWindowTitle(KpxBookmarks::path(action->data().toInt()));
 	Label_Bookmark->setText(action->text());
-	BookmarkFilename=action->data().toString();
+	BookmarkFilename=KpxBookmarks::path(action->data().toInt());
+	setKeyFile(KpxBookmarks::keypath(action->data().toInt()));
 }
 
 void PasswordDialog::OnGenKeyFile(){
diff --git a/src/dialogs/PasswordDlg.h b/src/dialogs/PasswordDlg.h
index 4e2f9e6..ae55144 100644
--- a/src/dialogs/PasswordDlg.h
+++ b/src/dialogs/PasswordDlg.h
@@ -48,6 +48,8 @@ class PasswordDialog : public QDialog, private Ui_PasswordDlg {
 			
 		PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const QString& filename=QString());
 		
+		void setKeyFile(QString keypath);
+
 		// result functions
 		QString selectedBookmark();
 		QString keyFile();
diff --git a/src/forms/AddBookmarkDlg.ui b/src/forms/AddBookmarkDlg.ui
index bfc938d..7120070 100644
--- a/src/forms/AddBookmarkDlg.ui
+++ b/src/forms/AddBookmarkDlg.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>500</width>
-    <height>180</height>
+    <height>240</height>
    </rect>
   </property>
   <property name="sizePolicy" >
@@ -19,13 +19,13 @@
   <property name="minimumSize" >
    <size>
     <width>500</width>
-    <height>180</height>
+    <height>240</height>
    </size>
   </property>
   <property name="maximumSize" >
    <size>
     <width>500</width>
-    <height>180</height>
+    <height>240</height>
    </size>
   </property>
   <property name="windowTitle" >
@@ -77,6 +77,23 @@
        </property>
       </widget>
      </item>
+     <item row="2" column="0" >
+      <widget class="QLabel" name="label_3" >
+       <property name="text" >
+        <string>Keyfile:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1" >
+      <widget class="QLineEdit" name="Edit_Keyfile" />
+     </item>
+     <item row="2" column="2" >
+      <widget class="QPushButton" name="Button_Keyfile_Browse" >
+       <property name="text" >
+        <string>Browse...</string>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
    <item>
diff --git a/src/lib/bookmarks.cpp b/src/lib/bookmarks.cpp
index 1c3b748..8ac56e0 100644
--- a/src/lib/bookmarks.cpp
+++ b/src/lib/bookmarks.cpp
@@ -30,6 +30,7 @@ void KpxBookmarks::load(){
 		BookmarkEntry entry;
 		entry.Title = config->settings.value( QString("Bookmarks/%1/Title").arg(i) ).toString();
 		entry.Path = config->settings.value( QString("Bookmarks/%1/Path").arg(i) ).toString();
+		entry.KeyPath = config->settings.value( QString("Bookmarks/%1/Keypath").arg(i) ).toString();
 		if (!entry.Title.isNull() && !entry.Path.isNull())
 			Bookmarks << entry;
 	}
@@ -47,11 +48,15 @@ QString KpxBookmarks::path(int i){
 	return Bookmarks[i].Path;
 }
 
+QString KpxBookmarks::keypath(int i){
+	return Bookmarks[i].KeyPath;
+}
 
-int KpxBookmarks::add(const QString& Title,const QString& Path){
+int KpxBookmarks::add(const QString& Title,const QString& Path,const QString& KeyPath){
 	BookmarkEntry entry;
 	entry.Title=Title;
 	entry.Path=Path;
+	entry.KeyPath=KeyPath;
 	entry.Index=Bookmarks.size();
 	Bookmarks<<entry;
 	save();
@@ -62,6 +67,7 @@ void KpxBookmarks::save(){
 	for (int i=0;i<count();i++){
 		config->settings.setValue( QString("Bookmarks/%1/Title").arg(i+1), Bookmarks[i].Title );
 		config->settings.setValue( QString("Bookmarks/%1/Path").arg(i+1), Bookmarks[i].Path );
+		config->settings.setValue( QString("Bookmarks/%1/KeyPath").arg(i+1), Bookmarks[i].KeyPath );
 	}
 	config->settings.setValue("Bookmarks/size", count());
 	
@@ -70,6 +76,7 @@ void KpxBookmarks::save(){
 	while ( config->settings.contains( QString("Bookmarks/%1/Title").arg(i) ) ){
 		config->settings.remove( QString("Bookmarks/%1/Title").arg(i) );
 		config->settings.remove( QString("Bookmarks/%1/Path").arg(i) );
+		config->settings.remove( QString("Bookmarks/%1/KeyPath").arg(i) );
 		i++;
 	}
 }
@@ -79,9 +86,10 @@ void KpxBookmarks::remove(int index){
 	save();
 }
 
-void KpxBookmarks::edit(const QString& Title,const QString& Path,int i){
+void KpxBookmarks::edit(const QString& Title,const QString& Path,const QString& KeyPath, int i){
 	Bookmarks[i].Title=Title;
 	Bookmarks[i].Path=Path;
+	Bookmarks[i].KeyPath=KeyPath;
 	save();
 }
 
diff --git a/src/lib/bookmarks.h b/src/lib/bookmarks.h
index 6d8d56d..50cab12 100644
--- a/src/lib/bookmarks.h
+++ b/src/lib/bookmarks.h
@@ -22,19 +22,21 @@
 class KpxBookmarks {	
 	public:
 		static void load();
-		static int add(const QString& Title,const QString& Path);
+		static int add(const QString& Title,const QString& Path,const QString& KeyPath);
 		static void remove(int id);
-		static void edit(const QString& Title,const QString& Path, int Index);
+		static void edit(const QString& Title,const QString& Path,const QString& KeyPath, int Index);
 		static int count();
 		static void resort(QList<int> order);
 		static QString title(int Index);
 		static QString path(int Index);
+		static QString keypath(int Index);
 	private:
 		static void save();
 		class BookmarkEntry {
 			public:
 				QString Title;
 				QString Path;
+				QString KeyPath;
 				int Index;		
 		};
 		static QList<BookmarkEntry> Bookmarks;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 556ee3a..e8ca8f9 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -411,8 +411,7 @@ void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
 	}
 }
 
-
-bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
+bool KeepassMainWindow::openDatabase(QString filename,QString keypath,bool IsAuto){
 	if (!QFile::exists(filename)){
 		QMessageBox::critical(this, tr("Error"), tr("The database file does not exist."));
 		return false;
@@ -450,6 +449,7 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
 	if(IsAuto)
 		flags = PasswordDialog::Flag_Auto;
 	PasswordDialog dlg(this,PasswordDialog::Mode_Ask,flags,filename);
+	dlg.setKeyFile(keypath);
 	if (InUnLock){
 		dlg.setWindowModality(Qt::WindowModal);
 		unlockDlg = &dlg;
@@ -515,6 +515,10 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
 	return true;
 }
 
+bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
+	return openDatabase(filename, QString(), IsAuto);
+}
+
 void KeepassMainWindow::fakeOpenDatabase(const QString& filename){
 	if (!QFile::exists(filename)){
 		QMessageBox::critical(this, tr("Error"), tr("The database file does not exist."));
@@ -1456,7 +1460,7 @@ void KeepassMainWindow::OnBookmarkTriggered(QAction* action){
 		}
 	}
 	else {
-		openDatabase(KpxBookmarks::path(action->data().toInt()));
+		openDatabase(KpxBookmarks::path(action->data().toInt()), KpxBookmarks::keypath(action->data().toInt()));
 	}
 }
 
diff --git a/src/mainwindow.h b/src/mainwindow.h
index a9b8d67..c76eccd 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -113,6 +113,7 @@ class KeepassMainWindow : public QMainWindow, private Ui_MainWindow{
 		void setStateGroupSelected(SelectionState s);
 		void setStateEntrySelected(SelectionState s);
 		bool openDatabase(QString filename,bool IsAuto=false);
+		bool openDatabase(QString filename,QString keypath,bool IsAuto=false);
 		void fakeOpenDatabase(const QString& filename);
 		void setupDatabaseConnections(IDatabase* DB);
 		bool closeDatabase(bool lock=false);
-- 
1.7.10.4


--- End Message ---
--- Begin Message ---
Version: 2.0.3+keepassxc1+rm

Dear submitter,

as the package keepassx has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/1116505

The version of this package that was in Debian prior to this removal
can still be found using https://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Thorsten Alteholz (the ftpmaster behind the curtain)

--- End Message ---

Reply to: