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
29c2c75e
Commit
29c2c75e
authored
Nov 18, 2005
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 18, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using deprecated openldap functions.
Correct some return values.
parent
a81afd15
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
29 deletions
+79
-29
add.c
dlls/wldap32/add.c
+11
-6
bind.c
dlls/wldap32/bind.c
+36
-6
compare.c
dlls/wldap32/compare.c
+32
-17
No files found.
dlls/wldap32/add.c
View file @
29c2c75e
...
...
@@ -79,6 +79,7 @@ ULONG ldap_addW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
;
LDAPMod
**
attrsU
=
NULL
;
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -95,7 +96,12 @@ ULONG ldap_addW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
if
(
!
attrsU
)
goto
exit
;
}
ret
=
ldap_add
(
ld
,
dn
?
dnU
:
""
,
attrs
?
attrsU
:
nullattrs
);
ret
=
ldap_add_ext
(
ld
,
dn
?
dnU
:
""
,
attrs
?
attrsU
:
nullattrs
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
dnU
);
...
...
@@ -119,7 +125,7 @@ ULONG ldap_add_extA( WLDAP32_LDAP *ld, PCHAR dn, LDAPModA *attrs[],
TRACE
(
"(%p, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_a
(
dn
),
attrs
,
serverctrls
,
clientctrls
,
message
);
if
(
!
ld
)
return
~
0UL
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnW
=
strAtoW
(
dn
);
...
...
@@ -165,8 +171,7 @@ ULONG ldap_add_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
TRACE
(
"(%p, %s, %p, %p, %p, %p)
\n
"
,
ld
,
debugstr_w
(
dn
),
attrs
,
serverctrls
,
clientctrls
,
message
);
if
(
!
ld
)
return
~
0UL
;
if
(
!
attrs
)
return
LDAP_PROTOCOL_ERROR
;
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
...
...
@@ -185,7 +190,7 @@ ULONG ldap_add_extW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[],
if
(
!
clientctrlsU
)
goto
exit
;
}
ret
=
ldap_add_ext
(
ld
,
dn
?
dnU
:
""
,
attrs
?
attrsU
:
nullattrs
,
serverctrlsU
,
ret
=
ldap_add_ext
(
ld
,
dn
?
dnU
:
""
,
attrs
?
attrsU
:
nullattrs
,
serverctrlsU
,
clientctrlsU
,
message
?
(
int
*
)
message
:
&
dummy
);
exit:
...
...
@@ -344,7 +349,7 @@ ULONG ldap_add_sW( WLDAP32_LDAP *ld, PWCHAR dn, LDAPModW *attrs[] )
if
(
!
attrsU
)
goto
exit
;
}
ret
=
ldap_add_
s
(
ld
,
dn
?
dnU
:
""
,
attrs
?
attrsU
:
nullattrs
);
ret
=
ldap_add_
ext_s
(
ld
,
dn
?
dnU
:
""
,
attrs
?
attrsU
:
nullattrs
,
NULL
,
NULL
);
exit:
strfreeU
(
dnU
);
...
...
dlls/wldap32/bind.c
View file @
29c2c75e
...
...
@@ -77,12 +77,15 @@ ULONG ldap_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
credU
=
NULL
;
struct
berval
pwd
=
{
0
,
NULL
};
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
TRACE
(
"(%p, %s, %p, 0x%08lx)
\n
"
,
ld
,
debugstr_w
(
dn
),
cred
,
method
);
if
(
!
ld
)
return
~
0UL
;
if
(
method
!=
LDAP_AUTH_SIMPLE
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
...
...
@@ -91,9 +94,17 @@ ULONG ldap_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
if
(
cred
)
{
credU
=
strWtoU
(
cred
);
if
(
!
credU
)
goto
exit
;
pwd
.
bv_len
=
strlen
(
credU
);
pwd
.
bv_val
=
credU
;
}
ret
=
ldap_bind
(
ld
,
dnU
,
credU
,
method
);
ret
=
ldap_sasl_bind
(
ld
,
dnU
,
LDAP_SASL_SIMPLE
,
&
pwd
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
dnU
);
...
...
@@ -139,12 +150,14 @@ ULONG ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
credU
=
NULL
;
struct
berval
pwd
=
{
0
,
NULL
};
ret
=
WLDAP32_LDAP_NO_MEMORY
;
TRACE
(
"(%p, %s, %p, 0x%08lx)
\n
"
,
ld
,
debugstr_w
(
dn
),
cred
,
method
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
method
!=
LDAP_AUTH_SIMPLE
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
...
...
@@ -153,9 +166,12 @@ ULONG ldap_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR cred, ULONG method )
if
(
cred
)
{
credU
=
strWtoU
(
cred
);
if
(
!
credU
)
goto
exit
;
pwd
.
bv_len
=
strlen
(
credU
);
pwd
.
bv_val
=
credU
;
}
ret
=
ldap_
bind_s
(
ld
,
dnU
,
credU
,
method
);
ret
=
ldap_
sasl_bind_s
(
ld
,
dnU
,
LDAP_SASL_SIMPLE
,
&
pwd
,
NULL
,
NULL
,
NULL
);
exit:
strfreeU
(
dnU
);
...
...
@@ -379,6 +395,8 @@ ULONG ldap_simple_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
passwdU
=
NULL
;
struct
berval
pwd
=
{
0
,
NULL
};
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -393,9 +411,17 @@ ULONG ldap_simple_bindW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
if
(
passwd
)
{
passwdU
=
strWtoU
(
passwd
);
if
(
!
passwdU
)
goto
exit
;
pwd
.
bv_len
=
strlen
(
passwdU
);
pwd
.
bv_val
=
passwdU
;
}
ret
=
ldap_simple_bind
(
ld
,
dnU
,
passwdU
);
ret
=
ldap_sasl_bind
(
ld
,
dnU
,
LDAP_SASL_SIMPLE
,
&
pwd
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
dnU
);
...
...
@@ -441,6 +467,7 @@ ULONG ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
passwdU
=
NULL
;
struct
berval
pwd
=
{
0
,
NULL
};
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -455,9 +482,12 @@ ULONG ldap_simple_bind_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR passwd )
if
(
passwd
)
{
passwdU
=
strWtoU
(
passwd
);
if
(
!
passwdU
)
goto
exit
;
pwd
.
bv_len
=
strlen
(
passwdU
);
pwd
.
bv_val
=
passwdU
;
}
ret
=
ldap_s
imple_bind_s
(
ld
,
dnU
,
passwdU
);
ret
=
ldap_s
asl_bind_s
(
ld
,
dnU
,
LDAP_SASL_SIMPLE
,
&
pwd
,
NULL
,
NULL
,
NULL
);
exit:
strfreeU
(
dnU
);
...
...
@@ -475,7 +505,7 @@ ULONG WLDAP32_ldap_unbind( WLDAP32_LDAP *ld )
TRACE
(
"(%p)
\n
"
,
ld
);
if
(
ld
)
ret
=
ldap_unbind
(
ld
);
ret
=
ldap_unbind
_ext
(
ld
,
NULL
,
NULL
);
else
ret
=
WLDAP32_LDAP_PARAM_ERROR
;
...
...
@@ -491,7 +521,7 @@ ULONG WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld )
TRACE
(
"(%p)
\n
"
,
ld
);
if
(
ld
)
ret
=
ldap_unbind_
s
(
ld
);
ret
=
ldap_unbind_
ext_s
(
ld
,
NULL
,
NULL
);
else
ret
=
WLDAP32_LDAP_PARAM_ERROR
;
...
...
dlls/wldap32/compare.c
View file @
29c2c75e
...
...
@@ -46,21 +46,21 @@ ULONG ldap_compareA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value )
#ifdef HAVE_LDAP
WCHAR
*
dnW
=
NULL
,
*
attrW
=
NULL
,
*
valueW
=
NULL
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
ret
=
~
0UL
;
TRACE
(
"(%p, %s, %s, %s)
\n
"
,
ld
,
debugstr_a
(
dn
),
debugstr_a
(
attr
),
debugstr_a
(
value
)
);
if
(
!
ld
)
return
~
0UL
;
if
(
!
ld
||
!
attr
)
return
~
0UL
;
if
(
dn
)
{
dnW
=
strAtoW
(
dn
);
if
(
!
dnW
)
goto
exit
;
}
if
(
attr
)
{
attrW
=
strAtoW
(
attr
);
if
(
!
attrW
)
goto
exit
;
}
if
(
value
)
{
valueW
=
strAtoW
(
value
);
if
(
!
valueW
)
goto
exit
;
...
...
@@ -82,14 +82,15 @@ ULONG ldap_compareW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
attrU
=
NULL
,
*
valueU
=
NULL
;
struct
berval
val
=
{
0
,
NULL
};
int
msg
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
ret
=
~
0UL
;
TRACE
(
"(%p, %s, %s, %s)
\n
"
,
ld
,
debugstr_w
(
dn
),
debugstr_w
(
attr
),
debugstr_w
(
value
)
);
if
(
!
ld
)
return
WLDAP32_LDAP_PARAM_ERROR
;
if
(
!
attr
)
return
~
0UL
;
if
(
!
ld
||
!
attr
)
return
~
0UL
;
if
(
dn
)
{
dnU
=
strWtoU
(
dn
);
...
...
@@ -102,9 +103,17 @@ ULONG ldap_compareW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value )
if
(
value
)
{
valueU
=
strWtoU
(
value
);
if
(
!
valueU
)
goto
exit
;
val
.
bv_len
=
strlen
(
valueU
);
val
.
bv_val
=
valueU
;
}
ret
=
ldap_compare
(
ld
,
dn
?
dnU
:
""
,
attrU
,
value
?
valueU
:
""
);
ret
=
ldap_compare_ext
(
ld
,
dn
?
dnU
:
""
,
attrU
,
&
val
,
NULL
,
NULL
,
&
msg
);
if
(
ret
==
LDAP_SUCCESS
)
ret
=
msg
;
else
ret
=
~
0UL
;
exit:
strfreeU
(
dnU
);
...
...
@@ -175,7 +184,7 @@ ULONG ldap_compare_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value,
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
attrU
=
NULL
,
*
valueU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
berval
;
struct
berval
val
=
{
0
,
NULL
}
;
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -198,9 +207,10 @@ ULONG ldap_compare_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value,
if
(
value
)
{
valueU
=
strWtoU
(
value
);
if
(
!
valueU
)
goto
exit
;
val
.
bv_len
=
strlen
(
valueU
);
val
.
bv_val
=
valueU
;
}
berval
.
bv_len
=
valueU
?
strlen
(
valueU
)
:
0
;
berval
.
bv_val
=
valueU
;
}
if
(
serverctrls
)
{
serverctrlsU
=
controlarrayWtoU
(
serverctrls
);
...
...
@@ -211,7 +221,7 @@ ULONG ldap_compare_extW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value,
if
(
!
clientctrlsU
)
goto
exit
;
}
ret
=
ldap_compare_ext
(
ld
,
dn
?
dnU
:
""
,
attrU
,
data
?
(
struct
berval
*
)
data
:
&
ber
val
,
ret
=
ldap_compare_ext
(
ld
,
dn
?
dnU
:
""
,
attrU
,
data
?
(
struct
berval
*
)
data
:
&
val
,
serverctrlsU
,
clientctrlsU
,
(
int
*
)
message
);
exit:
...
...
@@ -281,9 +291,9 @@ ULONG ldap_compare_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR valu
{
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
struct
berval
berval
;
char
*
dnU
=
NULL
,
*
attrU
=
NULL
,
*
valueU
=
NULL
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
struct
berval
val
=
{
0
,
NULL
};
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -305,9 +315,10 @@ ULONG ldap_compare_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR valu
if
(
value
)
{
valueU
=
strWtoU
(
value
);
if
(
!
valueU
)
goto
exit
;
val
.
bv_len
=
strlen
(
valueU
);
val
.
bv_val
=
valueU
;
}
berval
.
bv_len
=
valueU
?
strlen
(
valueU
)
:
0
;
berval
.
bv_val
=
valueU
;
}
if
(
serverctrls
)
{
serverctrlsU
=
controlarrayWtoU
(
serverctrls
);
...
...
@@ -318,7 +329,7 @@ ULONG ldap_compare_ext_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR valu
if
(
!
clientctrlsU
)
goto
exit
;
}
ret
=
ldap_compare_ext_s
(
ld
,
dn
?
dnU
:
""
,
attr
?
attrU
:
""
,
data
?
(
struct
berval
*
)
data
:
&
ber
val
,
ret
=
ldap_compare_ext_s
(
ld
,
dn
?
dnU
:
""
,
attr
?
attrU
:
""
,
data
?
(
struct
berval
*
)
data
:
&
val
,
serverctrlsU
,
clientctrlsU
);
exit:
...
...
@@ -374,6 +385,7 @@ ULONG ldap_compare_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value )
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
char
*
dnU
=
NULL
,
*
attrU
=
NULL
,
*
valueU
=
NULL
;
struct
berval
val
=
{
0
,
NULL
};
ret
=
WLDAP32_LDAP_NO_MEMORY
;
...
...
@@ -393,9 +405,12 @@ ULONG ldap_compare_sW( WLDAP32_LDAP *ld, PWCHAR dn, PWCHAR attr, PWCHAR value )
if
(
value
)
{
valueU
=
strWtoU
(
value
);
if
(
!
valueU
)
goto
exit
;
val
.
bv_len
=
strlen
(
valueU
);
val
.
bv_val
=
valueU
;
}
ret
=
ldap_compare_
s
(
ld
,
dn
?
dnU
:
""
,
attr
?
attrU
:
""
,
value
?
valueU
:
""
);
ret
=
ldap_compare_
ext_s
(
ld
,
dn
?
dnU
:
""
,
attr
?
attrU
:
""
,
&
val
,
NULL
,
NULL
);
exit:
strfreeU
(
dnU
);
...
...
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