From: Kurt Zeilenga Date: Tue, 1 Dec 1998 20:08:39 +0000 (+0000) Subject: Commit preliminary fix for ldap.conf base usage. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~980 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6232170a03fddc699b5fc68fd8b72ebe3fc7713e;p=openldap Commit preliminary fix for ldap.conf base usage. --- diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index 2aa8eafcb2..f66b8dba3f 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -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 ); diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index c6be97c4d7..daa4017a67 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -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 = ""; }