]> git.sur5r.net Git - openldap/commitdiff
Update referral handling to use struct berval DNs.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 26 Dec 2001 20:59:24 +0000 (20:59 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 26 Dec 2001 20:59:24 +0000 (20:59 +0000)
25 files changed:
servers/slapd/add.c
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/bind.c
servers/slapd/back-bdb/compare.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/referral.c
servers/slapd/back-bdb/search.c
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/bind.c
servers/slapd/back-ldbm/compare.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-ldbm/modify.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldbm/referral.c
servers/slapd/back-ldbm/search.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/proto-slap.h
servers/slapd/referral.c
servers/slapd/search.c

index 5bd01be842b0188880c9c65ebb71f478ecd11b42..fe8cfed67a0b64533c8d41abf015a191f88f8084 100644 (file)
@@ -237,7 +237,7 @@ do_add( Connection *conn, Operation *op )
        be = select_backend( &e->e_nname, manageDSAit, 0 );
        if ( be == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
-                       NULL, e->e_dn, LDAP_SCOPE_DEFAULT );
+                       NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                        NULL, NULL, ref ? ref : default_referral, NULL );
@@ -329,7 +329,7 @@ do_add( Connection *conn, Operation *op )
                        struct berval **defref = be->be_update_refs
                                ? be->be_update_refs : default_referral;
                        struct berval **ref = referral_rewrite( defref,
-                               NULL, e->e_dn, LDAP_SCOPE_DEFAULT );
+                               NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
 
                        send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
                                ref ? ref : defref, NULL );
