Fix more windows tests

This commit is contained in:
Viktor Liu
2025-07-03 11:26:04 +02:00
parent a21f924b26
commit a476b8d12f
2 changed files with 2 additions and 6 deletions

View File

@@ -448,11 +448,8 @@ func TestSSHClient_PortForwardingDataTransfer(t *testing.T) {
func getCurrentUsername() string {
if runtime.GOOS == "windows" {
if currentUser, err := user.Current(); err == nil {
username := currentUser.Username
if idx := strings.LastIndex(username, "\\"); idx != -1 {
username = username[idx+1:]
}
return strings.ToLower(username)
// On Windows, return the full domain\username for proper authentication
return currentUser.Username
}
}

View File

@@ -430,7 +430,6 @@ func (pd *PrivilegeDropper) isLocalUser(domain string) bool {
}
return domain == "" || domain == "." ||
strings.EqualFold(domain, "localhost") ||
strings.EqualFold(domain, hostname)
}