From 9ec4deb83820789f8380aabff11de6ef056fcc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Vit=C3=A9?= Date: Wed, 12 Feb 2025 16:18:52 +0100 Subject: [PATCH] EditEntryWidget: SSH Agent: Load destination constraints into temporary settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using the "Add to agent" button in the SSH Agent category of the entry settings a default KeeAgentSettings structure will be used and filled-in with the current state of the UI elements. As destination contraints are not present in the UI for now those have not been loaded and thus the key was loaded into the SSH agent with no constraints at all. This change fixes it by loading the attachment first before overwriting with the data from the UI elements. Signed-off-by: Konrad Vité --- src/gui/entry/EditEntryWidget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 39850d9b5..66f27e5d1 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -734,6 +734,12 @@ void EditEntryWidget::updateSSHAgentKeyInfo() void EditEntryWidget::toKeeAgentSettings(KeeAgentSettings& settings) const { + // set from attachment to load settings aren't supported by the UI (e.g. + // destination constraints) + if (KeeAgentSettings::inEntryAttachments(m_attachments.data())) { + settings.fromEntryAttachments(m_attachments.data()); + } + settings.setAddAtDatabaseOpen(m_sshAgentUi->addKeyToAgentCheckBox->isChecked()); settings.setRemoveAtDatabaseClose(m_sshAgentUi->removeKeyFromAgentCheckBox->isChecked()); settings.setUseConfirmConstraintWhenAdding(m_sshAgentUi->requireUserConfirmationCheckBox->isChecked());