From 146ea468c9aa3c2dbdb6ae74e288535f643ee780 Mon Sep 17 00:00:00 2001 From: Siebe Schaap Date: Thu, 27 May 2021 20:06:32 +0200 Subject: [PATCH] Update Windows named pipe handling for SSH forwarding to use x/sys/windows rather than syscall. Signed-off-by: Siebe Schaap --- .../sshforward/sshprovider/agentprovider_windows.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/session/sshforward/sshprovider/agentprovider_windows.go b/session/sshforward/sshprovider/agentprovider_windows.go index 4fff78180..1dcb26e36 100644 --- a/session/sshforward/sshprovider/agentprovider_windows.go +++ b/session/sshforward/sshprovider/agentprovider_windows.go @@ -6,10 +6,10 @@ import ( "net" "regexp" "strings" - "syscall" "github.com/Microsoft/go-winio" "github.com/pkg/errors" + "golang.org/x/sys/windows" ) // Returns the Windows OpenSSH agent named pipe path, but @@ -19,11 +19,11 @@ func getFallbackAgentPath() (string, error) { // than a UNIX socket. These pipes do not play nice // with os.Stat (which tries to open its target), so // use a FindFirstFile syscall to check for existence. - var fd syscall.Win32finddata + var fd windows.Win32finddata path := `\\.\pipe\openssh-ssh-agent` - pathPtr, _ := syscall.UTF16PtrFromString(path) - handle, err := syscall.FindFirstFile(pathPtr, &fd) + pathPtr, _ := windows.UTF16PtrFromString(path) + handle, err := windows.FindFirstFile(pathPtr, &fd) if err != nil { msg := "Windows OpenSSH agent not available at %s." + @@ -31,7 +31,7 @@ func getFallbackAgentPath() (string, error) { return "", errors.Errorf(msg, path) } - _ = syscall.CloseHandle(handle) + _ = windows.CloseHandle(handle) return path, nil }