[PATCH 2/8] adsldp: Add support for IADsOpenDSObject::OpenDSObject(ADS_SECURE_AUTHENTICATION).

Dmitry Timoshkov dmitry at baikal.ru
Fri Mar 20 02:21:24 CDT 2020


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/adsldp/adsldp.c | 23 +++++++++++++++++++----
 include/winldap.h    | 12 ++++++++++++
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c
index bc4e9780b0..4a9e2ba2de 100644
--- a/dlls/adsldp/adsldp.c
+++ b/dlls/adsldp/adsldp.c
@@ -27,6 +27,7 @@
 #include "initguid.h"
 #include "objbase.h"
 #include "rpcproxy.h"
+#include "rpc.h"
 #include "iads.h"
 #include "adserr.h"
 #define SECURITY_WIN32
@@ -777,10 +778,24 @@ static HRESULT WINAPI openobj_OpenDSObject(IADsOpenDSObject *iface, BSTR path, B
 
         if (flags & ADS_SECURE_AUTHENTICATION)
         {
-            FIXME("ADS_SECURE_AUTHENTICATION is not supported\n");
-            hr = ERROR_DS_AUTH_METHOD_NOT_SUPPORTED;
-            ldap_unbind(ld);
-            goto fail;
+            SEC_WINNT_AUTH_IDENTITY_W id;
+
+            id.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
+            id.Domain = (unsigned short *)host;
+            id.DomainLength = wcslen(host);
+            id.User = (unsigned short *)user;
+            id.UserLength = user ? wcslen(user) : 0;
+            id.Password = (unsigned short *)password;
+            id.PasswordLength = password ? wcslen(password) : 0;
+
+            err = ldap_bind_sW(ld, NULL, (WCHAR *)&id, LDAP_AUTH_NEGOTIATE);
+            if (err != LDAP_SUCCESS)
+            {
+                TRACE("ldap_simple_bind_sW error %#x\n", err);
+                hr = HRESULT_FROM_WIN32(map_ldap_error(err));
+                ldap_unbind(ld);
+                goto fail;
+            }
         }
         else
         {
diff --git a/include/winldap.h b/include/winldap.h
index e5c1faa3c1..bd5acab767 100644
--- a/include/winldap.h
+++ b/include/winldap.h
@@ -184,6 +184,18 @@ typedef struct berelement
 #define LDAP_RES_EXTENDED       0x78
 #define LDAP_RES_ANY            (-1)
 
+#define LDAP_AUTH_SIMPLE        0x80
+#define LDAP_AUTH_SASL          0x83
+#define LDAP_AUTH_OTHERKIND     0x86
+
+#define LDAP_AUTH_EXTERNAL      (LDAP_AUTH_OTHERKIND | 0x0020)
+#define LDAP_AUTH_SICILY        (LDAP_AUTH_OTHERKIND | 0x0200)
+#define LDAP_AUTH_NEGOTIATE     (LDAP_AUTH_OTHERKIND | 0x0400)
+#define LDAP_AUTH_MSN           (LDAP_AUTH_OTHERKIND | 0x0800)
+#define LDAP_AUTH_NTLM          (LDAP_AUTH_OTHERKIND | 0x1000)
+#define LDAP_AUTH_DPA           (LDAP_AUTH_OTHERKIND | 0x2000)
+#define LDAP_AUTH_DIGEST        (LDAP_AUTH_OTHERKIND | 0x4000)
+
 typedef struct ldap
 {
     struct
-- 
2.25.1




More information about the wine-devel mailing list