From d8292a62da2d85ec7f877a47f1b1684a1a589dee Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 8 Dec 2000 19:45:04 +0000 Subject: [PATCH] Fix referral scope logic --- libraries/libldap/request.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 5b6622365d..880b0015bc 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -977,11 +977,17 @@ re_encode_request( LDAP *ld, /* search requests need to be re-scope-ed */ rc = ber_scanf( &tmpber, "{ae" /*"}"*/, &orig_dn, &scope ); - if( srv->lud_scope == LDAP_SCOPE_DEFAULT && - scope != LDAP_SCOPE_SUBTREE ) - { + if( srv->lud_scope != LDAP_SCOPE_DEFAULT ) { + /* use the scope provided in reference */ + scope = srv->lud_scope; + + } else if ( scope != LDAP_SCOPE_SUBTREE ) { + /* use scope implied by previous operation */ + /* base -> base */ + /* one -> base */ + /* subtree -> subtree */ scope = LDAP_SCOPE_BASE; - } + } } else { rc = ber_scanf( &tmpber, "{a" /*}*/, &orig_dn ); -- 2.39.5