index 905a856a284efab2f60a32c09ccd7b70e7438708..33a2e2f08eb63b878394b637e0a990ebe4900d2b 100644 (file)
@@ -121,15 +121,14 @@ retry:    rc = txn_abort( ltid );
                        if ( matched != NULL ) {
                                matched_dn = ch_strdup( matched->e_dn );
                                refs = is_entry_referral( matched )
-                                       ? get_entry_referrals( be, conn, op,
-                                       matched, e->e_dn, LDAP_SCOPE_DEFAULT )
+                                       ? get_entry_referrals( be, conn, op, matched )
                                        : NULL;
                                bdb_entry_return( be, matched );
                                matched = NULL;
 
                        } else {
                                refs = referral_rewrite( default_referral,
-                                       NULL, e->e_dn, LDAP_SCOPE_DEFAULT );
+                                       NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
                        }
 
                        Debug( LDAP_DEBUG_TRACE, "bdb_add: parent does not exist\n",
@@ -167,8 +166,7 @@ retry:      rc = txn_abort( ltid );
                        /* parent is a referral, don't allow add */
                        char *matched_dn = ch_strdup( p->e_dn );
                        struct berval **refs = is_entry_referral( p )
-                               ? get_entry_referrals( be, conn, op, p,
-                                       e->e_dn, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, p )
                                : NULL;
 
                        Debug( LDAP_DEBUG_TRACE, "bdb_add: parent is referral\n",
index 371bc15fb4cf2b4f80be3b4f076b0c45b20055a3..04be2e37e4c6d312f20e1349e9ded54d930c3343 100644 (file)
@@ -64,8 +64,7 @@ bdb_bind(
                        matched_dn = ch_strdup( matched->e_dn );
 
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
 
                        bdb_entry_return( be, matched );
@@ -73,7 +72,7 @@ bdb_bind(
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                /* allow noauth binds */
@@ -125,7 +124,7 @@ bdb_bind(
        if ( is_entry_referral( e ) ) {
                /* entry is a referral, don't allow bind */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
                Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
                        0, 0 );
index 71b072ae3b68e0e7d48c79a6759e51608f037aad..ce394d387bac8dd06f5794cfcf323b82a2c81861 100644 (file)
@@ -51,15 +51,14 @@ bdb_compare(
                if ( matched != NULL ) {
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        bdb_entry_return( be, matched );
                        matched = NULL;
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
@@ -74,7 +73,7 @@ bdb_compare(
        if (!manageDSAit && is_entry_referral( e ) ) {
                /* entry is a referral, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
                Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
                        0, 0 );
index 30e2bc63506f7042aadb54fed2763b2e5a3213d3..442a992a6993fbd6bcc146f16eda91a1f10b5387 100644 (file)
@@ -97,15 +97,14 @@ retry:      /* transaction retry */
                if ( matched != NULL ) {
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        bdb_entry_return( be, matched );
                        matched = NULL;
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -194,7 +193,7 @@ retry:      /* transaction retry */
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_delete: entry is referral\n",
index d475840d5614d72c71cf3abdf9cc9a15582f5318..47ee9f247ef127d55750777d21bad36fa59c06d6 100644 (file)
@@ -235,15 +235,14 @@ retry:    /* transaction retry */
                if ( matched != NULL ) {
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        bdb_entry_return( be, matched );
                        matched = NULL;
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
@@ -259,7 +258,7 @@ retry:      /* transaction retry */
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_modify: entry is referral\n",
index a356ba437b062c14777c3be0b9ad3f37d8c8d84e..91b6a00cb37df88f7cdd64e273f8050d301be754 100644 (file)
@@ -127,15 +127,14 @@ retry:    /* transaction retry */
                if( matched != NULL ) {
                        matched_dn = strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        bdb_entry_return( be, matched );
                        matched = NULL;
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
@@ -151,7 +150,7 @@ retry:      /* transaction retry */
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
                Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry %s is referral\n",
                        e->e_dn, 0, 0 );
index c02b78b1a79459b00653115d8dbc0dd8c69addb2..7a827ed2b619276a131269476718f3f4a56894e7 100644 (file)
@@ -65,8 +65,7 @@ bdb_referrals(
 
                        if( is_entry_referral( matched ) ) {
                                rc = LDAP_OTHER;
-                               refs = get_entry_referrals( be, conn, op,
-                                       matched, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               refs = get_entry_referrals( be, conn, op, matched );
                        }
 
                        bdb_entry_return( be, matched );
@@ -74,7 +73,7 @@ bdb_referrals(
                } else if ( default_referral != NULL ) {
                        rc = LDAP_OTHER;
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                if( refs != NULL ) {
@@ -95,9 +94,9 @@ bdb_referrals(
        if ( is_entry_referral( e ) ) {
                /* entry is a referral */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
                struct berval **rrefs = referral_rewrite(
-                       refs, e->e_dn, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       refs, &e->e_name, dn, LDAP_SCOPE_DEFAULT );
 
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_referrals: op=%ld target=\"%s\" matched=\"%s\"\n",
index d3a5bb02133847d1c84e55e6c688b2c10003f1dd..d930f9d09c424e3f4cc0fbc99115d7458317946a 100644 (file)
@@ -92,16 +92,15 @@ bdb_search(
        }
 
        if ( e == NULL ) {
-               char *matched_dn = NULL;
+               struct berval *matched_dn = NULL;
                struct berval **refs = NULL;
 
                if ( matched != NULL ) {
                        struct berval **erefs;
-                       matched_dn = ch_strdup( matched->e_dn );
+                       matched_dn = ber_bvdup( &matched->e_name );
 
                        erefs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       base->bv_val, scope )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
 
                        bdb_entry_return( be, matched );
@@ -109,29 +108,28 @@ bdb_search(
 
                        if( erefs ) {
                                refs = referral_rewrite( erefs, matched_dn,
-                                       base->bv_val, scope );
+                                       base, scope );
                                ber_bvecfree( erefs );
                        }
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, base->bv_val, scope );
+                               NULL, base, scope );
                }
 
                send_ldap_result( conn, op,     rc=LDAP_REFERRAL ,
-                       matched_dn, text, refs, NULL );
+                       matched_dn->bv_val, text, refs, NULL );
 
                ber_bvecfree( refs );
-               free( matched_dn );
-
+               ber_bvfree( matched_dn );
                return rc;
        }
 
        if (!manageDSAit && e != &slap_entry_root && is_entry_referral( e ) ) {
                /* entry is a referral, don't allow add */
-               char *matched_dn = ch_strdup( e->e_dn );
+               struct berval *matched_dn = ber_bvdup( &e->e_name );
                struct berval **erefs = get_entry_referrals( be,
-                       conn, op, e, base->bv_val, scope );
+                       conn, op, e );
                struct berval **refs = NULL;
 
                bdb_entry_return( be, e );
@@ -139,7 +137,7 @@ bdb_search(
 
                if( erefs ) {
                        refs = referral_rewrite( erefs, matched_dn,
-                               base->bv_val, scope );
+                               base, scope );
                        ber_bvecfree( erefs );
                }
 
@@ -147,12 +145,12 @@ bdb_search(
                        0, 0, 0 );
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
-                       matched_dn, refs ? NULL : "bad referral object",
+                       matched_dn->bv_val,
+                       refs ? NULL : "bad referral object",
                        refs, NULL );
 
                ber_bvecfree( refs );
-               free( matched_dn );
-
+               ber_bvfree( matched_dn );
                return 1;
        }
 
@@ -356,8 +354,9 @@ bdb_search(
                        is_entry_referral( e ) )
                {
                        struct berval **erefs = get_entry_referrals(
-                               be, conn, op, e, NULL, scope );
-                       struct berval **refs = referral_rewrite( erefs, e->e_dn, NULL,
+                               be, conn, op, e );
+                       struct berval **refs = referral_rewrite( erefs,
+                               &e->e_name, NULL,
                                scope == LDAP_SCOPE_SUBTREE 
                                        ? LDAP_SCOPE_SUBTREE
                                        : LDAP_SCOPE_BASE );
index 1b86663a2388e25055db7700ecbe4d19ff32f608..059abb031189cfb3ed8d1572005687e892c08922 100644 (file)
@@ -97,14 +97,13 @@ ldbm_back_add(
                        if ( matched != NULL ) {
                                matched_dn = ch_strdup( matched->e_dn );
                                refs = is_entry_referral( matched )
-                                       ? get_entry_referrals( be, conn, op, matched,
-                                               e->e_dn, LDAP_SCOPE_DEFAULT )
+                                       ? get_entry_referrals( be, conn, op, matched )
                                        : NULL;
                                cache_return_entry_r( &li->li_cache, matched );
 
                        } else {
                                refs = referral_rewrite( default_referral,
-                                       NULL, e->e_dn, LDAP_SCOPE_DEFAULT );
+                                       NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
                        }
 
 #ifdef NEW_LOGGING
@@ -176,8 +175,7 @@ ldbm_back_add(
                        /* parent is a referral, don't allow add */
                        char *matched_dn = ch_strdup( p->e_dn );
                        struct berval **refs = is_entry_referral( p )
-                               ? get_entry_referrals( be, conn, op, p,
-                                       e->e_dn, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, p )
                                : NULL;
 
                        /* free parent and writer lock */
index b76fc0c8dcdaa4856c9a4405aaf4d6f37c3aa158..38bb9cfa86e247302889e33b3efa07ae66178b61 100644 (file)
@@ -62,15 +62,14 @@ ldbm_back_bind(
                        matched_dn = ch_strdup( matched->e_dn );
 
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
 
                        cache_return_entry_r( &li->li_cache, matched );
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                /* allow noauth binds */
@@ -128,7 +127,7 @@ ldbm_back_bind(
        if ( is_entry_referral( e ) ) {
                /* entry is a referral, don't allow bind */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
index a1b49111a6fb6942f4e9a0fe22537a62346ee2e3..574c32d8fa78b32842f359e174d538ec34de9f78 100644 (file)
@@ -41,13 +41,12 @@ ldbm_back_compare(
                if ( matched != NULL ) {
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        cache_return_entry_r( &li->li_cache, matched );
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -62,7 +61,7 @@ ldbm_back_compare(
        if (!manageDSAit && is_entry_referral( e ) ) {
                /* entry is a referral, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
index c1d619841de67e7f99048d47f133e39f8b9915c9..d1a53967bce98d09dd8db6afc042c5c5957c21ce 100644 (file)
@@ -57,14 +57,13 @@ ldbm_back_delete(
                if ( matched != NULL ) {
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        cache_return_entry_r( &li->li_cache, matched );
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -80,7 +79,7 @@ ldbm_back_delete(
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
@@ -91,7 +90,6 @@ ldbm_back_delete(
                    0, 0 );
 #endif
 
-
                send_ldap_result( conn, op, LDAP_REFERRAL,
                    e->e_dn, NULL, refs, NULL );
 
index 5cda33e37c1a614b933192e72c1d2dc22256a4ce..7ff5926457bfac6cff1bb25d644fde8a09c85342 100644 (file)
@@ -275,13 +275,12 @@ ldbm_back_modify(
                if ( matched != NULL ) {
                        matched_dn = ch_strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        cache_return_entry_r( &li->li_cache, matched );
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -297,7 +296,7 @@ ldbm_back_modify(
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
index d7ab87d50678739ceba97ad27975b932d11c9cc1..c2be3c73e9a8bd98ec723ece3d63590bd9f6b2d1 100644 (file)
@@ -98,13 +98,12 @@ ldbm_back_modrdn(
                if( matched != NULL ) {
                        matched_dn = strdup( matched->e_dn );
                        refs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
                        cache_return_entry_r( &li->li_cache, matched );
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                send_ldap_result( conn, op, LDAP_REFERRAL,
@@ -120,7 +119,7 @@ ldbm_back_modrdn(
                /* parent is a referral, don't allow add */
                /* parent is an alias, don't allow add */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
index 468d79b870546d2e0cc798a58ecea4fd6374ffc6..ed47d6b8b98f2b4b96072f5c731d951ad528bb23 100644 (file)
@@ -59,8 +59,7 @@ ldbm_back_referrals(
 
                        if( is_entry_referral( matched ) ) {
                                rc = LDAP_OTHER;
-                               refs = get_entry_referrals( be, conn, op, matched,
-                                       dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               refs = get_entry_referrals( be, conn, op, matched );
                        }
 
                        cache_return_entry_r( &li->li_cache, matched );
@@ -68,7 +67,7 @@ ldbm_back_referrals(
                } else if ( default_referral != NULL ) {
                        rc = LDAP_OTHER;
                        refs = referral_rewrite( default_referral,
-                               NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, dn, LDAP_SCOPE_DEFAULT );
                }
 
                if( refs != NULL ) {
@@ -90,9 +89,9 @@ ldbm_back_referrals(
        if ( is_entry_referral( e ) ) {
                /* entry is a referral */
                struct berval **refs = get_entry_referrals( be,
-                       conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       conn, op, e );
                struct berval **rrefs = referral_rewrite(
-                       refs, e->e_dn, dn->bv_val, LDAP_SCOPE_DEFAULT );
+                       refs, &e->e_name, dn, LDAP_SCOPE_DEFAULT );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
index 753477a8e1e0d3295d304d47cace992f76013813..89caf85928f2bc1e45e62d5ac0e9d2dd60fc1395 100644 (file)
@@ -91,45 +91,44 @@ ldbm_back_search(
        }
 
        if ( e == NULL ) {
-               char *matched_dn = NULL;
+               struct berval *matched_dn = NULL;
                struct berval **refs = NULL;
 
                if ( matched != NULL ) {
                        struct berval **erefs;
-                       matched_dn = ch_strdup( matched->e_dn );
+                       matched_dn = ber_bvdup( &matched->e_name );
 
                        erefs = is_entry_referral( matched )
-                               ? get_entry_referrals( be, conn, op, matched,
-                                       base->bv_val, scope )
+                               ? get_entry_referrals( be, conn, op, matched )
                                : NULL;
 
                        cache_return_entry_r( &li->li_cache, matched );
 
                        if( erefs ) {
                                refs = referral_rewrite( erefs, matched_dn,
-                                       base->bv_val, scope );
+                                       base, scope );
 
                                ber_bvecfree( erefs );
                        }
 
                } else {
                        refs = referral_rewrite( default_referral,
-                               NULL, base->bv_val, scope );
+                               NULL, base, scope );
                }
 
                send_ldap_result( conn, op, err,
-                       matched_dn, text, refs, NULL );
+                       matched_dn->bv_val, text, refs, NULL );
 
                ber_bvecfree( refs );
-               free( matched_dn );
+               ber_bvfree( matched_dn );
                return 1;
        }
 
        if (!manageDSAit && is_entry_referral( e ) ) {
                /* entry is a referral, don't allow add */
-               char *matched_dn = ch_strdup( e->e_dn );
+               struct berval *matched_dn = ber_bvdup( &e->e_name );
                struct berval **erefs = get_entry_referrals( be,
-                       conn, op, e, base->bv_val, scope );
+                       conn, op, e );
                struct berval **refs = NULL;
 
                cache_return_entry_r( &li->li_cache, e );
@@ -146,22 +145,23 @@ ldbm_back_search(
 
                if( erefs ) {
                        refs = referral_rewrite( erefs, matched_dn,
-                               base->bv_val, scope );
+                               base, scope );
 
                        ber_bvecfree( erefs );
                }
 
                if( refs ) {
                        send_ldap_result( conn, op, LDAP_REFERRAL,
-                               matched_dn, NULL, refs, NULL );
+                               matched_dn->bv_val, NULL, refs, NULL );
                        ber_bvecfree( refs );
 
                } else {
-                       send_ldap_result( conn, op, LDAP_OTHER, matched_dn,
-                               "bad referral object", NULL, NULL );
+                       send_ldap_result( conn, op, LDAP_OTHER,
+                               matched_dn->bv_val,
+                       "bad referral object", NULL, NULL );
                }
 
-               free( matched_dn );
+               ber_bvfree( matched_dn );
                return 1;
        }
 
@@ -396,8 +396,9 @@ searchit:
 
                        if( scopeok ) {
                                struct berval **erefs = get_entry_referrals(
-                                       be, conn, op, e, NULL, cscope );
-                               struct berval **refs = referral_rewrite( erefs, e->e_dn, NULL,
+                                       be, conn, op, e );
+                               struct berval **refs = referral_rewrite( erefs,
+                                       &e->e_name, NULL,
                                        scope == LDAP_SCOPE_SUBTREE
                                                ? LDAP_SCOPE_SUBTREE
                                                : LDAP_SCOPE_BASE );
index aed512bd07ac58465951b17efb8506f74b0bc67d..d980c36bb083957c0d27a185acfbbd1d698a1da0 100644 (file)
@@ -459,7 +459,7 @@ do_bind(
        if ( (be = select_backend( ndn, 0, 0 )) == NULL ) {
                if ( default_referral ) {
                        struct berval **ref = referral_rewrite( default_referral,
-                               NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                        send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                                NULL, NULL, ref ? ref : default_referral, NULL );
index fafdd815b1cbe4b92d731a46d8b6947b8784303c..77b1c4cd6471437c9d1ee4245d50695eb5f64a45 100644 (file)
@@ -241,7 +241,7 @@ do_compare(
         */
        if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
-                       NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
+                       NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                        NULL, NULL, ref ? ref : default_referral, NULL );
index dc5393c596791f1fd9da9e5eaabd360bfb89d8a4..035ed744558036f8e9f2cf231d46f217c3c5f5d3 100644 (file)
@@ -145,7 +145,7 @@ do_delete(
         */
        if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
-                       NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
+                       NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                        NULL, NULL, ref ? ref : default_referral, NULL );
@@ -197,7 +197,7 @@ do_delete(
                        struct berval **defref = be->be_update_refs
                                ? be->be_update_refs : default_referral;
                        struct berval **ref = referral_rewrite( default_referral,
-                               NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                        send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
                                ref ? ref : defref, NULL );
index 1f283932e0611963e39979e773db5dc0b8825f35..7b337c889461d9e2817742f985174912113b0e08 100644 (file)
@@ -299,7 +299,7 @@ do_modify(
         */
        if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
-                       NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
+                       NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                        NULL, NULL, ref ? ref : default_referral, NULL );
@@ -391,7 +391,7 @@ do_modify(
                        struct berval **defref = be->be_update_refs
                                ? be->be_update_refs : default_referral;
                        struct berval **ref = referral_rewrite( defref,
-                               NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                        send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
                                ref ? ref : defref, NULL );
index d07242eb40b0942495e644b44599bc4367842718..e3b0264d5cc264cf24c6efdf01a4d6879653f7f3 100644 (file)
@@ -325,7 +325,7 @@ do_modrdn(
         */
        if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
-                       NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
+                       NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                        NULL, NULL, ref ? ref : default_referral, NULL );
@@ -403,7 +403,7 @@ do_modrdn(
                        struct berval **defref = be->be_update_refs
                                ? be->be_update_refs : default_referral;
                        struct berval **ref = referral_rewrite( defref,
-                               NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
+                               NULL, pdn, LDAP_SCOPE_DEFAULT );
 
                        send_ldap_result( conn, op, rc = LDAP_REFERRAL, NULL, NULL,
                                ref ? ref : defref, NULL );
index 547e5e92d55611cc3e62124f397e3215797abb6b..b23655286b96888e01c3739328acc52e086d4676 100644 (file)
@@ -581,13 +581,12 @@ LDAP_SLAPD_F (int) validate_global_referral LDAP_P((
        const char *url ));
 
 LDAP_SLAPD_F (struct berval **) get_entry_referrals LDAP_P((
-       Backend *be, Connection *conn, Operation *op,
-       Entry *e, const char *target, int scope ));
+       Backend *be, Connection *conn, Operation *op, Entry *e ));
 
 LDAP_SLAPD_F (struct berval **) referral_rewrite LDAP_P((
        struct berval **refs,
-       const char *base,
-       const char *target,
+       struct berval *base,
+       struct berval *target,
        int scope ));
 
 /*
index 272f9450808a9e7d24679a5c776ab4c591b5a5e8..147a1c899cd1806e0867387b820c303af71f1f59 100644 (file)
@@ -215,8 +215,8 @@ int validate_global_referral( const char *url )
 
 struct berval ** referral_rewrite(
        struct berval **in,
-       const char *base,
-       const char *target,
+       struct berval *base,
+       struct berval *target,
        int scope )
 {
        int i, j;
@@ -247,7 +247,9 @@ struct berval ** referral_rewrite(
                {
                        char *dn = url->lud_dn;
                        url->lud_dn = referral_dn_muck(
-                               ( dn && *dn ) ? dn : NULL, base, target ); 
+                               ( dn && *dn ) ? dn : NULL,
+                               base ? base->bv_val : NULL,
+                               target ? target->bv_val : NULL ); 
 
                        ldap_memfree( dn );
                }
@@ -281,9 +283,7 @@ struct berval **get_entry_referrals(
        Backend *be,
        Connection *conn,
        Operation *op,
-       Entry *e,
-       const char *dn,
-       int scope )
+       Entry *e )
 {
        Attribute *attr;
        struct berval **refs;
index c365d4131e80e6b067e9341ea686df6a93ae2fc2..f8de23a6875eb956368290bdf79c7cece940d3a5 100644 (file)
@@ -299,7 +299,7 @@ do_search(
         */
        if ( (be = select_backend( nbase, manageDSAit, 1 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
-                       NULL, pbase->bv_val, scope );
+                       NULL, pbase, scope );
 
                send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                        NULL, NULL, ref ? ref : default_referral, NULL );