SSH Agent: Track keys immediately after successful add

Move m_addedKeys insertion after key add success but before optional cert add.
Ensures keys are always tracked (and auto-removed) even if cert fails.
This commit is contained in:
Alexandre Petit 2026-03-09 16:27:41 +01:00
parent 94ef87050a
commit 963bbd0c17
No known key found for this signature in database

View file

@ -330,6 +330,10 @@ bool SSHAgent::addIdentity(OpenSSHKey& key, const KeeAgentSettings& settings, co
return false;
}
OpenSSHKey keyCopy = key;
keyCopy.clearPrivate();
m_addedKeys[keyCopy] = qMakePair(databaseUuid, settings.removeAtDatabaseClose());
if (settings.useCertificate()) {
QByteArray requestCertificateData;
BinaryStream requestCertificate(&requestCertificateData);
@ -384,9 +388,6 @@ bool SSHAgent::addIdentity(OpenSSHKey& key, const KeeAgentSettings& settings, co
}
}
OpenSSHKey keyCopy = key;
keyCopy.clearPrivate();
m_addedKeys[keyCopy] = qMakePair(databaseUuid, settings.removeAtDatabaseClose());
return true;
}