Commit fda3d626 authored by Howard Chu's avatar Howard Chu
Browse files

ITS#3353 consolidate slapd globals into a single struct

parent db62156d
......@@ -203,14 +203,14 @@ fe_op_add( Operation *op, SlapReply *rs )
*/
op->o_bd = select_backend( &e->e_nname, manageDSAit, 0 );
if ( op->o_bd == NULL ) {
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
if ( !rs->sr_ref ) rs->sr_ref = default_referral;
if ( !rs->sr_ref ) rs->sr_ref = SLAPD_GLOBAL(default_referral);
if ( rs->sr_ref ) {
rs->sr_err = LDAP_REFERRAL;
send_ldap_result( op, rs );
if ( rs->sr_ref != default_referral ) {
if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( rs->sr_ref );
}
} else {
......@@ -329,17 +329,17 @@ fe_op_add( Operation *op, SlapReply *rs )
#endif /* LDAP_SLAPI */
defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
? op->o_bd->be_update_refs : SLAPD_GLOBAL(default_referral);
if ( defref != NULL ) {
rs->sr_ref = referral_rewrite( defref,
NULL, &e->e_name, LDAP_SCOPE_DEFAULT );
if ( rs->sr_ref == NULL ) rs->sr_ref = defref;
rs->sr_err = LDAP_REFERRAL;
if (!rs->sr_ref) rs->sr_ref = default_referral;
if (!rs->sr_ref) rs->sr_ref = SLAPD_GLOBAL(default_referral);
send_ldap_result( op, rs );
if ( rs->sr_ref != default_referral ) {
if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( rs->sr_ref );
}
} else {
......
......@@ -74,7 +74,7 @@ dn2entry_retry:
e = NULL;
} else {
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
......
......@@ -165,7 +165,7 @@ retry: /* transaction retry */
ber_bvarray_add( &deref, &tmpbv );
}
} else {
deref = default_referral;
deref = SLAPD_GLOBAL(default_referral);
}
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
LDAP_SCOPE_DEFAULT );
......@@ -174,10 +174,10 @@ retry: /* transaction retry */
rs->sr_err = LDAP_REFERRAL;
send_ldap_result( op, rs );
if ( rs->sr_ref != default_referral ) {
if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( rs->sr_ref );
}
if ( deref != default_referral ) {
if ( deref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( deref );
}
free( (char *)rs->sr_matched );
......
......@@ -177,7 +177,7 @@ bdb_db_open( BackendDB *be )
bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
/* One long-lived TXN per thread, two TXNs per write op */
bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, connection_pool_max * 3 );
bdb->bi_dbenv->set_tx_max( bdb->bi_dbenv, SLAPD_GLOBAL(connection_pool_max) * 3 );
if ( bdb->bi_idl_cache_max_size ) {
bdb->bi_idl_tree = NULL;
......
......@@ -399,7 +399,7 @@ retry: /* transaction retry */
ber_bvarray_add( &deref, &tmpbv );
}
} else {
deref = default_referral;
deref = SLAPD_GLOBAL(default_referral);
}
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
LDAP_SCOPE_DEFAULT );
......@@ -408,10 +408,10 @@ retry: /* transaction retry */
rs->sr_err = LDAP_REFERRAL;
send_ldap_result( op, rs );
if ( rs->sr_ref != default_referral ) {
if ( rs->sr_ref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( rs->sr_ref );
}
if ( deref != default_referral ) {
if ( deref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( deref );
}
free( (char *)rs->sr_matched );
......
......@@ -188,7 +188,7 @@ retry: /* transaction retry */
ber_bvarray_add( &deref, &tmpbv );
}
} else {
deref = default_referral;
deref = SLAPD_GLOBAL(default_referral);
}
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
LDAP_SCOPE_DEFAULT );
......@@ -198,7 +198,7 @@ retry: /* transaction retry */
send_ldap_result( op, rs );
ber_bvarray_free( rs->sr_ref );
if ( deref != default_referral ) {
if ( deref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( deref );
}
free( (char *)rs->sr_matched );
......
......@@ -94,9 +94,9 @@ dn2entry_retry:
bdb_cache_return_entry_r (bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
e = NULL;
} else if ( default_referral != NULL ) {
} else if ( SLAPD_GLOBAL(default_referral) != NULL ) {
rc = LDAP_OTHER;
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
......
......@@ -612,7 +612,7 @@ dn2entry_retry:
}
} else {
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &sop->o_req_dn, sop->oq_search.rs_scope );
}
......
......@@ -57,7 +57,7 @@ dnssrv_back_referrals(
if( ldap_dn2domain( op->o_req_dn.bv_val, &domain ) || domain == NULL ) {
rs->sr_err = LDAP_REFERRAL;
rs->sr_ref = default_referral;
rs->sr_ref = SLAPD_GLOBAL(default_referral);
send_ldap_result( op, rs );
return LDAP_REFERRAL;
}
......
......@@ -59,7 +59,7 @@ dnssrv_back_search(
if( ldap_dn2domain( op->o_req_dn.bv_val, &domain ) || domain == NULL ) {
rs->sr_err = LDAP_REFERRAL;
rs->sr_ref = default_referral;
rs->sr_ref = SLAPD_GLOBAL(default_referral);
send_ldap_result( op, rs );
rs->sr_ref = NULL;
goto done;
......
......@@ -46,12 +46,12 @@ int init_module(int argc, char *argv[]) {
#endif /* SLAPD_LDAP */
static int
int
ldap_back_open(
BackendInfo *bi
)
{
bi->bi_controls = slap_known_controls;
bi->bi_controls = SLAPD_GLOBAL(known_controls);
return 0;
}
......
......@@ -109,7 +109,7 @@ ldbm_back_add(
cache_return_entry_r( &li->li_cache, matched );
} else {
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
......
......@@ -48,7 +48,7 @@ ldbm_back_compare(
: NULL;
cache_return_entry_r( &li->li_cache, matched );
} else {
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
......
......@@ -70,7 +70,7 @@ ldbm_back_delete(
ber_bvarray_add( &deref, &tmpbv );
}
} else {
deref = default_referral;
deref = SLAPD_GLOBAL(default_referral);
}
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
LDAP_SCOPE_DEFAULT );
......@@ -82,7 +82,7 @@ ldbm_back_delete(
send_ldap_result( op, rs );
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
if ( deref != default_referral ) {
if ( deref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( deref );
}
free( (char *)rs->sr_matched );
......
......@@ -61,7 +61,7 @@ id2entry_add( Backend *be, Entry *e )
#endif
key.dsize = sizeof(ID);
ldap_pvt_thread_mutex_lock( &entry2str_mutex );
ldap_pvt_thread_mutex_lock( &SLAPD_GLOBAL(entry2str_mutex) );
data.dptr = entry2str( e, &len );
data.dsize = len + 1;
......@@ -69,7 +69,7 @@ id2entry_add( Backend *be, Entry *e )
flags = LDBM_REPLACE;
rc = ldbm_cache_store( db, key, data, flags );
ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
ldap_pvt_thread_mutex_unlock( &SLAPD_GLOBAL(entry2str_mutex) );
ldbm_cache_close( be, db );
......
......@@ -265,7 +265,7 @@ ldbm_back_modify(
ber_bvarray_add( &deref, &tmpbv );
}
} else {
deref = default_referral;
deref = SLAPD_GLOBAL(default_referral);
}
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
LDAP_SCOPE_DEFAULT );
......@@ -276,7 +276,7 @@ ldbm_back_modify(
send_ldap_result( op, rs );
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
if ( deref != default_referral ) {
if ( deref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( deref );
}
free( (char *)rs->sr_matched );
......
......@@ -93,7 +93,7 @@ ldbm_back_modrdn(
ber_bvarray_add( &deref, &tmpbv );
}
} else {
deref = default_referral;
deref = SLAPD_GLOBAL(default_referral);
}
rs->sr_ref = referral_rewrite( deref, NULL, &op->o_req_dn,
LDAP_SCOPE_DEFAULT );
......@@ -105,7 +105,7 @@ ldbm_back_modrdn(
send_ldap_result( op, rs );
if ( rs->sr_ref ) ber_bvarray_free( rs->sr_ref );
if ( deref != default_referral ) {
if ( deref != SLAPD_GLOBAL(default_referral) ) {
ber_bvarray_free( deref );
}
free( (char *)rs->sr_matched );
......
......@@ -62,9 +62,9 @@ ldbm_back_referrals(
cache_return_entry_r( &li->li_cache, matched );
} else if ( default_referral != NULL ) {
} else if ( SLAPD_GLOBAL(default_referral) != NULL ) {
rs->sr_err = LDAP_OTHER;
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
}
......
......@@ -102,7 +102,7 @@ ldbm_back_search(
}
} else {
rs->sr_ref = referral_rewrite( default_referral,
rs->sr_ref = referral_rewrite( SLAPD_GLOBAL(default_referral),
NULL, &op->o_req_dn, op->ors_scope );
}
......
......@@ -47,7 +47,7 @@ meta_back_open(
BackendInfo *bi
)
{
bi->bi_controls = slap_known_controls;
bi->bi_controls = SLAPD_GLOBAL(known_controls);
return 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment