From 16fa8c4a21e9acbf1449fe97c3714fa1d497eb5b Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 2 Aug 2001 04:20:11 +0000 Subject: [PATCH] Fix bug introduced during TLS rework --- libraries/libldap/tls.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index 6053ef85cb..3841fded78 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -809,13 +809,7 @@ ldap_pvt_tls_get_option( LDAP *ld, int option, void *arg ) { 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 ) ); if( !LDAP_VALID( ld ) ) { @@ -823,6 +817,13 @@ ldap_pvt_tls_get_option( LDAP *ld, int option, void *arg ) } 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 ) { @@ -868,13 +869,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) { 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 ) ); if( !LDAP_VALID( ld ) ) { @@ -882,6 +877,13 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) } 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 ) { @@ -910,7 +912,7 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) return 0; } - if ( lo != NULL ) { + if ( ld != NULL ) { return -1; } -- 2.39.5