mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-24 01:01:18 -04:00
Implement SSH key file path env substitution
Supports all platforms, including Windows with %FOO% syntax. Fixes #3523
This commit is contained in:
parent
47ce81c9a6
commit
6fc7be78ea
6 changed files with 56 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "KeeAgentSettings.h"
|
||||
#include "core/Tools.h"
|
||||
|
||||
KeeAgentSettings::KeeAgentSettings()
|
||||
: m_lifetimeConstraintDuration(600)
|
||||
|
@ -115,6 +116,11 @@ const QString KeeAgentSettings::fileName() const
|
|||
return m_fileName;
|
||||
}
|
||||
|
||||
const QString KeeAgentSettings::fileNameEnvSubst(QProcessEnvironment environment) const
|
||||
{
|
||||
return Tools::envSubstitute(m_fileName, environment);
|
||||
}
|
||||
|
||||
void KeeAgentSettings::setAllowUseOfSshKey(bool allowUseOfSshKey)
|
||||
{
|
||||
m_allowUseOfSshKey = allowUseOfSshKey;
|
||||
|
@ -361,7 +367,7 @@ bool KeeAgentSettings::toOpenSSHKey(const Entry* entry, OpenSSHKey& key, bool de
|
|||
fileName = m_attachmentName;
|
||||
privateKeyData = entry->attachments()->value(fileName);
|
||||
} else {
|
||||
QFile localFile(m_fileName);
|
||||
QFile localFile(fileNameEnvSubst());
|
||||
QFileInfo localFileInfo(localFile);
|
||||
fileName = localFileInfo.fileName();
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
const QString attachmentName() const;
|
||||
bool saveAttachmentToTempFile() const;
|
||||
const QString fileName() const;
|
||||
const QString fileNameEnvSubst(QProcessEnvironment environment = QProcessEnvironment::systemEnvironment()) const;
|
||||
|
||||
void setAllowUseOfSshKey(bool allowUseOfSshKey);
|
||||
void setAddAtDatabaseOpen(bool addAtDatabaseOpen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue