X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Foptions.c;h=16376c1b5a4d344b3be2f36d0013aa3103812264;hb=8045b54124f0365b3d34d9d3220256f052f2b76b;hp=237609c6f365527162faa13bb10f6070e44919d0;hpb=b8c8f6ef6f1b76c730033710d86e6bd9b4fcc5f0;p=openldap diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index 237609c6f3..16376c1b5a 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -1,6 +1,6 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -87,7 +87,7 @@ ldap_get_option( const struct ldapoptions *lo; if( ldap_int_global_options.ldo_valid != LDAP_INITIALIZED ) { - ldap_int_initialize(); + ldap_int_initialize(NULL); } if(ld == NULL) { @@ -198,11 +198,7 @@ ldap_get_option( return LDAP_OPT_SUCCESS; case LDAP_OPT_PROTOCOL_VERSION: - if ((ld != NULL) && ld->ld_version) { - * (int *) outvalue = ld->ld_version; - } else { - * (int *) outvalue = lo->ldo_version; - } + * (int *) outvalue = lo->ldo_version; return LDAP_OPT_SUCCESS; case LDAP_OPT_SERVER_CONTROLS: @@ -293,6 +289,10 @@ ldap_get_option( #ifdef HAVE_TLS if ( ldap_pvt_tls_get_option((struct ldapoptions *)lo, option, outvalue ) == 0 ) return LDAP_OPT_SUCCESS; +#endif +#ifdef HAVE_CYRUS_SASL + if ( ldap_pvt_sasl_get_option(ld, option, outvalue ) == 0 ) + return LDAP_OPT_SUCCESS; #endif /* bad param */ break; @@ -308,9 +308,18 @@ ldap_set_option( LDAP_CONST void *invalue) { struct ldapoptions *lo; + int *dbglvl = NULL; + + /* + * The architecture to turn on debugging has a chicken and egg + * problem. Thus, we introduce a fix here. + */ + + if (option == LDAP_OPT_DEBUG_LEVEL) + dbglvl = (int *) invalue; if( ldap_int_global_options.ldo_valid != LDAP_INITIALIZED ) { - ldap_int_initialize(); + ldap_int_initialize(dbglvl); } if(ld == NULL) { @@ -568,7 +577,11 @@ ldap_set_option( default: #ifdef HAVE_TLS if ( ldap_pvt_tls_set_option( lo, option, (void *)invalue ) == 0 ) - return LDAP_OPT_SUCCESS; + return LDAP_OPT_SUCCESS; +#endif +#ifdef HAVE_CYRUS_SASL + if ( ldap_pvt_sasl_set_option( ld, option, (void *)invalue ) == 0 ) + return LDAP_OPT_SUCCESS; #endif /* bad param */ break;