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 <christian.kandeler@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-09-27 09:52:20 +02:00
parent 3e0f7773b8
commit cbc6809b28
2 changed files with 4 additions and 1 deletions

View File

@@ -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"))

View File

@@ -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