[PATCH 7/8] adsldp: Add support for special column name "ADsPath" to IDirectorySearch::GetColumn().

Dmitry Timoshkov dmitry at baikal.ru
Thu Mar 26 02:10:40 CDT 2020


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/adsldp/adsldp.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c
index fed9a8afca..7385a40e25 100644
--- a/dlls/adsldp/adsldp.c
+++ b/dlls/adsldp/adsldp.c
@@ -1342,6 +1342,42 @@ static HRESULT WINAPI search_GetColumn(IDirectorySearch *iface, ADS_SEARCH_HANDL
 
     if (!res || !name || !ldap_ctx->entry) return E_ADS_BAD_PARAMETER;
 
+    if (!wcsicmp(name, L"ADsPath"))
+    {
+        WCHAR *dn = ldap_get_dnW(ldap->ld, ldap_ctx->entry);
+
+        col->pADsValues = heap_alloc(sizeof(col->pADsValues[0]));
+        if (!col->pADsValues)
+        {
+            hr = E_OUTOFMEMORY;
+            goto exit;
+        }
+
+        count = sizeof(L"LDAP://") + (wcslen(ldap->host) + 1 /* '/' */) * sizeof(WCHAR);
+        if (dn) count += wcslen(dn) * sizeof(WCHAR);
+
+        col->pADsValues[0].u.CaseIgnoreString = heap_alloc(count);
+        if (!col->pADsValues[0].u.CaseIgnoreString)
+        {
+            hr = E_OUTOFMEMORY;
+            goto exit;
+        }
+
+        wcscpy(col->pADsValues[0].u.CaseIgnoreString, L"LDAP://");
+        wcscat(col->pADsValues[0].u.CaseIgnoreString, ldap->host);
+        wcscat(col->pADsValues[0].u.CaseIgnoreString, L"/");
+        if (dn) wcscat(col->pADsValues[0].u.CaseIgnoreString, dn);
+        col->dwADsType = ADSTYPE_CASE_IGNORE_STRING;
+        col->dwNumValues = 1;
+        col->pszAttrName = strdupW(name);
+
+        TRACE("=> %s\n", debugstr_w(col->pADsValues[0].u.CaseIgnoreString));
+        hr = S_OK;
+exit:
+        ldap_memfreeW(dn);
+        return hr;
+    }
+
     values = ldap_get_values_lenW(ldap->ld, ldap_ctx->entry, name);
     if (!values) return ERROR_DS_NO_ATTRIBUTE_OR_VALUE;
 
-- 
2.25.1




More information about the wine-devel mailing list