[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#4548) back-bdb/hdb doesn't rewrite referrals as appropriate?



Full_Name: Pierangelo Masarati
Version: HEAD
OS: irrelevant
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (81.72.89.40)
Submitted by: ando


If a database contains a referral like

        dn: ou=Ref,dc=example,dc=com
        ref: ldap://host/ou=Ref,dc=example,dc=com

and one tries to append an entry to it, say

        cn=Entry,ou=Ref,dc=example,dc=com

back-bdb/hdb returns a referral like

        ldap://host/ou=Ref,dc=example,dc=com

which seems to be incorrect; it should be

        ldap://host/cn=Entry,ou=Ref,dc=example,dc=com

This is because bdb_referrals() calls get_entry_referrals(), but it doesn't call
referral_rewrite().

The patch is 

----------------------------------------------------------------------------------
diff -u -r1.42 referral.c
--- servers/slapd/back-bdb/referral.c   6 Jan 2006 15:04:07 -0000       1.42
+++ servers/slapd/back-bdb/referral.c   15 May 2006 22:50:55 -0000
@@ -91,8 +91,11 @@
                                (long) op->o_tag, op->o_req_dn.bv_val,
e->e_name.bv_val );

                        if( is_entry_referral( e ) ) {
+                               BerVarray ref = get_entry_referrals( op, e );
                                rc = LDAP_OTHER;
-                               rs->sr_ref = get_entry_referrals( op, e );
+                               rs->sr_ref = referral_rewrite( ref, NULL,
+                                       &op->o_req_dn, LDAP_SCOPE_DEFAULT );
+                               ber_bvarray_free( ref );
                                if ( rs->sr_ref ) {
                                        rs->sr_matched = ber_strdup_x(
                                        e->e_name.bv_val, op->o_tmpmemctx );
----------------------------------------------------------------------------------

which is now fixed in HEAD; please review.

p.