Commit 8620d670 authored by Michael Müller's avatar Michael Müller Committed by Vitaly Lipatov

advapi32: Fix error code when calling LsaOpenPolicy for non existing remote machine.

parent 9ce17470
...@@ -739,7 +739,7 @@ NTSTATUS WINAPI LsaOpenPolicy( ...@@ -739,7 +739,7 @@ NTSTATUS WINAPI LsaOpenPolicy(
ObjectAttributes, DesiredAccess, PolicyHandle); ObjectAttributes, DesiredAccess, PolicyHandle);
ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL, ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
STATUS_ACCESS_VIOLATION); RPC_NT_SERVER_UNAVAILABLE);
dumpLsaAttributes(ObjectAttributes); dumpLsaAttributes(ObjectAttributes);
if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe; if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
......
...@@ -43,6 +43,8 @@ static NTSTATUS (WINAPI *pLsaGetUserName)(PUNICODE_STRING *user, PUNICODE_STRING ...@@ -43,6 +43,8 @@ static NTSTATUS (WINAPI *pLsaGetUserName)(PUNICODE_STRING *user, PUNICODE_STRING
static void test_lsa(void) static void test_lsa(void)
{ {
static WCHAR machineW[] = {'W','i','n','e','N','o','M','a','c','h','i','n','e',0};
LSA_UNICODE_STRING machine;
NTSTATUS status; NTSTATUS status;
LSA_HANDLE handle; LSA_HANDLE handle;
LSA_OBJECT_ATTRIBUTES object_attributes; LSA_OBJECT_ATTRIBUTES object_attributes;
...@@ -50,6 +52,14 @@ static void test_lsa(void) ...@@ -50,6 +52,14 @@ static void test_lsa(void)
ZeroMemory(&object_attributes, sizeof(object_attributes)); ZeroMemory(&object_attributes, sizeof(object_attributes));
object_attributes.Length = sizeof(object_attributes); object_attributes.Length = sizeof(object_attributes);
machine.Buffer = machineW;
machine.Length = sizeof(machineW) - 2;
machine.MaximumLength = sizeof(machineW);
status = LsaOpenPolicy( &machine, &object_attributes, POLICY_LOOKUP_NAMES, &handle);
ok(status == RPC_NT_SERVER_UNAVAILABLE,
"LsaOpenPolicy(POLICY_LOOKUP_NAMES) for invalid machine returned 0x%08x\n", status);
status = LsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle); status = LsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle);
ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED, ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED,
"LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08lx\n", status); "LsaOpenPolicy(POLICY_ALL_ACCESS) returned 0x%08lx\n", status);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment