]> git.sur5r.net Git - openldap/commitdiff
Commit preliminary fix for ldap.conf base usage.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 1 Dec 1998 20:08:39 +0000 (20:08 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 1 Dec 1998 20:08:39 +0000 (20:08 +0000)
libraries/libldap/open.c
libraries/libldap/search.c

index 2aa8eafcb259dc01894da1ca5b3b0b1481af666d..f66b8dba3f00ffea2a48d8d5c83c6333d6c86a75 100644 (file)
@@ -170,10 +170,17 @@ ldap_init( char *defhost, int defport )
                return( NULL );
        }
 
+       if ( openldap_ldap_global_options.ldo_defbase != NULL ) {
+               ld->ld_options.ldo_defbase = ldap_strdup(
+                       openldap_ldap_global_options.ldo_defbase);
+       }
+
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        if (( ld->ld_selectinfo = ldap_new_select_info()) == NULL ) {
                free( (char*) ld->ld_options.ldo_defhost );
-               free( (char*) ld->ld_options.ldo_defbase );
+               if ( ld->ld_options.ldo_defbase == NULL ) {
+                       free( (char*) ld->ld_options.ldo_defbase );
+               }
                free( (char*) ld );
            WSACleanup( );
                return( NULL );
index c6be97c4d761cf84037089b301d7c6e29725139f..daa4017a67ea5eeda3a4cf54670451bcc8825837 100644 (file)
@@ -112,6 +112,12 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
        }
 
        if ( base == NULL ) {
+               /* no base provided, use session default base */
+               base = ld->ld_options.ldo_defbase;
+       }
+
+       if ( base == NULL ) {
+               /* no session default base, use top */
            base = "";
        }