EditEntryWidget: SSH Agent: Load destination constraints into temporary settings

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é <kvite@paktolos.net>
This commit is contained in:
Konrad Vité 2025-02-12 16:18:52 +01:00
parent 6063508e7a
commit 9ec4deb838

View file

@ -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());