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
e9376fd1
Commit
e9376fd1
authored
Mar 21, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Mar 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wldap32: Handle null DN or null attr in ldap_compare* and add tests.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54702
parent
e1930443
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
6 deletions
+83
-6
compare.c
dlls/wldap32/compare.c
+10
-6
parse.c
dlls/wldap32/tests/parse.c
+73
-0
No files found.
dlls/wldap32/compare.c
View file @
e9376fd1
...
...
@@ -81,9 +81,10 @@ ULONG CDECL ldap_compare_extA( LDAP *ld, char *dn, char *attr, char *value, stru
data
,
serverctrls
,
clientctrls
,
message
);
if
(
!
ld
||
!
message
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
attr
)
return
WLDAP32_LDAP_NO_MEMORY
;
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
goto
exit
;
if
(
attr
&&
!
(
attrW
=
strAtoW
(
attr
)))
goto
exit
;
if
(
!
(
attrW
=
strAtoW
(
attr
)))
goto
exit
;
if
(
value
&&
!
(
valueW
=
strAtoW
(
value
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsW
=
controlarrayAtoW
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsW
=
controlarrayAtoW
(
clientctrls
)))
goto
exit
;
...
...
@@ -116,7 +117,7 @@ ULONG CDECL ldap_compare_extW( LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR *value, s
if
(
!
ld
||
!
message
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
attr
)
return
WLDAP32_LDAP_NO_MEMORY
;
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
!
(
dnU
=
dn
?
strWtoU
(
dn
)
:
strdup
(
""
)))
goto
exit
;
if
(
!
(
attrU
=
strWtoU
(
attr
)))
goto
exit
;
if
(
!
data
)
{
...
...
@@ -161,9 +162,10 @@ ULONG CDECL ldap_compare_ext_sA( LDAP *ld, char *dn, char *attr, char *value, st
data
,
serverctrls
,
clientctrls
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
attr
)
return
LDAP_UNDEFINED_TYPE
;
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
goto
exit
;
if
(
attr
&&
!
(
attrW
=
strAtoW
(
attr
)))
goto
exit
;
if
(
!
(
attrW
=
strAtoW
(
attr
)))
goto
exit
;
if
(
value
&&
!
(
valueW
=
strAtoW
(
value
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsW
=
controlarrayAtoW
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsW
=
controlarrayAtoW
(
clientctrls
)))
goto
exit
;
...
...
@@ -194,9 +196,10 @@ ULONG CDECL ldap_compare_ext_sW( LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR *value,
serverctrls
,
clientctrls
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
attr
)
return
LDAP_UNDEFINED_TYPE
;
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
attr
&&
!
(
attrU
=
strWtoU
(
attr
)))
goto
exit
;
if
(
!
(
dnU
=
dn
?
strWtoU
(
dn
)
:
strdup
(
""
)))
goto
exit
;
if
(
!
(
attrU
=
strWtoU
(
attr
)))
goto
exit
;
if
(
!
data
)
{
if
(
value
)
...
...
@@ -235,9 +238,10 @@ ULONG CDECL ldap_compare_sA( LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value )
TRACE
(
"(%p, %s, %s, %s)
\n
"
,
ld
,
debugstr_a
(
dn
),
debugstr_a
(
attr
),
debugstr_a
(
value
)
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
attr
)
return
WLDAP32_LDAP_UNDEFINED_TYPE
;
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
goto
exit
;
if
(
attr
&&
!
(
attrW
=
strAtoW
(
attr
)))
goto
exit
;
if
(
!
(
attrW
=
strAtoW
(
attr
)))
goto
exit
;
if
(
value
&&
!
(
valueW
=
strAtoW
(
value
)))
goto
exit
;
ret
=
ldap_compare_sW
(
ld
,
dnW
,
attrW
,
valueW
);
...
...
dlls/wldap32/tests/parse.c
View file @
e9376fd1
...
...
@@ -295,6 +295,78 @@ static void test_ldap_modify(void)
ldap_unbind
(
ld
);
}
static
void
test_ldap_compare
(
void
)
{
struct
berval
empty_value
=
{
0
};
LDAP
*
ld
;
ULONG
ret
,
num
;
ld
=
ldap_initA
(
(
char
*
)
"db.debian.org"
,
389
);
ok
(
ld
!=
NULL
,
"ldap_init failed
\n
"
);
ret
=
ldap_compareA
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
(
ULONG
)
-
1
,
"ldap_compareA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compareA
(
NULL
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
);
ok
(
ret
==
(
ULONG
)
-
1
,
"ldap_compareA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compareA
(
ld
,
NULL
,
(
char
*
)
""
,
(
char
*
)
""
);
ok
(
ret
!=
(
ULONG
)
-
1
,
"ldap_compareA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compareA
(
ld
,
(
char
*
)
""
,
NULL
,
(
char
*
)
""
);
ok
(
ret
==
(
ULONG
)
-
1
,
"ldap_compareA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compareA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
NULL
);
ok
(
ret
!=
(
ULONG
)
-
1
,
"ldap_compareA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compareA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
);
ok
(
ret
!=
(
ULONG
)
-
1
,
"ldap_compareA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_sA
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_compare_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_sA
(
NULL
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_compare_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_sA
(
ld
,
NULL
,
(
char
*
)
""
,
(
char
*
)
""
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_sA
(
ld
,
(
char
*
)
""
,
NULL
,
(
char
*
)
""
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_sA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
NULL
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_sA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_compare_extA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
NULL
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
,
&
num
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_compare_extA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
ld
,
NULL
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_compare_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
ld
,
(
char
*
)
""
,
NULL
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
,
&
num
);
ok
(
ret
==
LDAP_NO_MEMORY
,
"ldap_compare_extA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
NULL
,
&
empty_value
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_compare_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
NULL
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_compare_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_compare_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_compare_extA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_extA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_compare_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_ext_sA
(
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_compare_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_ext_sA
(
NULL
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_compare_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_ext_sA
(
ld
,
NULL
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_ext_sA
(
ld
,
(
char
*
)
""
,
NULL
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_ext_sA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
NULL
,
&
empty_value
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_ext_sA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_compare_ext_sA
(
ld
,
(
char
*
)
""
,
(
char
*
)
""
,
(
char
*
)
""
,
&
empty_value
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_UNDEFINED_TYPE
,
"ldap_compare_ext_sA should fail, got %#lx
\n
"
,
ret
);
ldap_unbind
(
ld
);
}
static
void
test_ldap_server_control
(
void
)
{
/* SEQUENCE { INTEGER :: 0x07 } */
...
...
@@ -419,6 +491,7 @@ START_TEST (parse)
test_ldap_bind_sA
();
test_ldap_add
();
test_ldap_modify
();
test_ldap_compare
();
ld
=
ldap_initA
(
(
char
*
)
"db.debian.org"
,
389
);
ok
(
ld
!=
NULL
,
"ldap_init failed
\n
"
);
...
...
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