Update referral handling to use struct berval DNs.

This commit is contained in:
Kurt Zeilenga 2001-12-26 20:59:24 +00:00
parent f6deebfe6b
commit 21cecb3831
25 changed files with 98 additions and 116 deletions

View 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 );

View 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",

View 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 );

View 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 );

View 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",

View 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",

View 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 );

View 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",

View 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 );

View 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 */

View 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,

View 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,

View 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 );

View 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,

View 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,

View 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,

View 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 );

View 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 );

View 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 );

View 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 );

View 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 );

View 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 );

View 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 ));
/*

View 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;

View 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 );