adsldp: Blacklist serverless and rootDSE connections in QueryInterface(&IID_IDirectorySearch).
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3b5ae3c5fa
commit
6ae2d05fb7
|
@ -437,6 +437,9 @@ static HRESULT WINAPI ldapns_QueryInterface(IADs *iface, REFIID riid, void **obj
|
|||
|
||||
if (IsEqualGUID(riid, &IID_IDirectorySearch))
|
||||
{
|
||||
if (!ldap->ld || (ldap->object && !wcsicmp(ldap->object, L"rootDSE")))
|
||||
return E_NOINTERFACE;
|
||||
|
||||
IADs_AddRef(iface);
|
||||
*obj = &ldap->IDirectorySearch_iface;
|
||||
return S_OK;
|
||||
|
@ -1167,8 +1170,6 @@ static HRESULT WINAPI search_ExecuteSearch(IDirectorySearch *iface, LPWSTR filte
|
|||
|
||||
TRACE("%p,%s,%p,%u,%p\n", iface, debugstr_w(filter), names, count, res);
|
||||
|
||||
if (!ldap->ld) return E_NOTIMPL;
|
||||
|
||||
if (!res) return E_ADS_BAD_PARAMETER;
|
||||
|
||||
ldap_ctx = heap_alloc_zero(sizeof(*ldap_ctx));
|
||||
|
@ -1217,13 +1218,10 @@ static HRESULT WINAPI search_AbandonSearch(IDirectorySearch *iface, ADS_SEARCH_H
|
|||
|
||||
static HRESULT WINAPI search_GetFirstRow(IDirectorySearch *iface, ADS_SEARCH_HANDLE res)
|
||||
{
|
||||
LDAP_namespace *ldap = impl_from_IDirectorySearch(iface);
|
||||
struct ldap_search_context *ldap_ctx = res;
|
||||
|
||||
TRACE("%p,%p\n", iface, res);
|
||||
|
||||
if (!ldap->ld) return E_NOTIMPL;
|
||||
|
||||
if (!res) return E_ADS_BAD_PARAMETER;
|
||||
|
||||
ldap_ctx->entry = NULL;
|
||||
|
@ -1238,8 +1236,6 @@ static HRESULT WINAPI search_GetNextRow(IDirectorySearch *iface, ADS_SEARCH_HAND
|
|||
|
||||
TRACE("%p,%p\n", iface, res);
|
||||
|
||||
if (!ldap->ld) return E_NOTIMPL;
|
||||
|
||||
if (!res) return E_ADS_BAD_PARAMETER;
|
||||
|
||||
if (!ldap_ctx->entry)
|
||||
|
@ -1283,8 +1279,6 @@ static HRESULT WINAPI search_GetNextColumnName(IDirectorySearch *iface, ADS_SEAR
|
|||
|
||||
TRACE("%p,%p,%p\n", iface, res, name);
|
||||
|
||||
if (!ldap->ld) return E_NOTIMPL;
|
||||
|
||||
if (!name || !ldap_ctx || !ldap_ctx->entry) return E_ADS_BAD_PARAMETER;
|
||||
|
||||
if (!ldap_ctx->ber)
|
||||
|
@ -1393,8 +1387,6 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL
|
|||
|
||||
TRACE("%p,%p,%s,%p\n", iface, res, debugstr_w(name), col);
|
||||
|
||||
if (!ldap->ld) return E_NOTIMPL;
|
||||
|
||||
if (!res || !name || !ldap_ctx->entry) return E_ADS_BAD_PARAMETER;
|
||||
|
||||
if (!wcsicmp(name, L"ADsPath"))
|
||||
|
|
|
@ -344,8 +344,10 @@ static void test_DirectorySearch(void)
|
|||
ADS_SEARCH_COLUMN col;
|
||||
LPWSTR name;
|
||||
|
||||
hr = ADsGetObject(L"LDAP:", &IID_IDirectorySearch, (void **)&ds);
|
||||
ok(hr == E_NOINTERFACE, "got %#x\n", hr);
|
||||
|
||||
hr = ADsGetObject(L"LDAP://ldap.forumsys.com/rootDSE", &IID_IDirectorySearch, (void **)&ds);
|
||||
todo_wine
|
||||
ok(hr == E_NOINTERFACE, "got %#x\n", hr);
|
||||
|
||||
hr = ADsGetObject(L"LDAP://ldap.forumsys.com", &IID_IDirectorySearch, (void **)&ds);
|
||||
|
@ -439,7 +441,7 @@ todo_wine
|
|||
memset(&col, 0x55, sizeof(col));
|
||||
hr = IDirectorySearch_GetColumn(ds, sh, (WCHAR *)L"deadbeef", &col);
|
||||
ok(hr == E_ADS_COLUMN_NOT_SET, "got %#x\n", hr);
|
||||
ok(!col.pszAttrName, "got %p\n", col.pszAttrName);
|
||||
ok(!col.pszAttrName || broken(col.pszAttrName != NULL) /* XP */, "got %p\n", col.pszAttrName);
|
||||
ok(col.dwADsType == ADSTYPE_INVALID || broken(col.dwADsType != ADSTYPE_INVALID) /* XP */, "got %d\n", col.dwADsType);
|
||||
ok(!col.pADsValues, "got %p\n", col.pADsValues);
|
||||
ok(!col.dwNumValues, "got %u\n", col.dwNumValues);
|
||||
|
|
Loading…
Reference in New Issue