mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
TestSSHAgent: Skip testDestinationConstraints() on OpenSSH < 8.9
Signed-off-by: Konrad Vité <kvite@paktolos.net>
This commit is contained in:
parent
872e914520
commit
25f9d2214c
1 changed files with 16 additions and 0 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "sshagent/SSHAgent.h"
|
||||
|
||||
#include <QTest>
|
||||
#include <QVersionNumber>
|
||||
|
||||
QTEST_GUILESS_MAIN(TestSSHAgent)
|
||||
|
||||
|
|
@ -364,6 +365,21 @@ void TestSSHAgent::testConfirmConstraint()
|
|||
|
||||
void TestSSHAgent::testDestinationConstraints()
|
||||
{
|
||||
// ssh-agent does not support destination constraints before OpenSSH
|
||||
// version 8.9. Therefore we want to skip this test on older versions.
|
||||
// Unfortunately ssh-agent does not give us any way to retrieve its version
|
||||
// number neither via protocol nor on the command line. Therefore we use
|
||||
// the version number of the SSH client and assume it to be the same.
|
||||
QProcess ssh;
|
||||
ssh.setReadChannel(QProcess::StandardError);
|
||||
ssh.start("ssh", QStringList() << "-V");
|
||||
ssh.waitForFinished();
|
||||
auto ssh_version = QString::fromUtf8(ssh.readLine());
|
||||
ssh_version.remove(QRegExp("^OpenSSH_"));
|
||||
if (QVersionNumber ::fromString(ssh_version) < QVersionNumber(8, 9)) {
|
||||
QSKIP("Test requires ssh-agent >= 8.9");
|
||||
}
|
||||
|
||||
SSHAgent agent;
|
||||
agent.setEnabled(true);
|
||||
agent.setAuthSockOverride(m_agentSocketFileName);
|
||||
|
|
|
|||
Loading…
Reference in a new issue