msxml3/tests: Improve the IObjectSecurity tests to cover msxml3 SP8+ behaviour.
This commit is contained in:
parent
844e22093e
commit
47016df9b7
|
@ -2214,7 +2214,7 @@ static ULONG WINAPI xmldoc_Safety_Release(IObjectSafety *iface)
|
||||||
return IXMLDocument_Release((IXMLDocument *)This);
|
return IXMLDocument_Release((IXMLDocument *)This);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SAFETY_SUPPORTED_OPTIONS (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA)
|
#define SAFETY_SUPPORTED_OPTIONS (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_SECURITY_MANAGER)
|
||||||
|
|
||||||
static HRESULT WINAPI xmldoc_Safety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid,
|
static HRESULT WINAPI xmldoc_Safety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid,
|
||||||
DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
|
DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
|
||||||
|
@ -2238,6 +2238,9 @@ static HRESULT WINAPI xmldoc_Safety_SetInterfaceSafetyOptions(IObjectSafety *ifa
|
||||||
domdoc *This = impl_from_IObjectSafety(iface);
|
domdoc *This = impl_from_IObjectSafety(iface);
|
||||||
TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
|
TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
|
||||||
|
|
||||||
|
if ((dwOptionSetMask & ~SAFETY_SUPPORTED_OPTIONS) != 0)
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
This->safeopt = dwEnabledOptions & dwOptionSetMask & SAFETY_SUPPORTED_OPTIONS;
|
This->safeopt = dwEnabledOptions & dwOptionSetMask & SAFETY_SUPPORTED_OPTIONS;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5292,6 +5292,41 @@ static void test_put_nodeValue(void)
|
||||||
IXMLDOMDocument_Release(doc);
|
IXMLDOMDocument_Release(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_IObjectSafety_set(IObjectSafety *safety, HRESULT result, HRESULT result2, DWORD set, DWORD mask, DWORD expected, DWORD expected2)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD enabled, supported;
|
||||||
|
|
||||||
|
trace("testing IObjectSafety: enable=%08x, mask=%08x\n", set, mask);
|
||||||
|
|
||||||
|
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL, set, mask);
|
||||||
|
if (result == result2)
|
||||||
|
ok(hr == result, "SetInterfaceSafetyOptions: expected %08x, returned %08x\n", result, hr );
|
||||||
|
else
|
||||||
|
ok(broken(hr == result) || hr == result2,
|
||||||
|
"SetInterfaceSafetyOptions: expected %08x, got %08x\n", result2, hr );
|
||||||
|
|
||||||
|
supported = enabled = 0xCAFECAFE;
|
||||||
|
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
|
if (expected == expected2)
|
||||||
|
ok(enabled == expected, "Expected %08x, got %08x\n", expected, enabled);
|
||||||
|
else
|
||||||
|
ok(broken(enabled == expected) || enabled == expected2,
|
||||||
|
"Expected %08x, got %08x\n", expected2, enabled);
|
||||||
|
|
||||||
|
/* reset the safety options */
|
||||||
|
|
||||||
|
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_SECURITY_MANAGER,
|
||||||
|
0);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
|
|
||||||
|
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
|
ok(enabled == 0, "Expected 0, got %08x\n", enabled);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_document_IObjectSafety(void)
|
static void test_document_IObjectSafety(void)
|
||||||
{
|
{
|
||||||
IXMLDOMDocument *doc;
|
IXMLDOMDocument *doc;
|
||||||
|
@ -5314,41 +5349,85 @@ static void test_document_IObjectSafety(void)
|
||||||
|
|
||||||
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
ok(supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA),
|
ok(broken(supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA)) ||
|
||||||
"Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA),"
|
supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
|
||||||
|
"Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), "
|
||||||
"got %08x\n", supported);
|
"got %08x\n", supported);
|
||||||
ok(enabled == 0, "Expected 0, got %08x\n", enabled);
|
ok(enabled == 0, "Expected 0, got %08x\n", enabled);
|
||||||
/* set */
|
|
||||||
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
|
/* set -- individual flags */
|
||||||
INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
|
||||||
INTERFACESAFE_FOR_UNTRUSTED_CALLER);
|
test_IObjectSafety_set(safety, S_OK, S_OK,
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER, INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
||||||
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER, INTERFACESAFE_FOR_UNTRUSTED_CALLER);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
|
||||||
ok(enabled == INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
test_IObjectSafety_set(safety, S_OK, S_OK,
|
||||||
"Expected INTERFACESAFE_FOR_UNTRUSTED_CALLER, got %08x\n", enabled);
|
INTERFACESAFE_FOR_UNTRUSTED_DATA, INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
||||||
/* set unsupported */
|
INTERFACESAFE_FOR_UNTRUSTED_DATA, INTERFACESAFE_FOR_UNTRUSTED_DATA);
|
||||||
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
|
|
||||||
INTERFACE_USES_SECURITY_MANAGER |
|
test_IObjectSafety_set(safety, S_OK, S_OK,
|
||||||
INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
INTERFACE_USES_SECURITY_MANAGER, INTERFACE_USES_SECURITY_MANAGER,
|
||||||
INTERFACE_USES_SECURITY_MANAGER);
|
0, INTERFACE_USES_SECURITY_MANAGER /* msxml3 SP8+ */);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
|
||||||
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
/* set INTERFACE_USES_DISPEX */
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
|
||||||
ok(enabled == 0, "Expected 0, got %08x\n", enabled);
|
test_IObjectSafety_set(safety, S_OK, E_FAIL /* msxml3 SP8+ */,
|
||||||
|
INTERFACE_USES_DISPEX, INTERFACE_USES_DISPEX,
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
test_IObjectSafety_set(safety, S_OK, E_FAIL /* msxml3 SP8+ */,
|
||||||
|
INTERFACE_USES_DISPEX, 0,
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
test_IObjectSafety_set(safety, S_OK, S_OK /* msxml3 SP8+ */,
|
||||||
|
0, INTERFACE_USES_DISPEX,
|
||||||
|
0, 0);
|
||||||
|
|
||||||
|
/* set option masking */
|
||||||
|
|
||||||
|
test_IObjectSafety_set(safety, S_OK, S_OK,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER);
|
||||||
|
|
||||||
|
test_IObjectSafety_set(safety, S_OK, S_OK,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_DATA);
|
||||||
|
|
||||||
|
test_IObjectSafety_set(safety, S_OK, S_OK,
|
||||||
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
||||||
|
INTERFACE_USES_SECURITY_MANAGER,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
|
/* set -- inheriting previous settings */
|
||||||
|
|
||||||
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
|
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
|
||||||
INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER,
|
||||||
INTERFACESAFE_FOR_UNTRUSTED_CALLER);
|
INTERFACESAFE_FOR_UNTRUSTED_CALLER);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
|
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
|
todo_wine
|
||||||
|
ok(broken(enabled == INTERFACESAFE_FOR_UNTRUSTED_CALLER) ||
|
||||||
|
enabled == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
|
||||||
|
"Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACE_USES_SECURITY_MANAGER), "
|
||||||
|
"got %08x\n", enabled);
|
||||||
|
|
||||||
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
|
hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
|
||||||
INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
||||||
INTERFACESAFE_FOR_UNTRUSTED_DATA);
|
INTERFACESAFE_FOR_UNTRUSTED_DATA);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr );
|
ok(hr == S_OK, "ret %08x\n", hr );
|
||||||
ok(enabled == INTERFACESAFE_FOR_UNTRUSTED_DATA,
|
todo_wine
|
||||||
"Expected INTERFACESAFE_FOR_UNTRUSTED_DATA, got %08x\n", enabled);
|
ok(broken(enabled == INTERFACESAFE_FOR_UNTRUSTED_DATA) ||
|
||||||
|
enabled == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA) /* msxml3 SP8+ */,
|
||||||
|
"Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA), "
|
||||||
|
"got %08x\n", enabled);
|
||||||
|
|
||||||
IObjectSafety_Release(safety);
|
IObjectSafety_Release(safety);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue