Skip to content
Snippets Groups Projects
Commit bc227138 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Fix TLS bug

parent eb122892
No related branches found
No related tags found
No related merge requests found
...@@ -809,13 +809,8 @@ ldap_pvt_tls_get_option( LDAP *ld, int option, void *arg ) ...@@ -809,13 +809,8 @@ ldap_pvt_tls_get_option( LDAP *ld, int option, void *arg )
{ {
struct ldapoptions *lo; struct ldapoptions *lo;
/* Get pointer to global option structure */
lo = LDAP_INT_GLOBAL_OPT();
if (NULL == lo) {
return LDAP_NO_MEMORY;
}
if(ld != NULL) { if( ld != NULL ) {
assert( LDAP_VALID( ld ) ); assert( LDAP_VALID( ld ) );
if( !LDAP_VALID( ld ) ) { if( !LDAP_VALID( ld ) ) {
...@@ -823,6 +818,13 @@ ldap_pvt_tls_get_option( LDAP *ld, int option, void *arg ) ...@@ -823,6 +818,13 @@ ldap_pvt_tls_get_option( LDAP *ld, int option, void *arg )
} }
lo = &ld->ld_options; lo = &ld->ld_options;
} else {
/* Get pointer to global option structure */
lo = LDAP_INT_GLOBAL_OPT();
if( lo == NULL ) {
return LDAP_NO_MEMORY;
}
} }
switch( option ) { switch( option ) {
...@@ -868,13 +870,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) ...@@ -868,13 +870,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg )
{ {
struct ldapoptions *lo; struct ldapoptions *lo;
/* Get pointer to global option structure */ if( ld != NULL ) {
lo = LDAP_INT_GLOBAL_OPT();
if (NULL == lo) {
return LDAP_NO_MEMORY;
}
if(ld != NULL) {
assert( LDAP_VALID( ld ) ); assert( LDAP_VALID( ld ) );
if( !LDAP_VALID( ld ) ) { if( !LDAP_VALID( ld ) ) {
...@@ -882,6 +878,13 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) ...@@ -882,6 +878,13 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg )
} }
lo = &ld->ld_options; lo = &ld->ld_options;
} else {
/* Get pointer to global option structure */
lo = LDAP_INT_GLOBAL_OPT();
if( lo == NULL ) {
return LDAP_NO_MEMORY;
}
} }
switch( option ) { switch( option ) {
...@@ -910,7 +913,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) ...@@ -910,7 +913,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg )
return 0; return 0;
} }
if ( lo != NULL ) { if ( ld != NULL ) {
return -1; return -1;
} }
......
...@@ -358,10 +358,21 @@ int main( int argc, char **argv ) ...@@ -358,10 +358,21 @@ int main( int argc, char **argv )
} }
#ifdef HAVE_TLS #ifdef HAVE_TLS
ldap_pvt_tls_init(); rc = ldap_pvt_tls_init();
if( rc != 0) {
Debug( LDAP_DEBUG_ANY,
"main: TLS init failed: %d\n",
0, 0, 0 );
rc = 1;
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 );
goto destroy;
}
if (ldap_pvt_tls_init_def_ctx() != 0) rc = ldap_pvt_tls_init_def_ctx();
{ if( rc != 0) {
Debug( LDAP_DEBUG_ANY,
"main: TLS init def ctx failed: %d\n",
0, 0, 0 );
rc = 1; rc = 1;
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 ); SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 );
goto destroy; goto destroy;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment