You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/cim/smb.go
+39-2Lines changed: 39 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
package cim
5
5
6
6
import (
7
+
"strings"
8
+
7
9
"github.com/microsoft/wmi/pkg/base/query"
8
10
cim "github.com/microsoft/wmi/pkg/wmiinstance"
9
11
)
@@ -17,8 +19,24 @@ const (
17
19
SmbMappingStatusConnecting
18
20
SmbMappingStatusReconnecting
19
21
SmbMappingStatusUnavailable
22
+
23
+
credentialDelimiter=":"
20
24
)
21
25
26
+
// escapeQueryParameter escapes a parameter for WMI Queries
27
+
funcescapeQueryParameter(sstring) string {
28
+
s=strings.ReplaceAll(s, "'", "''")
29
+
s=strings.ReplaceAll(s, "\\", "\\\\")
30
+
returns
31
+
}
32
+
33
+
funcescapeUserName(userNamestring) string {
34
+
// refer to https://github.com/PowerShell/PowerShell/blob/9303de597da55963a6e26a8fe164d0b256ca3d4d/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs#L169-L170
// refer to https://github.com/PowerShell/PowerShell/blob/9303de597da55963a6e26a8fe164d0b256ca3d4d/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs#L166-L178
// refer to https://github.com/PowerShell/PowerShell/blob/9303de597da55963a6e26a8fe164d0b256ca3d4d/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs#L169-L170
// refer to https://github.com/PowerShell/PowerShell/blob/9303de597da55963a6e26a8fe164d0b256ca3d4d/src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/cimConverter.cs#L166-L178
0 commit comments