Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
af92668b
Commit
af92668b
authored
Mar 10, 2020
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Mar 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adsldp: Implement IADsOpenDSObject::OpenDSObject.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
510bea76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
6 deletions
+171
-6
Makefile.in
dlls/adsldp/Makefile.in
+2
-1
adsldp.c
dlls/adsldp/adsldp.c
+169
-3
ldap.c
dlls/adsldp/tests/ldap.c
+0
-2
No files found.
dlls/adsldp/Makefile.in
View file @
af92668b
MODULE
=
adsldp.dll
MODULE
=
adsldp.dll
IMPORTS
=
ole32 oleaut32 secur32
IMPORTS
=
ole32 oleaut32 secur32 uuid
DELAYIMPORTS
=
netapi32 wldap32
EXTRADLLFLAGS
=
-mno-cygwin
EXTRADLLFLAGS
=
-mno-cygwin
...
...
dlls/adsldp/adsldp.c
View file @
af92668b
...
@@ -28,8 +28,13 @@
...
@@ -28,8 +28,13 @@
#include "objbase.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "rpcproxy.h"
#include "iads.h"
#include "iads.h"
#include "adserr.h"
#define SECURITY_WIN32
#define SECURITY_WIN32
#include "security.h"
#include "security.h"
#include "dsgetdc.h"
#include "lmcons.h"
#include "lmapibuf.h"
#include "winldap.h"
#include "wine/heap.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/debug.h"
...
@@ -346,6 +351,10 @@ typedef struct
...
@@ -346,6 +351,10 @@ typedef struct
IADs
IADs_iface
;
IADs
IADs_iface
;
IADsOpenDSObject
IADsOpenDSObject_iface
;
IADsOpenDSObject
IADsOpenDSObject_iface
;
LONG
ref
;
LONG
ref
;
LDAP
*
ld
;
BSTR
host
;
BSTR
object
;
ULONG
port
;
}
LDAP_namespace
;
}
LDAP_namespace
;
static
inline
LDAP_namespace
*
impl_from_IADs
(
IADs
*
iface
)
static
inline
LDAP_namespace
*
impl_from_IADs
(
IADs
*
iface
)
...
@@ -395,6 +404,9 @@ static ULONG WINAPI ldapns_Release(IADs *iface)
...
@@ -395,6 +404,9 @@ static ULONG WINAPI ldapns_Release(IADs *iface)
if
(
!
ref
)
if
(
!
ref
)
{
{
TRACE
(
"destroying %p
\n
"
,
iface
);
TRACE
(
"destroying %p
\n
"
,
iface
);
if
(
ldap
->
ld
)
ldap_unbind
(
ldap
->
ld
);
SysFreeString
(
ldap
->
host
);
SysFreeString
(
ldap
->
object
);
heap_free
(
ldap
);
heap_free
(
ldap
);
}
}
...
@@ -601,12 +613,163 @@ static HRESULT WINAPI openobj_Invoke(IADsOpenDSObject *iface, DISPID dispid, REF
...
@@ -601,12 +613,163 @@ static HRESULT WINAPI openobj_Invoke(IADsOpenDSObject *iface, DISPID dispid, REF
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
parse_path
(
WCHAR
*
path
,
BSTR
*
host
,
ULONG
*
port
,
BSTR
*
object
)
{
WCHAR
*
p
,
*
p_host
;
int
host_len
;
if
(
host
)
*
host
=
NULL
;
if
(
port
)
*
port
=
0
;
if
(
object
)
*
object
=
NULL
;
if
(
wcsnicmp
(
path
,
L"LDAP:"
,
5
)
!=
0
)
return
E_ADS_BAD_PATHNAME
;
p
=
path
+
5
;
if
(
!*
p
)
return
S_OK
;
if
(
*
p
++
!=
'/'
||
*
p
++
!=
'/'
||
!*
p
)
return
E_ADS_BAD_PATHNAME
;
p_host
=
p
;
host_len
=
0
;
while
(
*
p
&&
*
p
!=
'/'
)
{
if
(
*
p
==
':'
)
{
ULONG
dummy
;
if
(
!
port
)
port
=
&
dummy
;
*
port
=
wcstol
(
p
+
1
,
&
p
,
10
);
if
(
*
p
&&
*
p
!=
'/'
)
return
E_ADS_BAD_PATHNAME
;
}
else
{
p
++
;
host_len
++
;
}
}
if
(
host_len
==
0
)
return
E_ADS_BAD_PATHNAME
;
if
(
host
)
{
*
host
=
SysAllocStringLen
(
p_host
,
host_len
);
if
(
!*
host
)
return
E_OUTOFMEMORY
;
}
if
(
!*
p
)
return
S_OK
;
if
(
*
p
++
!=
'/'
||
!*
p
)
{
SysFreeString
(
*
host
);
return
E_ADS_BAD_PATHNAME
;
}
if
(
object
)
{
*
object
=
SysAllocString
(
p
);
if
(
!*
object
)
{
SysFreeString
(
*
host
);
return
E_OUTOFMEMORY
;
}
}
return
S_OK
;
}
static
HRESULT
WINAPI
openobj_OpenDSObject
(
IADsOpenDSObject
*
iface
,
BSTR
path
,
BSTR
user
,
BSTR
password
,
static
HRESULT
WINAPI
openobj_OpenDSObject
(
IADsOpenDSObject
*
iface
,
BSTR
path
,
BSTR
user
,
BSTR
password
,
LONG
reserved
,
IDispatch
**
obj
)
LONG
reserved
,
IDispatch
**
obj
)
{
{
FIXME
(
"%p,%s,%s,%s,%d,%p: stub
\n
"
,
iface
,
debugstr_w
(
path
),
debugstr_w
(
user
),
debugstr_w
(
password
),
BSTR
host
,
object
;
reserved
,
obj
);
ULONG
port
;
return
E_NOTIMPL
;
IADs
*
ads
;
LDAP
*
ld
=
NULL
;
HRESULT
hr
;
ULONG
err
;
FIXME
(
"%p,%s,%s,%08x,%p: semi-stub
\n
"
,
iface
,
debugstr_w
(
path
),
debugstr_w
(
user
),
reserved
,
obj
);
hr
=
parse_path
(
path
,
&
host
,
&
port
,
&
object
);
if
(
hr
!=
S_OK
)
return
hr
;
TRACE
(
"host %s, port %u, object %s
\n
"
,
debugstr_w
(
host
),
port
,
debugstr_w
(
object
));
if
(
host
)
{
int
version
;
if
(
!
wcsicmp
(
host
,
L"rootDSE"
))
{
DOMAIN_CONTROLLER_INFOW
*
dcinfo
;
if
(
object
)
{
hr
=
E_ADS_BAD_PATHNAME
;
goto
fail
;
}
object
=
host
;
err
=
DsGetDcNameW
(
NULL
,
NULL
,
NULL
,
NULL
,
DS_RETURN_DNS_NAME
,
&
dcinfo
);
if
(
err
!=
ERROR_SUCCESS
)
{
hr
=
HRESULT_FROM_WIN32
(
LdapGetLastError
());
goto
fail
;
}
host
=
SysAllocString
(
dcinfo
->
DomainName
);
NetApiBufferFree
(
dcinfo
);
if
(
!
host
)
{
hr
=
E_OUTOFMEMORY
;
goto
fail
;
}
}
ld
=
ldap_initW
(
host
,
port
);
if
(
!
ld
)
{
hr
=
HRESULT_FROM_WIN32
(
LdapGetLastError
());
goto
fail
;
}
version
=
LDAP_VERSION3
;
err
=
ldap_set_optionW
(
ld
,
LDAP_OPT_PROTOCOL_VERSION
,
&
version
);
if
(
err
!=
LDAP_SUCCESS
)
{
hr
=
HRESULT_FROM_WIN32
(
err
);
ldap_unbind
(
ld
);
goto
fail
;
}
err
=
ldap_connect
(
ld
,
NULL
);
if
(
err
!=
LDAP_SUCCESS
)
{
hr
=
HRESULT_FROM_WIN32
(
err
);
ldap_unbind
(
ld
);
goto
fail
;
}
}
hr
=
LDAPNamespace_create
(
&
IID_IADs
,
(
void
**
)
&
ads
);
if
(
hr
==
S_OK
)
{
LDAP_namespace
*
ldap
=
impl_from_IADs
(
ads
);
ldap
->
ld
=
ld
;
ldap
->
host
=
host
;
ldap
->
port
=
port
;
ldap
->
object
=
object
;
hr
=
IADs_QueryInterface
(
ads
,
&
IID_IDispatch
,
(
void
**
)
obj
);
IADs_Release
(
ads
);
return
hr
;
}
fail:
SysFreeString
(
host
);
SysFreeString
(
object
);
return
hr
;
}
}
static
const
IADsOpenDSObjectVtbl
IADsOpenDSObject_vtbl
=
static
const
IADsOpenDSObjectVtbl
IADsOpenDSObject_vtbl
=
...
@@ -632,6 +795,9 @@ static HRESULT LDAPNamespace_create(REFIID riid, void **obj)
...
@@ -632,6 +795,9 @@ static HRESULT LDAPNamespace_create(REFIID riid, void **obj)
ldap
->
IADs_iface
.
lpVtbl
=
&
IADs_vtbl
;
ldap
->
IADs_iface
.
lpVtbl
=
&
IADs_vtbl
;
ldap
->
IADsOpenDSObject_iface
.
lpVtbl
=
&
IADsOpenDSObject_vtbl
;
ldap
->
IADsOpenDSObject_iface
.
lpVtbl
=
&
IADsOpenDSObject_vtbl
;
ldap
->
ref
=
1
;
ldap
->
ref
=
1
;
ldap
->
ld
=
NULL
;
ldap
->
host
=
NULL
;
ldap
->
object
=
NULL
;
hr
=
IADs_QueryInterface
(
&
ldap
->
IADs_iface
,
riid
,
obj
);
hr
=
IADs_QueryInterface
(
&
ldap
->
IADs_iface
,
riid
,
obj
);
IADs_Release
(
&
ldap
->
IADs_iface
);
IADs_Release
(
&
ldap
->
IADs_iface
);
...
...
dlls/adsldp/tests/ldap.c
View file @
af92668b
...
@@ -85,9 +85,7 @@ static void test_LDAP(void)
...
@@ -85,9 +85,7 @@ static void test_LDAP(void)
path
=
SysAllocString
(
L"LDAP:"
);
path
=
SysAllocString
(
L"LDAP:"
);
hr
=
IADsOpenDSObject_OpenDSObject
(
ads_open
,
path
,
NULL
,
NULL
,
ADS_SECURE_AUTHENTICATION
,
&
disp
);
hr
=
IADsOpenDSObject_OpenDSObject
(
ads_open
,
path
,
NULL
,
NULL
,
ADS_SECURE_AUTHENTICATION
,
&
disp
);
SysFreeString
(
path
);
SysFreeString
(
path
);
todo_wine
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IDispatch_Release
(
disp
);
IDispatch_Release
(
disp
);
IUnknown_Release
(
unk
);
IUnknown_Release
(
unk
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment