]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/options.c
Avoid locale specific ctype routines.
[openldap] / libraries / libldap / options.c
index 56b39c20f487399ec0094e66ef2b4f3d8027777a..a45cccecf77d5c6c7e9c1dca2e9fe608d717ab4b 100644 (file)
@@ -63,13 +63,6 @@ static const LDAPAPIFeatureInfo features[] = {
                LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
        },
 #endif
-#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
-       {       /* DNS */
-               LDAP_FEATURE_INFO_VERSION,
-               "X_OPENLDAP_V2_DNS",
-               LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
-       },
-#endif
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        {       /* V2 Referrals */
                LDAP_FEATURE_INFO_VERSION,
@@ -86,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 ) ) {
@@ -195,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;
@@ -312,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.
@@ -320,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 ) ) {
@@ -596,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));