From cbc6809b28a0a0aaa3e8399601ce5275184443ed Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 27 Sep 2023 09:52:20 +0200 Subject: [PATCH] SSH: Fix Askpass on Windows 11 The standard openssh on windows 11 will not use the "askpass" unless SSH_ASKPASS_REQUIRE is set to "force". see: https://github.com/PowerShell/Win32-OpenSSH/issues/2115 Change-Id: I96a32e333a39e0cf5f5dab4c0f9c201b20daf533 Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/devicesupport/sshparameters.cpp | 1 + src/plugins/vcsbase/vcsbaseplugin.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/devicesupport/sshparameters.cpp b/src/plugins/projectexplorer/devicesupport/sshparameters.cpp index 744e350eaef..22055cf7946 100644 --- a/src/plugins/projectexplorer/devicesupport/sshparameters.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshparameters.cpp @@ -77,6 +77,7 @@ bool SshParameters::setupSshEnvironment(Process *process) const bool hasDisplay = env.hasKey("DISPLAY") && (env.value("DISPLAY") != QString(":0")); if (SshSettings::askpassFilePath().exists()) { env.set("SSH_ASKPASS", SshSettings::askpassFilePath().toUserOutput()); + env.set("SSH_ASKPASS_REQUIRE", "force"); // OpenSSH only uses the askpass program if DISPLAY is set, regardless of the platform. if (!env.hasKey("DISPLAY")) diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 6880e42e5a2..29a25e1627b 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -751,8 +751,10 @@ FilePath source(IDocument *document) void setProcessEnvironment(Environment *e) { const QString prompt = Internal::commonSettings().sshPasswordPrompt().path(); - if (!prompt.isEmpty()) + if (!prompt.isEmpty()) { e->set("SSH_ASKPASS", prompt); + e->set("SSH_ASKPASS_REQUIRE", "force"); + } } } // namespace VcsBase