Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Barchiesi
OpenLDAP
Commits
cde56fad
Commit
cde56fad
authored
5 years ago
by
Ondřej Kuzník
Committed by
Quanah Gibson-Mount
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ITS#7996 Tighten race in ldap_int_initialize
parent
e5f945ba
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/libldap/init.c
+16
-16
16 additions, 16 deletions
libraries/libldap/init.c
with
16 additions
and
16 deletions
libraries/libldap/init.c
+
16
−
16
View file @
cde56fad
...
@@ -516,15 +516,6 @@ ldap_int_destroy_global_options(void)
...
@@ -516,15 +516,6 @@ ldap_int_destroy_global_options(void)
*/
*/
void
ldap_int_initialize_global_options
(
struct
ldapoptions
*
gopts
,
int
*
dbglvl
)
void
ldap_int_initialize_global_options
(
struct
ldapoptions
*
gopts
,
int
*
dbglvl
)
{
{
#ifdef LDAP_R_COMPILE
LDAP_PVT_MUTEX_FIRSTCREATE
(
gopts
->
ldo_mutex
);
#endif
LDAP_MUTEX_LOCK
(
&
gopts
->
ldo_mutex
);
if
(
gopts
->
ldo_valid
==
LDAP_INITIALIZED
)
{
/* someone else got here first */
LDAP_MUTEX_UNLOCK
(
&
gopts
->
ldo_mutex
);
return
;
}
if
(
dbglvl
)
if
(
dbglvl
)
gopts
->
ldo_debug
=
*
dbglvl
;
gopts
->
ldo_debug
=
*
dbglvl
;
else
else
...
@@ -588,7 +579,6 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
...
@@ -588,7 +579,6 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
gopts
->
ldo_keepalive_idle
=
0
;
gopts
->
ldo_keepalive_idle
=
0
;
gopts
->
ldo_valid
=
LDAP_INITIALIZED
;
gopts
->
ldo_valid
=
LDAP_INITIALIZED
;
LDAP_MUTEX_UNLOCK
(
&
gopts
->
ldo_mutex
);
return
;
return
;
}
}
...
@@ -598,7 +588,14 @@ char * ldap_int_hostname = NULL;
...
@@ -598,7 +588,14 @@ char * ldap_int_hostname = NULL;
void
ldap_int_initialize
(
struct
ldapoptions
*
gopts
,
int
*
dbglvl
)
void
ldap_int_initialize
(
struct
ldapoptions
*
gopts
,
int
*
dbglvl
)
{
{
#ifdef LDAP_R_COMPILE
LDAP_PVT_MUTEX_FIRSTCREATE
(
gopts
->
ldo_mutex
);
#endif
LDAP_MUTEX_LOCK
(
&
gopts
->
ldo_mutex
);
if
(
gopts
->
ldo_valid
==
LDAP_INITIALIZED
)
{
if
(
gopts
->
ldo_valid
==
LDAP_INITIALIZED
)
{
/* someone else got here first */
LDAP_MUTEX_UNLOCK
(
&
gopts
->
ldo_mutex
);
return
;
return
;
}
}
...
@@ -614,7 +611,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
...
@@ -614,7 +611,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
if
(
WSAStartup
(
wVersionRequested
,
&
wsaData
)
!=
0
)
{
if
(
WSAStartup
(
wVersionRequested
,
&
wsaData
)
!=
0
)
{
/* Tell the user that we couldn't find a usable */
/* Tell the user that we couldn't find a usable */
/* WinSock DLL. */
/* WinSock DLL. */
return
;
goto
done
;
}
}
/* Confirm that the WinSock DLL supports 2.0.*/
/* Confirm that the WinSock DLL supports 2.0.*/
...
@@ -629,13 +626,13 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
...
@@ -629,13 +626,13 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
/* Tell the user that we couldn't find a usable */
/* Tell the user that we couldn't find a usable */
/* WinSock DLL. */
/* WinSock DLL. */
WSACleanup
(
);
WSACleanup
(
);
return
;
goto
done
;
}
}
}
/* The WinSock DLL is acceptable. Proceed. */
}
/* The WinSock DLL is acceptable. Proceed. */
#elif defined(HAVE_WINSOCK)
#elif defined(HAVE_WINSOCK)
{
WSADATA
wsaData
;
{
WSADATA
wsaData
;
if
(
WSAStartup
(
0x0101
,
&
wsaData
)
!=
0
)
{
if
(
WSAStartup
(
0x0101
,
&
wsaData
)
!=
0
)
{
return
;
goto
done
;
}
}
}
}
#endif
#endif
...
@@ -660,14 +657,14 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
...
@@ -660,14 +657,14 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
#ifdef HAVE_CYRUS_SASL
#ifdef HAVE_CYRUS_SASL
if
(
ldap_int_sasl_init
()
!=
0
)
{
if
(
ldap_int_sasl_init
()
!=
0
)
{
return
;
goto
done
;
}
}
#endif
#endif
ldap_int_initialize_global_options
(
gopts
,
dbglvl
);
ldap_int_initialize_global_options
(
gopts
,
dbglvl
);
if
(
getenv
(
"LDAPNOINIT"
)
!=
NULL
)
{
if
(
getenv
(
"LDAPNOINIT"
)
!=
NULL
)
{
return
;
goto
done
;
}
}
#ifdef HAVE_CYRUS_SASL
#ifdef HAVE_CYRUS_SASL
...
@@ -688,7 +685,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
...
@@ -688,7 +685,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
#ifdef HAVE_GETEUID
#ifdef HAVE_GETEUID
if
(
geteuid
()
!=
getuid
()
)
if
(
geteuid
()
!=
getuid
()
)
return
;
goto
done
;
#endif
#endif
openldap_ldap_init_w_userconf
(
LDAP_USERRC_FILE
);
openldap_ldap_init_w_userconf
(
LDAP_USERRC_FILE
);
...
@@ -720,4 +717,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
...
@@ -720,4 +717,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
}
}
openldap_ldap_init_w_env
(
gopts
,
NULL
);
openldap_ldap_init_w_env
(
gopts
,
NULL
);
done:
LDAP_MUTEX_UNLOCK
(
&
gopts
->
ldo_mutex
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment