X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Foptions.c;h=515f906b9845b2efa7bbef4cfd041c937347a8d5;hb=d2b05a3858822df66785b4a0939204b10ac1c47f;hp=a892207d8c11200a54998f5496650fba2c5c5740;hpb=7dc76e7139ac73f9fe067f6222a26ffb30dc6f1a;p=openldap diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index a892207d8c..515f906b98 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -79,16 +79,19 @@ ldap_get_option( int option, void *outvalue) { - const struct ldapoptions *lo; + struct ldapoptions *lo; - if( ldap_int_global_options.ldo_valid != LDAP_INITIALIZED ) { - ldap_int_initialize(NULL); + /* Get pointer to global option structure */ + lo = LDAP_INT_GLOBAL_OPT(); + if (NULL == lo) { + return LDAP_NO_MEMORY; } - if(ld == NULL) { - lo = &ldap_int_global_options; + if( lo->ldo_valid != LDAP_INITIALIZED ) { + ldap_int_initialize(lo, NULL); + } - } else { + if(ld != NULL) { assert( LDAP_VALID( ld ) ); if( !LDAP_VALID( ld ) ) { @@ -188,10 +191,6 @@ ldap_get_option( * (int *) outvalue = (int) LDAP_BOOL_GET(lo, LDAP_BOOL_RESTART); return LDAP_OPT_SUCCESS; - case LDAP_OPT_DNS: /* LDAPv2 */ - * (int *) outvalue = (int) LDAP_BOOL_GET(lo, LDAP_BOOL_DNS); - return LDAP_OPT_SUCCESS; - case LDAP_OPT_PROTOCOL_VERSION: * (int *) outvalue = lo->ldo_version; return LDAP_OPT_SUCCESS; @@ -286,7 +285,7 @@ ldap_get_option( return LDAP_OPT_SUCCESS; #endif #ifdef HAVE_CYRUS_SASL - if ( ldap_pvt_sasl_get_option(ld, option, outvalue ) == 0 ) + if ( ldap_int_sasl_get_option(ld, option, outvalue ) == 0 ) return LDAP_OPT_SUCCESS; #endif /* bad param */ @@ -305,6 +304,12 @@ ldap_set_option( struct ldapoptions *lo; int *dbglvl = NULL; + /* Get pointer to global option structure */ + lo = LDAP_INT_GLOBAL_OPT(); + if (lo == NULL) { + return LDAP_NO_MEMORY; + } + /* * The architecture to turn on debugging has a chicken and egg * problem. Thus, we introduce a fix here. @@ -313,14 +318,11 @@ ldap_set_option( if (option == LDAP_OPT_DEBUG_LEVEL) dbglvl = (int *) invalue; - if( ldap_int_global_options.ldo_valid != LDAP_INITIALIZED ) { - ldap_int_initialize(dbglvl); + if( lo->ldo_valid != LDAP_INITIALIZED ) { + ldap_int_initialize(lo, dbglvl); } - if(ld == NULL) { - lo = &ldap_int_global_options; - - } else { + if(ld != NULL) { assert( LDAP_VALID( ld ) ); if( !LDAP_VALID( ld ) ) { @@ -580,7 +582,7 @@ ldap_set_option( return LDAP_OPT_SUCCESS; #endif #ifdef HAVE_CYRUS_SASL - if ( ldap_pvt_sasl_set_option( ld, option, (void *)invalue ) == 0 ) + if ( ldap_int_sasl_set_option( ld, option, (void *)invalue ) == 0 ) return LDAP_OPT_SUCCESS; #endif /* bad param */ @@ -589,7 +591,7 @@ ldap_set_option( return LDAP_OPT_ERROR; } -LIBLDAP_F(int) +int ldap_set_rebind_proc( LDAP *ld, LDAP_REBIND_PROC *rebind_proc) { return( ldap_set_option( ld, LDAP_OPT_REBIND_PROC, (void *)rebind_proc));