adsldp: Add support for searching of deleted objects.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2020-04-13 18:07:21 +08:00 committed by Alexandre Julliard
parent 125414193f
commit b579f04998
2 changed files with 33 additions and 1 deletions

View File

@ -1286,6 +1286,7 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte
LDAP_namespace *ldap = impl_from_IDirectorySearch(iface);
ULONG err, i;
WCHAR **props;
LDAPControlW **ctrls = NULL, *ctrls_a[2], tombstone;
struct ldap_search_context *ldap_ctx;
TRACE("%p,%s,%p,%u,%p\n", iface, debugstr_w(filter), names, count, res);
@ -1317,7 +1318,19 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte
props[count] = NULL;
}
err = ldap_search_sW(ldap->ld, ldap->object, ldap->search.scope, filter, props, ldap->search.attribtypes_only, &ldap_ctx->res);
if (ldap->search.tombstone)
{
tombstone.ldctl_oid = (WCHAR *)L"1.2.840.113556.1.4.417";
tombstone.ldctl_iscritical = TRUE;
tombstone.ldctl_value.bv_val = NULL;
tombstone.ldctl_value.bv_len = 0;
ctrls_a[0] = &tombstone;
ctrls_a[1] = NULL;
ctrls = ctrls_a;
}
err = ldap_search_ext_sW(ldap->ld, ldap->object, ldap->search.scope, filter, props,
ldap->search.attribtypes_only, ctrls, NULL, NULL, 0, &ldap_ctx->res);
heap_free(props);
if (err != LDAP_SUCCESS)
{

View File

@ -515,6 +515,25 @@ todo_wine
hr = IDirectorySearch_CloseSearchHandle(ds, sh);
ok(hr == S_OK, "got %#x\n", hr);
pref[0].dwSearchPref = ADS_SEARCHPREF_TOMBSTONE;
pref[0].vValue.dwType = ADSTYPE_BOOLEAN;
pref[0].vValue.Integer = 1;
pref[0].dwStatus = 0xdeadbeef;
hr = IDirectorySearch_SetSearchPreference(ds, pref, 1);
ok(hr == S_OK, "got %#x\n", hr);
ok(pref[0].dwStatus == ADS_STATUS_S_OK, "got %d\n", pref[0].dwStatus);
hr = IDirectorySearch_ExecuteSearch(ds, (WCHAR *)L"(objectClass=*)", NULL, ~0, &sh);
ok(hr == HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION) || broken(hr == S_OK) /* XP */, "got %#x\n", hr);
if (hr == S_OK)
{
hr = IDirectorySearch_GetNextRow(ds, sh);
ok(hr == HRESULT_FROM_WIN32(ERROR_DS_UNAVAILABLE_CRIT_EXTENSION), "got %#x\n", hr);
hr = IDirectorySearch_CloseSearchHandle(ds, sh);
ok(hr == S_OK, "got %#x\n", hr);
}
IDirectorySearch_Release(ds);
IDirectoryObject_Release(dirobj);
}