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
a1ebea41
Commit
a1ebea41
authored
Jul 26, 2005
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 26, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error handling for the init functions.
parent
a8f4b16b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
29 deletions
+62
-29
init.c
dlls/wldap32/init.c
+62
-29
No files found.
dlls/wldap32/init.c
View file @
a1ebea41
...
...
@@ -39,21 +39,27 @@
#include "winldap_private.h"
#include "wldap32.h"
/* Should eventually be determined by the algorithm documented on MSDN. */
static
const
WCHAR
defaulthost
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
WINE_DEFAULT_DEBUG_CHANNEL
(
wldap32
);
WLDAP32_LDAP
*
ldap_initA
(
PCHAR
hostname
,
ULONG
portnumber
)
{
#ifdef HAVE_LDAP
WLDAP32_LDAP
*
ld
;
WCHAR
*
hostnameW
;
WLDAP32_LDAP
*
ld
=
NULL
;
WCHAR
*
hostnameW
=
NULL
;
TRACE
(
"(%s, %ld)
\n
"
,
debugstr_a
(
hostname
),
portnumber
);
hostnameW
=
strAtoW
(
hostname
);
if
(
!
hostnameW
)
return
NULL
;
if
(
hostname
)
{
hostnameW
=
strAtoW
(
hostname
);
if
(
!
hostnameW
)
goto
exit
;
}
ld
=
ldap_initW
(
hostnameW
,
portnumber
);
exit:
strfreeW
(
hostnameW
);
return
ld
;
...
...
@@ -64,16 +70,23 @@ WLDAP32_LDAP *ldap_initA( PCHAR hostname, ULONG portnumber )
WLDAP32_LDAP
*
ldap_initW
(
PWCHAR
hostname
,
ULONG
portnumber
)
{
#ifdef HAVE_LDAP
LDAP
*
ld
;
char
*
hostnameU
;
LDAP
*
ld
=
NULL
;
char
*
hostnameU
=
NULL
;
TRACE
(
"(%s, %ld)
\n
"
,
debugstr_w
(
hostname
),
portnumber
);
hostnameU
=
strWtoU
(
hostname
);
if
(
!
hostnameU
)
return
NULL
;
if
(
hostname
)
{
hostnameU
=
strWtoU
(
hostname
);
if
(
!
hostnameU
)
goto
exit
;
}
else
{
hostnameU
=
strWtoU
(
defaulthost
);
if
(
!
hostnameU
)
goto
exit
;
}
ld
=
ldap_init
(
hostnameU
,
portnumber
);
exit:
strfreeU
(
hostnameU
);
return
ld
;
...
...
@@ -84,16 +97,19 @@ WLDAP32_LDAP *ldap_initW( PWCHAR hostname, ULONG portnumber )
WLDAP32_LDAP
*
ldap_openA
(
PCHAR
hostname
,
ULONG
portnumber
)
{
#ifdef HAVE_LDAP
WLDAP32_LDAP
*
ld
;
WCHAR
*
hostnameW
;
WLDAP32_LDAP
*
ld
=
NULL
;
WCHAR
*
hostnameW
=
NULL
;
TRACE
(
"(%s, %ld)
\n
"
,
debugstr_a
(
hostname
),
portnumber
);
hostnameW
=
strAtoW
(
hostname
);
if
(
!
hostnameW
)
return
NULL
;
if
(
hostname
)
{
hostnameW
=
strAtoW
(
hostname
);
if
(
!
hostnameW
)
goto
exit
;
}
ld
=
ldap_openW
(
hostnameW
,
portnumber
);
exit:
strfreeW
(
hostnameW
);
return
ld
;
...
...
@@ -104,16 +120,23 @@ WLDAP32_LDAP *ldap_openA( PCHAR hostname, ULONG portnumber )
WLDAP32_LDAP
*
ldap_openW
(
PWCHAR
hostname
,
ULONG
portnumber
)
{
#ifdef HAVE_LDAP
LDAP
*
ld
;
char
*
hostnameU
;
LDAP
*
ld
=
NULL
;
char
*
hostnameU
=
NULL
;
TRACE
(
"(%s, %ld)
\n
"
,
debugstr_w
(
hostname
),
portnumber
);
hostnameU
=
strWtoU
(
hostname
);
if
(
!
hostnameU
)
return
NULL
;
if
(
hostname
)
{
hostnameU
=
strWtoU
(
hostname
);
if
(
!
hostnameU
)
goto
exit
;
}
else
{
hostnameU
=
strWtoU
(
defaulthost
);
if
(
!
hostnameU
)
goto
exit
;
}
ld
=
ldap_open
(
hostnameU
,
portnumber
);
exit:
strfreeU
(
hostnameU
);
return
ld
;
...
...
@@ -126,20 +149,25 @@ ULONG ldap_start_tls_sA( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **
{
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
LDAPControlW
**
serverctrlsW
,
**
clientctrlsW
;
LDAPControlW
**
serverctrlsW
=
NULL
,
**
clientctrlsW
=
NULL
;
ret
=
LDAP_NO_MEMORY
;
TRACE
(
"(%p, %p, %p, %p, %p)
\n
"
,
ld
,
retval
,
result
,
serverctrls
,
clientctrls
);
if
(
!
ld
)
return
~
0UL
;
serverctrlsW
=
controlarrayAtoW
(
serverctrls
);
if
(
!
serverctrlsW
)
return
LDAP_NO_MEMORY
;
clientctrlsW
=
controlarrayAtoW
(
clientctrls
);
if
(
!
clientctrlsW
)
return
LDAP_NO_MEMORY
;
if
(
serverctrls
)
{
serverctrlsW
=
controlarrayAtoW
(
serverctrls
);
if
(
!
serverctrlsW
)
goto
exit
;
}
if
(
clientctrls
)
{
clientctrlsW
=
controlarrayAtoW
(
clientctrls
);
if
(
!
clientctrlsW
)
goto
exit
;
}
ret
=
ldap_start_tls_sW
(
ld
,
retval
,
result
,
serverctrlsW
,
clientctrlsW
);
exit:
controlarrayfreeW
(
serverctrlsW
);
controlarrayfreeW
(
clientctrlsW
);
...
...
@@ -152,20 +180,25 @@ ULONG ldap_start_tls_sW( WLDAP32_LDAP *ld, PULONG retval, WLDAP32_LDAPMessage **
{
ULONG
ret
=
LDAP_NOT_SUPPORTED
;
#ifdef HAVE_LDAP
LDAPControl
**
serverctrlsU
,
**
clientctrlsU
;
LDAPControl
**
serverctrlsU
=
NULL
,
**
clientctrlsU
=
NULL
;
ret
=
LDAP_NO_MEMORY
;
TRACE
(
"(%p, %p, %p, %p, %p)
\n
"
,
ld
,
retval
,
result
,
serverctrls
,
clientctrls
);
if
(
!
ld
)
return
~
0UL
;
serverctrlsU
=
controlarrayWtoU
(
serverctrls
);
if
(
!
serverctrlsU
)
return
LDAP_NO_MEMORY
;
clientctrlsU
=
controlarrayWtoU
(
clientctrls
);
if
(
!
clientctrlsU
)
return
LDAP_NO_MEMORY
;
if
(
serverctrls
)
{
serverctrlsU
=
controlarrayWtoU
(
serverctrls
);
if
(
!
serverctrlsU
)
goto
exit
;
}
if
(
clientctrls
)
{
clientctrlsU
=
controlarrayWtoU
(
clientctrls
);
if
(
!
clientctrlsU
)
goto
exit
;
}
ret
=
ldap_start_tls_s
(
ld
,
serverctrlsU
,
clientctrlsU
);
exit:
controlarrayfreeU
(
serverctrlsU
);
controlarrayfreeU
(
clientctrlsU
);
...
...
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