+33
-2
lines changedFilter options
+33
-2
lines changed Original file line number Diff line number Diff line change
@@ -17,5 +17,5 @@ require (
17
17
github.com/lxn/win v0.0.0-20181015143721-a7f87360b10e
18
18
github.com/oxtoacart/bpool v0.0.0-20190227141107-8c4636f812cc // indirect
19
19
github.com/stretchr/testify v1.3.0 // indirect
20
-
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67
20
+
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d
21
21
)
Original file line number Diff line number Diff line change
@@ -35,3 +35,5 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
35
35
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
36
36
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67 h1:1Fzlr8kkDLQwqMP8GxrhptBLqZG/EDpiATneiZHY998=
37
37
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
38
+
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d h1:62ap6LNOjDU6uGmKXHJbSfciMoV+FeI1sRXx/pLDL44=
39
+
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ import (
13
13
"net"
14
14
"os"
15
15
"os/signal"
16
+
"os/user"
16
17
"reflect"
17
18
"sync"
18
19
"syscall"
@@ -53,8 +54,34 @@ type copyDataStruct struct {
53
54
lpData uintptr
54
55
}
55
56
57
+
type SecurityAttributes struct {
58
+
Length uint32
59
+
SecurityDescriptor uintptr
60
+
InheritHandle uint32
61
+
}
62
+
56
63
var queryPageantMutex sync.Mutex
57
64
65
+
func makeInheritSaWithSid() *windows.SecurityAttributes {
66
+
var sa windows.SecurityAttributes
67
+
68
+
u, err := user.Current()
69
+
70
+
if err == nil {
71
+
sd, err := windows.SecurityDescriptorFromString("O:" + u.Uid)
72
+
if err == nil {
73
+
sa.SecurityDescriptor = sd
74
+
}
75
+
}
76
+
77
+
sa.Length = uint32(unsafe.Sizeof(sa))
78
+
79
+
sa.InheritHandle = 1
80
+
81
+
return &sa
82
+
83
+
}
84
+
58
85
func queryPageant(buf []byte) (result []byte, err error) {
59
86
if len(buf) > agentMaxMessageLength {
60
87
err = errors.New("Message too long")
@@ -75,7 +102,9 @@ func queryPageant(buf []byte) (result []byte, err error) {
75
102
mapName := fmt.Sprintf("WSLPageantRequest")
76
103
queryPageantMutex.Lock()
77
104
78
-
fileMap, err := windows.CreateFileMapping(invalidHandleValue, nil, pageReadWrite, 0, agentMaxMessageLength, syscall.StringToUTF16Ptr(mapName))
105
+
var sa = makeInheritSaWithSid()
106
+
107
+
fileMap, err := windows.CreateFileMapping(invalidHandleValue, sa, pageReadWrite, 0, agentMaxMessageLength, syscall.StringToUTF16Ptr(mapName))
79
108
if err != nil {
80
109
queryPageantMutex.Unlock()
81
110
return
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4