From 9ea037ba3b95e9d9c09e1c867dc08d378a0f2c64 Mon Sep 17 00:00:00 2001 From: Siebe Schaap Date: Thu, 27 May 2021 20:20:08 +0200 Subject: [PATCH] Fix regular expression to test for Windows named pipe in SSH agent path; allowed backslashes in host. --- session/sshforward/sshprovider/agentprovider_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/session/sshforward/sshprovider/agentprovider_windows.go b/session/sshforward/sshprovider/agentprovider_windows.go index 28914319b762c..812e273c2e4cd 100644 --- a/session/sshforward/sshprovider/agentprovider_windows.go +++ b/session/sshforward/sshprovider/agentprovider_windows.go @@ -42,7 +42,7 @@ func isWindowsPipePath(path string) bool { // and requires winio.DialPipe() rather than DialTimeout("unix"). // Slashes and backslashes may be used interchangeably in the path. // Path separators may consist of multiple consecutive (back)slashes. - pipePattern := strings.ReplaceAll("^[/]{2}[^/]+[/]+pipe[/]+", "[/]", `[\\/]`) + pipePattern := strings.ReplaceAll("^[/]{2}[^/]+[/]+pipe[/]+", "/", `\\/`) ok, _ := regexp.MatchString(pipePattern, path) return ok }