From cee0131d8f8fa1cddb511df5d180c1d1061962b5 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 24 Aug 2022 17:50:03 +0300 Subject: [PATCH] fix: Avoid double escaping of ProxyCommand on Windows Fixes #2853 --- cli/configssh.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/configssh.go b/cli/configssh.go index 40a5f49406b10..b84a42331275a 100644 --- a/cli/configssh.go +++ b/cli/configssh.go @@ -280,10 +280,16 @@ func configSSH() *cobra.Command { "\tLogLevel ERROR", ) if !skipProxyCommand { + // In SSH configs, strings inside "" are interpreted literally and there + // is no need to e.g. escape backslashes (common on Windows platforms). + // We will escape the quotes, though. + escapedBinaryFile := strings.ReplaceAll(binaryFile, "\"", "\\\"") if !wireguard { - configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --stdio %s", binaryFile, root, hostname)) + //nolint:gocritic // We don't want to use %q here, see above. + configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand \"%s\" --global-config \"%s\" ssh --stdio %s", escapedBinaryFile, root, hostname)) } else { - configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand %q --global-config %q ssh --wireguard --stdio %s", binaryFile, root, hostname)) + //nolint:gocritic // We don't want to use %q here, see above. + configOptions = append(configOptions, fmt.Sprintf("\tProxyCommand \"%s\" --global-config \"%s\" ssh --wireguard --stdio %s", escapedBinaryFile, root, hostname)) } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy