upgrading github.com/xanzy/ssh-agent for go 1.11 compatibility
This commit is contained in:
parent
561e973b4e
commit
d08cead067
|
@ -29,8 +29,8 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
. "syscall"
|
"syscall"
|
||||||
. "unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Maximum size of message can be sent to pageant
|
// Maximum size of message can be sent to pageant
|
||||||
|
@ -53,7 +53,7 @@ const (
|
||||||
type copyData struct {
|
type copyData struct {
|
||||||
dwData uintptr
|
dwData uintptr
|
||||||
cbData uint32
|
cbData uint32
|
||||||
lpData Pointer
|
lpData unsafe.Pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -65,7 +65,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func winAPI(dllName, funcName string) func(...uintptr) (uintptr, uintptr, error) {
|
func winAPI(dllName, funcName string) func(...uintptr) (uintptr, uintptr, error) {
|
||||||
proc := MustLoadDLL(dllName).MustFindProc(funcName)
|
proc := syscall.MustLoadDLL(dllName).MustFindProc(funcName)
|
||||||
return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) }
|
return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,21 +96,21 @@ func query(msg []byte) ([]byte, error) {
|
||||||
|
|
||||||
thID, _, _ := winGetCurrentThreadID()
|
thID, _, _ := winGetCurrentThreadID()
|
||||||
mapName := fmt.Sprintf("PageantRequest%08x", thID)
|
mapName := fmt.Sprintf("PageantRequest%08x", thID)
|
||||||
pMapName, _ := UTF16PtrFromString(mapName)
|
pMapName, _ := syscall.UTF16PtrFromString(mapName)
|
||||||
|
|
||||||
mmap, err := CreateFileMapping(InvalidHandle, nil, PAGE_READWRITE, 0, MaxMessageLen+4, pMapName)
|
mmap, err := syscall.CreateFileMapping(syscall.InvalidHandle, nil, syscall.PAGE_READWRITE, 0, MaxMessageLen+4, pMapName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer CloseHandle(mmap)
|
defer syscall.CloseHandle(mmap)
|
||||||
|
|
||||||
ptr, err := MapViewOfFile(mmap, FILE_MAP_WRITE, 0, 0, 0)
|
ptr, err := syscall.MapViewOfFile(mmap, syscall.FILE_MAP_WRITE, 0, 0, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer UnmapViewOfFile(ptr)
|
defer syscall.UnmapViewOfFile(ptr)
|
||||||
|
|
||||||
mmSlice := (*(*[MaxMessageLen]byte)(Pointer(ptr)))[:]
|
mmSlice := (*(*[MaxMessageLen]byte)(unsafe.Pointer(ptr)))[:]
|
||||||
|
|
||||||
copy(mmSlice, msg)
|
copy(mmSlice, msg)
|
||||||
|
|
||||||
|
@ -119,10 +119,10 @@ func query(msg []byte) ([]byte, error) {
|
||||||
cds := copyData{
|
cds := copyData{
|
||||||
dwData: agentCopydataID,
|
dwData: agentCopydataID,
|
||||||
cbData: uint32(len(mapNameBytesZ)),
|
cbData: uint32(len(mapNameBytesZ)),
|
||||||
lpData: Pointer(&(mapNameBytesZ[0])),
|
lpData: unsafe.Pointer(&(mapNameBytesZ[0])),
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(Pointer(&cds)))
|
resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(unsafe.Pointer(&cds)))
|
||||||
|
|
||||||
if resp == 0 {
|
if resp == 0 {
|
||||||
return nil, ErrSendMessage
|
return nil, ErrSendMessage
|
||||||
|
@ -140,7 +140,7 @@ func query(msg []byte) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func pageantWindow() uintptr {
|
func pageantWindow() uintptr {
|
||||||
nameP, _ := UTF16PtrFromString("Pageant")
|
nameP, _ := syscall.UTF16PtrFromString("Pageant")
|
||||||
h, _, _ := winFindWindow(uintptr(Pointer(nameP)), uintptr(Pointer(nameP)))
|
h, _, _ := winFindWindow(uintptr(unsafe.Pointer(nameP)), uintptr(unsafe.Pointer(nameP)))
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
|
@ -2408,10 +2408,10 @@
|
||||||
"revisionTime": "2017-06-05T21:53:11Z"
|
"revisionTime": "2017-06-05T21:53:11Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "iHiMTBffQvWYlOLu3130JXuQpgQ=",
|
"checksumSHA1": "VNhImVFfxO7x8Kp1BrM2zgp4vi0=",
|
||||||
"path": "github.com/xanzy/ssh-agent",
|
"path": "github.com/xanzy/ssh-agent",
|
||||||
"revision": "ba9c9e33906f58169366275e3450db66139a31a9",
|
"revision": "640f0ab560aeb89d523bb6ac322b1244d5c3796c",
|
||||||
"revisionTime": "2015-12-15T15:34:51Z"
|
"revisionTime": "2018-07-03T18:17:07Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "xtw+Llokq30p1Gn+Q8JBZ7NtE+I=",
|
"checksumSHA1": "xtw+Llokq30p1Gn+Q8JBZ7NtE+I=",
|
||||||
|
|
Loading…
Reference in New Issue