]> git.sur5r.net Git - openldap/commitdiff
Fix referral scope logic
authorKurt Zeilenga <kurt@openldap.org>
Fri, 8 Dec 2000 19:45:04 +0000 (19:45 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 8 Dec 2000 19:45:04 +0000 (19:45 +0000)
libraries/libldap/request.c

index 5b6622365d7f759d79203bfdbfb353bb906355fa..880b0015bce11c8479e49c0d36645bf388ed1a22 100644 (file)
@@ -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 );