mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-05 04:11:59 +00:00
util/winutil: ensure domain controller address is used when retrieving remote profile information
We cannot directly pass a flat domain name into NetUserGetInfo; we must resolve the address of a domain controller first. This PR implements the appropriate resolution mechanisms to do that, and also exposes a couple of new utility APIs for future needs. Fixes #12627 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
This commit is contained in:
24
util/winutil/userprofile_windows_test.go
Normal file
24
util/winutil/userprofile_windows_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package winutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
func TestGetRoamingProfilePath(t *testing.T) {
|
||||
token := windows.GetCurrentProcessToken()
|
||||
computerName, userName, err := getComputerAndUserName(token, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := getRoamingProfilePath(t.Logf, token, computerName, userName); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
// TODO(aaron): Flesh out better once can run tests under domain accounts.
|
||||
}
|
||||
Reference in New Issue
Block a user