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
b9813873
Commit
b9813873
authored
Oct 06, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wldap32: Add tests for ldap_parse_sort_control and make them pass.
parent
927e9e08
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
163 additions
and
25 deletions
+163
-25
configure
configure
+9
-0
configure.ac
configure.ac
+1
-0
error.c
dlls/wldap32/error.c
+26
-0
parse.c
dlls/wldap32/parse.c
+25
-25
Makefile.in
dlls/wldap32/tests/Makefile.in
+13
-0
parse.c
dlls/wldap32/tests/parse.c
+87
-0
wldap32.h
dlls/wldap32/wldap32.h
+2
-0
No files found.
configure
View file @
b9813873
...
...
@@ -25306,6 +25306,14 @@ dlls/wldap32/Makefile: dlls/wldap32/Makefile.in dlls/Makedll.rules"
ac_config_files
=
"
$ac_config_files
dlls/wldap32/Makefile"
ALL_MAKEFILES
=
"
$ALL_MAKEFILES
\\
dlls/wldap32/tests/Makefile"
test
"x
$enable_wldap32_tests
"
!=
xno
&&
ALL_TEST_DIRS
=
"
$ALL_TEST_DIRS
\\
wldap32/tests"
ALL_MAKEFILE_DEPENDS
=
"
$ALL_MAKEFILE_DEPENDS
dlls/wldap32/tests/Makefile: dlls/wldap32/tests/Makefile.in dlls/Maketest.rules"
ac_config_files
=
"
$ac_config_files
dlls/wldap32/tests/Makefile"
ALL_MAKEFILES
=
"
$ALL_MAKEFILES
\\
dlls/wmi/Makefile"
test
"x
$enable_wmi
"
!=
xno
&&
ALL_DLL_DIRS
=
"
$ALL_DLL_DIRS
\\
wmi"
...
...
@@ -26840,6 +26848,7 @@ do
"dlls/wintrust/Makefile") CONFIG_FILES="
$CONFIG_FILES
dlls/wintrust/Makefile" ;;
"dlls/wintrust/tests/Makefile") CONFIG_FILES="
$CONFIG_FILES
dlls/wintrust/tests/Makefile" ;;
"dlls/wldap32/Makefile") CONFIG_FILES="
$CONFIG_FILES
dlls/wldap32/Makefile" ;;
"dlls/wldap32/tests/Makefile") CONFIG_FILES="
$CONFIG_FILES
dlls/wldap32/tests/Makefile" ;;
"dlls/wmi/Makefile") CONFIG_FILES="
$CONFIG_FILES
dlls/wmi/Makefile" ;;
"dlls/wnaspi32/Makefile") CONFIG_FILES="
$CONFIG_FILES
dlls/wnaspi32/Makefile" ;;
"dlls/wow32/Makefile") CONFIG_FILES="
$CONFIG_FILES
dlls/wow32/Makefile" ;;
...
...
configure.ac
View file @
b9813873
...
...
@@ -2070,6 +2070,7 @@ WINE_CONFIG_MAKEFILE([dlls/wintab32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_D
WINE_CONFIG_MAKEFILE([dlls/wintrust/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/wintrust/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS])
WINE_CONFIG_MAKEFILE([dlls/wldap32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/wldap32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS])
WINE_CONFIG_MAKEFILE([dlls/wmi/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/wnaspi32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/wow32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
...
...
dlls/wldap32/error.c
View file @
b9813873
...
...
@@ -41,6 +41,32 @@ extern HINSTANCE hwldap32;
WINE_DEFAULT_DEBUG_CHANNEL
(
wldap32
);
ULONG
map_error
(
int
error
)
{
switch
(
error
)
{
#ifdef HAVE_LDAP_H
case
LDAP_SERVER_DOWN
:
return
WLDAP32_LDAP_SERVER_DOWN
;
case
LDAP_LOCAL_ERROR
:
return
WLDAP32_LDAP_LOCAL_ERROR
;
case
LDAP_DECODING_ERROR
:
return
WLDAP32_LDAP_DECODING_ERROR
;
case
LDAP_TIMEOUT
:
return
WLDAP32_LDAP_TIMEOUT
;
case
LDAP_AUTH_UNKNOWN
:
return
WLDAP32_LDAP_AUTH_UNKNOWN
;
case
LDAP_FILTER_ERROR
:
return
WLDAP32_LDAP_FILTER_ERROR
;
case
LDAP_USER_CANCELLED
:
return
WLDAP32_LDAP_USER_CANCELLED
;
case
LDAP_PARAM_ERROR
:
return
WLDAP32_LDAP_PARAM_ERROR
;
case
LDAP_NO_MEMORY
:
return
WLDAP32_LDAP_NO_MEMORY
;
case
LDAP_CONNECT_ERROR
:
return
WLDAP32_LDAP_CONNECT_ERROR
;
case
LDAP_NOT_SUPPORTED
:
return
WLDAP32_LDAP_NOT_SUPPORTED
;
case
LDAP_CONTROL_NOT_FOUND
:
return
WLDAP32_LDAP_CONTROL_NOT_FOUND
;
case
LDAP_NO_RESULTS_RETURNED
:
return
WLDAP32_LDAP_NO_RESULTS_RETURNED
;
case
LDAP_MORE_RESULTS_TO_RETURN
:
return
WLDAP32_LDAP_MORE_RESULTS_TO_RETURN
;
case
LDAP_CLIENT_LOOP
:
return
WLDAP32_LDAP_CLIENT_LOOP
;
case
LDAP_REFERRAL_LIMIT_EXCEEDED
:
return
WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED
;
#endif
default:
return
error
;
}
}
/***********************************************************************
* ldap_err2stringA (WLDAP32.@)
*
...
...
dlls/wldap32/parse.c
View file @
b9813873
...
...
@@ -184,25 +184,25 @@ ULONG CDECL ldap_parse_resultA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
WCHAR
*
*
matchedW
=
NULL
,
*
*
errorW
=
NULL
,
**
referralsW
=
NULL
;
WCHAR
*
matchedW
=
NULL
,
*
errorW
=
NULL
,
**
referralsW
=
NULL
;
LDAPControlW
**
serverctrlsW
=
NULL
;
TRACE
(
"(%p, %p, %p, %p, %p, %p, %p, 0x%02x)
\n
"
,
ld
,
result
,
retcode
,
matched
,
error
,
referrals
,
serverctrls
,
free
);
if
(
!
ld
)
return
~
0UL
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
ret
=
ldap_parse_resultW
(
ld
,
result
,
retcode
,
matchedW
,
errorW
,
ret
=
ldap_parse_resultW
(
ld
,
result
,
retcode
,
&
matchedW
,
&
errorW
,
&
referralsW
,
&
serverctrlsW
,
free
);
matched
=
strarray
WtoA
(
matchedW
);
error
=
strarray
WtoA
(
errorW
);
if
(
matched
)
*
matched
=
str
WtoA
(
matchedW
);
if
(
error
)
*
error
=
str
WtoA
(
errorW
);
*
referrals
=
strarrayWtoA
(
referralsW
);
*
serverctrls
=
controlarrayWtoA
(
serverctrlsW
);
if
(
referrals
)
*
referrals
=
strarrayWtoA
(
referralsW
);
if
(
serverctrls
)
*
serverctrls
=
controlarrayWtoA
(
serverctrlsW
);
ldap_
value_
freeW
(
matchedW
);
ldap_
value_
freeW
(
errorW
);
ldap_
mem
freeW
(
matchedW
);
ldap_
mem
freeW
(
errorW
);
ldap_value_freeW
(
referralsW
);
ldap_controls_freeW
(
serverctrlsW
);
...
...
@@ -241,30 +241,30 @@ ULONG CDECL ldap_parse_resultW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *result,
{
ULONG
ret
=
WLDAP32_LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
*
matchedU
=
NULL
,
*
*
errorU
=
NULL
,
**
referralsU
=
NULL
;
char
*
matchedU
=
NULL
,
*
errorU
=
NULL
,
**
referralsU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
;
TRACE
(
"(%p, %p, %p, %p, %p, %p, %p, 0x%02x)
\n
"
,
ld
,
result
,
retcode
,
matched
,
error
,
referrals
,
serverctrls
,
free
);
if
(
!
ld
)
return
~
0UL
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
ret
=
ldap_parse_result
(
ld
,
result
,
(
int
*
)
retcode
,
matchedU
,
errorU
,
ret
=
ldap_parse_result
(
ld
,
result
,
(
int
*
)
retcode
,
&
matchedU
,
&
errorU
,
&
referralsU
,
&
serverctrlsU
,
free
);
matched
=
strarray
UtoW
(
matchedU
);
error
=
strarray
UtoW
(
errorU
);
if
(
matched
)
*
matched
=
str
UtoW
(
matchedU
);
if
(
error
)
*
error
=
str
UtoW
(
errorU
);
*
referrals
=
strarrayUtoW
(
referralsU
);
*
serverctrls
=
controlarrayUtoW
(
serverctrlsU
);
if
(
referrals
)
*
referrals
=
strarrayUtoW
(
referralsU
);
if
(
serverctrls
)
*
serverctrls
=
controlarrayUtoW
(
serverctrlsU
);
ldap_memfree
(
matchedU
);
ldap_memfree
(
errorU
);
ldap_memfree
(
referralsU
);
strarrayfreeU
(
referralsU
);
ldap_controls_free
(
serverctrlsU
);
#endif
return
ret
;
return
map_error
(
ret
)
;
}
/***********************************************************************
...
...
@@ -282,12 +282,11 @@ ULONG CDECL ldap_parse_sort_controlA( WLDAP32_LDAP *ld, PLDAPControlA *control,
TRACE
(
"(%p, %p, %p, %p)
\n
"
,
ld
,
control
,
result
,
attr
);
if
(
!
ld
)
return
~
0UL
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
control
)
return
WLDAP32_LDAP_CONTROL_NOT_FOUND
;
if
(
control
)
{
controlW
=
controlarrayAtoW
(
control
);
if
(
!
controlW
)
return
WLDAP32_LDAP_NO_MEMORY
;
}
controlW
=
controlarrayAtoW
(
control
);
if
(
!
controlW
)
return
WLDAP32_LDAP_NO_MEMORY
;
ret
=
ldap_parse_sort_controlW
(
ld
,
controlW
,
result
,
&
attrW
);
...
...
@@ -333,7 +332,8 @@ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
TRACE
(
"(%p, %p, %p, %p)
\n
"
,
ld
,
control
,
result
,
attr
);
if
(
!
ld
||
!
control
)
return
~
0UL
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
control
)
return
WLDAP32_LDAP_CONTROL_NOT_FOUND
;
controlU
=
controlarrayWtoU
(
control
);
if
(
!
controlU
)
return
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -364,7 +364,7 @@ ULONG CDECL ldap_parse_sort_controlW( WLDAP32_LDAP *ld, PLDAPControlW *control,
controlarrayfreeU
(
controlU
);
#endif
return
ret
;
return
map_error
(
ret
)
;
}
/***********************************************************************
...
...
dlls/wldap32/tests/Makefile.in
0 → 100644
View file @
b9813873
TOPSRCDIR
=
@top_srcdir@
TOPOBJDIR
=
../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
wldap32.dll
IMPORTS
=
wldap32 kernel32
CTESTS
=
\
parse.c
@MAKE_TEST_RULES@
@DEPENDENCIES@
# everything below this line is overwritten by make depend
dlls/wldap32/tests/parse.c
0 → 100644
View file @
b9813873
/*
* test parsing functions
*
* Copyright 2008 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <winldap.h>
#include "wine/test.h"
static
void
test_ldap_parse_sort_control
(
LDAP
*
ld
)
{
ULONG
ret
,
result
;
LDAPSortKeyA
*
sortkeys
[
2
],
key
;
LDAPControlA
*
sort
,
*
ctrls
[
2
],
**
server_ctrls
;
LDAPMessage
*
res
=
NULL
;
struct
l_timeval
timeout
;
key
.
sk_attrtype
=
(
char
*
)
"cn"
;
key
.
sk_matchruleoid
=
NULL
;
key
.
sk_reverseorder
=
FALSE
;
sortkeys
[
0
]
=
&
key
;
sortkeys
[
1
]
=
NULL
;
ret
=
ldap_create_sort_controlA
(
ld
,
sortkeys
,
0
,
&
sort
);
ok
(
!
ret
,
"ldap_create_sort_controlA failed 0x%x
\n
"
,
ret
);
ctrls
[
0
]
=
sort
;
ctrls
[
1
]
=
NULL
;
timeout
.
tv_sec
=
20
;
timeout
.
tv_usec
=
0
;
ret
=
ldap_search_ext_sA
(
ld
,
(
char
*
)
""
,
LDAP_SCOPE_SUBTREE
,
(
char
*
)
"(cn=Verisign*)"
,
NULL
,
0
,
ctrls
,
NULL
,
&
timeout
,
10
,
&
res
);
ok
(
!
ret
,
"ldap_search_ext_sA failed 0x%x
\n
"
,
ret
);
ok
(
res
!=
NULL
,
"expected res != NULL
\n
"
);
ret
=
ldap_parse_resultA
(
NULL
,
res
,
&
result
,
NULL
,
NULL
,
NULL
,
&
server_ctrls
,
1
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_parse_resultA failed 0x%x
\n
"
,
ret
);
result
=
~
0UL
;
ret
=
ldap_parse_resultA
(
ld
,
res
,
&
result
,
NULL
,
NULL
,
NULL
,
&
server_ctrls
,
1
);
ok
(
!
ret
,
"ldap_parse_resultA failed 0x%x
\n
"
,
ret
);
ok
(
!
result
,
"got 0x%x expected 0
\n
"
,
result
);
ret
=
ldap_parse_sort_controlA
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_parse_sort_controlA failed 0x%d
\n
"
,
ret
);
ret
=
ldap_parse_sort_controlA
(
ld
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_CONTROL_NOT_FOUND
,
"ldap_parse_sort_controlA failed 0x%x
\n
"
,
ret
);
ret
=
ldap_parse_sort_controlA
(
ld
,
NULL
,
&
result
,
NULL
);
ok
(
ret
==
LDAP_CONTROL_NOT_FOUND
,
"ldap_parse_sort_controlA failed 0x%x
\n
"
,
ret
);
ret
=
ldap_parse_sort_controlA
(
ld
,
server_ctrls
,
&
result
,
NULL
);
ok
(
ret
==
LDAP_CONTROL_NOT_FOUND
,
"ldap_parse_sort_controlA failed 0x%x
\n
"
,
ret
);
ldap_control_free
(
sort
);
ldap_controls_free
(
server_ctrls
);
}
START_TEST
(
parse
)
{
LDAP
*
ld
;
ld
=
ldap_initA
((
char
*
)
"directory.verisign.com"
,
389
);
ok
(
ld
!=
NULL
,
"ldap_init failed
\n
"
);
test_ldap_parse_sort_control
(
ld
);
ldap_unbind
(
ld
);
}
dlls/wldap32/wldap32.h
View file @
b9813873
...
...
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
ULONG
map_error
(
int
);
/* A set of helper functions to convert LDAP data structures
* to and from ansi (A), wide character (W) and utf8 (U) encodings.
*/
...
...
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