/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2005 The OpenLDAP Foundation.
+ * Copyright 2000-2007 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* Free the previous entry, continue to work with the
* one we just retrieved.
*/
- bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache,
- *matched, lock);
+ bdb_cache_return_entry_r( bdb, *matched, lock);
*lock = lockr;
/* We found a regular entry. Return this to the caller. The
/* Find all aliases in database */
BDB_IDL_ZERO( aliases );
- rs->sr_err = bdb_filter_candidates( op, &af, aliases,
+ rs->sr_err = bdb_filter_candidates( op, locker, &af, aliases,
curscop, visited );
if (rs->sr_err != LDAP_SUCCESS) {
return rs->sr_err;
* to the cumulative list of candidates.
*/
BDB_IDL_CPY( curscop, aliases );
- rs->sr_err = bdb_dn2idl( op, e, subscop,
+ rs->sr_err = bdb_dn2idl( op, locker, &e->e_nname, BEI(e), subscop,
subscop2+BDB_IDL_DB_SIZE );
if (first) {
first = 0;
} else {
- bdb_cache_return_entry_r (bdb->bi_dbenv, &bdb->bi_cache, e, &locka);
+ bdb_cache_return_entry_r (bdb, e, &locka);
}
BDB_IDL_CPY(subscop2, subscop);
rs->sr_err = bdb_idl_intersection(curscop, subscop);
* turned into a range that spans IDs indiscriminately
*/
if (!is_entry_alias(a)) {
- bdb_cache_return_entry_r (bdb->bi_dbenv, &bdb->bi_cache,
- a, &lockr);
+ bdb_cache_return_entry_r (bdb, a, &lockr);
continue;
}
bdb_idl_insert(newsubs, a->e_id);
bdb_idl_insert(scopes, a->e_id);
}
- bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache,
- a, &lockr);
+ bdb_cache_return_entry_r( bdb, a, &lockr);
} else if (matched) {
/* Alias could not be dereferenced, or it deref'd to
* an ID we've already seen. Ignore it.
*/
- bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache,
- matched, &lockr );
+ bdb_cache_return_entry_r( bdb, matched, &lockr );
rs->sr_text = NULL;
}
}
ID id, cursor;
ID candidates[BDB_IDL_UM_SIZE];
ID scopes[BDB_IDL_DB_SIZE];
- Entry *e = NULL, base, e_root = {0};
+ Entry *e = NULL, base, *e_root;
Entry *matched = NULL;
- EntryInfo *ei, ei_root = {0};
+ EntryInfo *ei;
struct berval realbase = BER_BVNULL;
-#ifdef SLAP_ACL_HONOR_DISCLOSE
slap_mask_t mask;
-#endif
int manageDSAit;
int tentries = 0;
ID lastid = NOID;
}
}
+ e_root = bdb->bi_cache.c_dntree.bei_e;
if ( op->o_req_ndn.bv_len == 0 ) {
/* DIT root special case */
- ei_root.bei_e = &e_root;
- ei_root.bei_parent = &ei_root;
- e_root.e_private = &ei_root;
- e_root.e_id = 0;
- BER_BVSTR( &e_root.e_nname, "" );
- BER_BVSTR( &e_root.e_name, "" );
- ei = &ei_root;
+ ei = e_root->e_private;
rs->sr_err = LDAP_SUCCESS;
} else {
if ( op->ors_deref & LDAP_DEREF_FINDING ) {
if ( e ) {
build_new_dn( &op->o_req_ndn, &e->e_nname, &stub,
op->o_tmpmemctx );
- bdb_cache_return_entry_r (bdb->bi_dbenv, &bdb->bi_cache,
- e, &lock);
+ bdb_cache_return_entry_r (bdb, e, &lock);
matched = NULL;
goto dn2entry_retry;
}
if ( matched != NULL ) {
BerVarray erefs = NULL;
-#ifdef SLAP_ACL_HONOR_DISCLOSE
/* return referral only if "disclose"
* is granted on the object */
if ( ! access_allowed( op, matched,
{
rs->sr_err = LDAP_NO_SUCH_OBJECT;
- } else
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
- {
+ } else {
ber_dupbv( &matched_dn, &matched->e_name );
erefs = is_entry_referral( matched )
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, matched);
#endif
- bdb_cache_return_entry_r (bdb->bi_dbenv, &bdb->bi_cache,
- matched, &lock);
+ bdb_cache_return_entry_r (bdb, matched, &lock);
matched = NULL;
if ( erefs ) {
#endif
rs->sr_ref = referral_rewrite( default_referral,
NULL, &op->o_req_dn, op->oq_search.rs_scope );
- rs->sr_err = LDAP_REFERRAL;
+ rs->sr_err = rs->sr_ref != NULL ? LDAP_REFERRAL : LDAP_NO_SUCH_OBJECT;
}
send_ldap_result( op, rs );
return rs->sr_err;
}
-#ifdef SLAP_ACL_HONOR_DISCLOSE
/* NOTE: __NEW__ "search" access is required
* on searchBase object */
if ( ! access_allowed_mask( op, e, slap_schema.si_ad_entry,
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
- if ( e != &e_root ) {
- bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
+ if ( e != e_root ) {
+ bdb_cache_return_entry_r(bdb, e, &lock);
}
send_ldap_result( op, rs );
return rs->sr_err;
}
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
- if ( !manageDSAit && e != &e_root && is_entry_referral( e ) ) {
+ if ( !manageDSAit && e != e_root && is_entry_referral( e ) ) {
/* entry is a referral, don't allow add */
struct berval matched_dn = BER_BVNULL;
BerVarray erefs = NULL;
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
- bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, e, &lock );
+ bdb_cache_return_entry_r( bdb, e, &lock );
e = NULL;
if ( erefs ) {
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
- if ( e != &e_root ) {
- bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
+ if ( e != e_root ) {
+ bdb_cache_return_entry_r(bdb, e, &lock);
}
send_ldap_result( op, rs );
return 1;
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
- if ( e != &e_root ) {
- bdb_cache_return_entry_r(bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
+ if ( e != e_root ) {
+ bdb_cache_return_entry_r(bdb, e, &lock);
}
e = NULL;
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
- bdb_cache_return_entry_r( bdb->bi_dbenv,
- &bdb->bi_cache, e, &lock );
+ bdb_cache_return_entry_r( bdb, e, &lock );
e = NULL;
send_paged_response( op, rs, &lastid, tentries );
goto done;
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
- bdb_cache_return_entry_r(bdb->bi_dbenv,
- &bdb->bi_cache, e, &lock);
+ bdb_cache_return_entry_r(bdb, e, &lock);
e = NULL;
rs->sr_entry = NULL;
if ( rs->sr_err == LDAP_SIZELIMIT_EXCEEDED ) {
#ifdef SLAP_ZONE_ALLOC
slap_zn_runlock(bdb->bi_cache.c_zctx, e);
#endif
- bdb_cache_return_entry_r( bdb->bi_dbenv,
- &bdb->bi_cache, e , &lock );
+ bdb_cache_return_entry_r( bdb, e , &lock );
e = NULL;
rs->sr_entry = NULL;
}
-
- ldap_pvt_thread_yield();
}
nochange:
if( op->ors_deref & LDAP_DEREF_SEARCHING ) {
rc = search_aliases( op, rs, e, locker, ids, scopes, stack );
} else {
- rc = bdb_dn2idl( op, e, ids, stack );
+ rc = bdb_dn2idl( op, locker, &e->e_nname, BEI(e), ids, stack );
}
if ( rc == LDAP_SUCCESS ) {
- rc = bdb_filter_candidates( op, &f, ids,
+ rc = bdb_filter_candidates( op, locker, &f, ids,
stack, stack+BDB_IDL_UM_SIZE );
}