Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
fce0baa9
Commit
fce0baa9
authored
Mar 21, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Mar 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wldap32: Handle null DN or null message in ldap_add* and add tests.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54702
parent
fd99bd4e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
4 deletions
+65
-4
add.c
dlls/wldap32/add.c
+4
-4
parse.c
dlls/wldap32/tests/parse.c
+61
-0
No files found.
dlls/wldap32/add.c
View file @
fce0baa9
...
...
@@ -79,7 +79,7 @@ ULONG CDECL ldap_add_extA( LDAP *ld, char *dn, LDAPModA **attrs, LDAPControlA **
TRACE
(
"(%p, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_a
(
dn
),
attrs
,
serverctrls
,
clientctrls
,
message
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
ld
||
!
message
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
&&
!
(
dnW
=
strAtoW
(
dn
)))
goto
exit
;
if
(
attrs
&&
!
(
attrsW
=
modarrayAtoW
(
attrs
)))
goto
exit
;
...
...
@@ -109,9 +109,9 @@ ULONG CDECL ldap_add_extW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW *
TRACE
(
"(%p, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
attrs
,
serverctrls
,
clientctrls
,
message
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
ld
||
!
message
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
!
(
dnU
=
dn
?
strWtoU
(
dn
)
:
strdup
(
""
)))
goto
exit
;
if
(
attrs
&&
!
(
attrsU
=
modarrayWtoU
(
attrs
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
...
...
@@ -173,7 +173,7 @@ ULONG CDECL ldap_add_ext_sW( LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPControlW
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
&&
!
(
dnU
=
strWtoU
(
dn
)))
goto
exit
;
if
(
!
(
dnU
=
dn
?
strWtoU
(
dn
)
:
strdup
(
""
)))
goto
exit
;
if
(
attrs
&&
!
(
attrsU
=
modarrayWtoU
(
attrs
)))
goto
exit
;
if
(
serverctrls
&&
!
(
serverctrlsU
=
controlarrayWtoU
(
serverctrls
)))
goto
exit
;
if
(
clientctrls
&&
!
(
clientctrlsU
=
controlarrayWtoU
(
clientctrls
)))
goto
exit
;
...
...
dlls/wldap32/tests/parse.c
View file @
fce0baa9
...
...
@@ -175,6 +175,66 @@ static void test_ldap_bind_sA( void )
ldap_unbind
(
ld
);
}
static
void
test_ldap_add
(
void
)
{
char
*
one_empty_string
[]
=
{
(
char
*
)
""
,
NULL
};
LDAPModA
empty_equals_empty
=
{
0
,
(
char
*
)
""
,
{
one_empty_string
}
};
LDAPModA
*
attrs
[]
=
{
&
empty_equals_empty
,
NULL
};
LDAP
*
ld
;
ULONG
ret
,
num
;
ld
=
ldap_initA
(
(
char
*
)
"db.debian.org"
,
389
);
ok
(
ld
!=
NULL
,
"ldap_init failed
\n
"
);
ret
=
ldap_addA
(
NULL
,
NULL
,
NULL
);
ok
(
ret
==
(
ULONG
)
-
1
,
"ldap_addA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_addA
(
NULL
,
(
char
*
)
""
,
attrs
);
ok
(
ret
==
(
ULONG
)
-
1
,
"ldap_addA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_addA
(
ld
,
NULL
,
attrs
);
ok
(
ret
!=
(
ULONG
)
-
1
,
"ldap_addA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_addA
(
ld
,
(
char
*
)
""
,
NULL
);
ok
(
ret
!=
(
ULONG
)
-
1
,
"ldap_addA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_addA
(
ld
,
(
char
*
)
""
,
attrs
);
ok
(
ret
!=
(
ULONG
)
-
1
,
"ldap_addA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_sA
(
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_add_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_sA
(
NULL
,
(
char
*
)
""
,
attrs
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_add_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_sA
(
ld
,
NULL
,
attrs
);
ok
(
ret
==
LDAP_ALREADY_EXISTS
,
"ldap_add_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_sA
(
ld
,
(
char
*
)
""
,
NULL
);
ok
(
ret
==
LDAP_PROTOCOL_ERROR
,
"ldap_add_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_sA
(
ld
,
(
char
*
)
""
,
attrs
);
ok
(
ret
==
LDAP_ALREADY_EXISTS
,
"ldap_add_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_extA
(
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_add_extA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_extA
(
NULL
,
(
char
*
)
""
,
attrs
,
NULL
,
NULL
,
&
num
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_add_extA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_extA
(
ld
,
NULL
,
attrs
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_add_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_extA
(
ld
,
(
char
*
)
""
,
NULL
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_add_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_extA
(
ld
,
(
char
*
)
""
,
attrs
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_add_extA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_extA
(
ld
,
(
char
*
)
""
,
attrs
,
NULL
,
NULL
,
&
num
);
ok
(
!
ret
,
"ldap_add_extA should succeed, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_ext_sA
(
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_add_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_ext_sA
(
NULL
,
(
char
*
)
""
,
attrs
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PARAM_ERROR
,
"ldap_add_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_ext_sA
(
ld
,
NULL
,
attrs
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_ALREADY_EXISTS
,
"ldap_add_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_ext_sA
(
ld
,
(
char
*
)
""
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_PROTOCOL_ERROR
,
"ldap_add_ext_sA should fail, got %#lx
\n
"
,
ret
);
ret
=
ldap_add_ext_sA
(
ld
,
(
char
*
)
""
,
attrs
,
NULL
,
NULL
);
ok
(
ret
==
LDAP_ALREADY_EXISTS
,
"ldap_add_ext_sA should fail, got %#lx
\n
"
,
ret
);
ldap_unbind
(
ld
);
}
static
void
test_ldap_server_control
(
void
)
{
/* SEQUENCE { INTEGER :: 0x07 } */
...
...
@@ -297,6 +357,7 @@ START_TEST (parse)
test_ldap_paged_search
();
test_ldap_server_control
();
test_ldap_bind_sA
();
test_ldap_add
();
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