|
|
@ -73,14 +73,19 @@ namespace Ansible
|
|
|
|
$env:TMP = $original_tmp
|
|
|
|
$env:TMP = $original_tmp
|
|
|
|
|
|
|
|
|
|
|
|
$handle = [IntPtr]::Zero
|
|
|
|
$handle = [IntPtr]::Zero
|
|
|
|
$logon_res = [Ansible.WinUserPInvoke]::LogonUser($Username, $null, $Password,
|
|
|
|
$logon_res = [Ansible.WinUserPInvoke]::LogonUser(
|
|
|
|
$LOGON32_LOGON_NETWORK, $LOGON32_PROVIDER_DEFAULT, [Ref]$handle)
|
|
|
|
$Username,
|
|
|
|
|
|
|
|
$null,
|
|
|
|
|
|
|
|
$Password,
|
|
|
|
|
|
|
|
$LOGON32_LOGON_NETWORK,
|
|
|
|
|
|
|
|
$LOGON32_PROVIDER_DEFAULT,
|
|
|
|
|
|
|
|
[Ref]$handle
|
|
|
|
|
|
|
|
); $err_code = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
|
|
|
|
|
|
|
|
|
|
|
|
if ($logon_res) {
|
|
|
|
if ($logon_res) {
|
|
|
|
$valid_credentials = $true
|
|
|
|
$valid_credentials = $true
|
|
|
|
[Ansible.WinUserPInvoke]::CloseHandle($handle) > $null
|
|
|
|
[Ansible.WinUserPInvoke]::CloseHandle($handle) > $null
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$err_code = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
|
|
|
|
|
|
|
|
# following errors indicate the creds are correct but the user was
|
|
|
|
# following errors indicate the creds are correct but the user was
|
|
|
|
# unable to log on for other reasons, which we don't care about
|
|
|
|
# unable to log on for other reasons, which we don't care about
|
|
|
|
$success_codes = @(
|
|
|
|
$success_codes = @(
|
|
|
|