summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/sys/windows/security_windows.go
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2019-10-01 22:15:58 +0200
committerMiloslav Trmač <mitr@redhat.com>2019-10-04 20:18:23 +0200
commitd3f59bedb393521986e645bc48c47938f321b643 (patch)
treec61aa40e008b7fcb371d899880a4afd1714f50af /vendor/golang.org/x/sys/windows/security_windows.go
parentbd08fc0e9b3a9943008585879877b68789e38c31 (diff)
downloadpodman-d3f59bedb393521986e645bc48c47938f321b643.tar.gz
podman-d3f59bedb393521986e645bc48c47938f321b643.tar.bz2
podman-d3f59bedb393521986e645bc48c47938f321b643.zip
Update c/image to v4.0.1 and buildah to 1.11.3
This requires updating all import paths throughout, and a matching buildah update to interoperate. I can't figure out the reason for go.mod tracking github.com/containers/image v3.0.2+incompatible // indirect ((go mod graph) lists it as a direct dependency of libpod, but (go list -json -m all) lists it as an indirect dependency), but at least looking at the vendor subdirectory, it doesn't seem to be actually used in the built binaries. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'vendor/golang.org/x/sys/windows/security_windows.go')
-rw-r--r--vendor/golang.org/x/sys/windows/security_windows.go44
1 files changed, 41 insertions, 3 deletions
diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go
index 61b49647b..7b2cfb9e0 100644
--- a/vendor/golang.org/x/sys/windows/security_windows.go
+++ b/vendor/golang.org/x/sys/windows/security_windows.go
@@ -644,6 +644,8 @@ func (tml *Tokenmandatorylabel) Size() uint32 {
//sys DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) = advapi32.DuplicateTokenEx
//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW
//sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW
+//sys getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetWindowsDirectoryW
+//sys getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemWindowsDirectoryW
// An access token contains the security information for a logon session.
// The system creates an access token when a user logs on, and every
@@ -664,7 +666,7 @@ func OpenCurrentProcessToken() (Token, error) {
return 0, e
}
var t Token
- e = OpenProcessToken(p, TOKEN_QUERY, &t)
+ e = OpenProcessToken(p, TOKEN_QUERY|TOKEN_DUPLICATE, &t)
if e != nil {
return 0, e
}
@@ -785,8 +787,8 @@ func (token Token) GetLinkedToken() (Token, error) {
return linkedToken, nil
}
-// GetSystemDirectory retrieves path to current location of the system
-// directory, which is typically, though not always, C:\Windows\System32.
+// GetSystemDirectory retrieves the path to current location of the system
+// directory, which is typically, though not always, `C:\Windows\System32`.
func GetSystemDirectory() (string, error) {
n := uint32(MAX_PATH)
for {
@@ -802,6 +804,42 @@ func GetSystemDirectory() (string, error) {
}
}
+// GetWindowsDirectory retrieves the path to current location of the Windows
+// directory, which is typically, though not always, `C:\Windows`. This may
+// be a private user directory in the case that the application is running
+// under a terminal server.
+func GetWindowsDirectory() (string, error) {
+ n := uint32(MAX_PATH)
+ for {
+ b := make([]uint16, n)
+ l, e := getWindowsDirectory(&b[0], n)
+ if e != nil {
+ return "", e
+ }
+ if l <= n {
+ return UTF16ToString(b[:l]), nil
+ }
+ n = l
+ }
+}
+
+// GetSystemWindowsDirectory retrieves the path to current location of the
+// Windows directory, which is typically, though not always, `C:\Windows`.
+func GetSystemWindowsDirectory() (string, error) {
+ n := uint32(MAX_PATH)
+ for {
+ b := make([]uint16, n)
+ l, e := getSystemWindowsDirectory(&b[0], n)
+ if e != nil {
+ return "", e
+ }
+ if l <= n {
+ return UTF16ToString(b[:l]), nil
+ }
+ n = l
+ }
+}
+
// IsMember reports whether the access token t is a member of the provided SID.
func (t Token) IsMember(sid *SID) (bool, error) {
var b int32