/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2006 The OpenLDAP Foundation.
+ * Copyright 2000-2011 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
Entry *e = NULL;
EntryInfo *ei;
- Attribute *a;
int manageDSAit = get_manageDSAit( op );
- u_int32_t locker;
+ DB_TXN *rtxn;
DB_LOCK lock;
- rs->sr_err = LOCK_ID(bdb->bi_dbenv, &locker);
+ rs->sr_err = bdb_reader_get(op, bdb->bi_dbenv, &rtxn);
switch(rs->sr_err) {
case 0:
break;
dn2entry_retry:
/* get entry */
- rs->sr_err = bdb_dn2entry( op, NULL, &op->o_req_ndn, &ei, 1,
- locker, &lock );
+ rs->sr_err = bdb_dn2entry( op, rtxn, &op->o_req_ndn, &ei, 1,
+ &lock );
switch( rs->sr_err ) {
case DB_NOTFOUND:
e = ei->bei_e;
if ( rs->sr_err == DB_NOTFOUND ) {
if ( e != NULL ) {
-#ifdef SLAP_ACL_HONOR_DISCLOSE
/* return referral only if "disclose" is granted on the object */
if ( ! access_allowed( op, e, slap_schema.si_ad_entry,
NULL, ACL_DISCLOSE, NULL ) )
{
rs->sr_err = LDAP_NO_SUCH_OBJECT;
- } else
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
- {
+ } else {
rs->sr_matched = ch_strdup( e->e_dn );
rs->sr_ref = is_entry_referral( e )
? get_entry_referrals( op, e )
rs->sr_err = LDAP_REFERRAL;
}
- bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, e, &lock );
+ bdb_cache_return_entry_r( bdb, e, &lock );
e = NULL;
} else {
}
if (!manageDSAit && is_entry_referral( e ) ) {
-#ifdef SLAP_ACL_HONOR_DISCLOSE
/* return referral only if "disclose" is granted on the object */
if ( !access_allowed( op, e, slap_schema.si_ad_entry,
NULL, ACL_DISCLOSE, NULL ) )
{
rs->sr_err = LDAP_NO_SUCH_OBJECT;
- } else
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
- {
+ } else {
/* entry is a referral, don't allow compare */
rs->sr_ref = get_entry_referrals( op, e );
rs->sr_err = LDAP_REFERRAL;
goto done;
}
- if ( get_assert( op ) &&
- ( test_filter( op, e, get_assertion( op )) != LDAP_COMPARE_TRUE ))
- {
-#ifdef SLAP_ACL_HONOR_DISCLOSE
- if ( !access_allowed( op, e, slap_schema.si_ad_entry,
- NULL, ACL_DISCLOSE, NULL ) )
- {
- rs->sr_err = LDAP_NO_SUCH_OBJECT;
- } else
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
- {
- rs->sr_err = LDAP_ASSERTION_FAILED;
- }
- goto return_results;
- }
-
- if ( !access_allowed( op, e, op->oq_compare.rs_ava->aa_desc,
- &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL ) )
- {
-#ifdef SLAP_ACL_HONOR_DISCLOSE
- /* return error only if "disclose"
- * is granted on the object */
- if ( !access_allowed( op, e, slap_schema.si_ad_entry,
- NULL, ACL_DISCLOSE, NULL ) )
- {
- rs->sr_err = LDAP_NO_SUCH_OBJECT;
- } else
-#endif /* SLAP_ACL_HONOR_DISCLOSE */
- {
- rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
- }
- goto return_results;
- }
-
- rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
-
- for ( a = attrs_find( e->e_attrs, op->oq_compare.rs_ava->aa_desc );
- a != NULL;
- a = attrs_find( a->a_next, op->oq_compare.rs_ava->aa_desc ) )
- {
- rs->sr_err = LDAP_COMPARE_FALSE;
-
- if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
- SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
- SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
- a->a_nvals, &op->oq_compare.rs_ava->aa_value,
- op->o_tmpmemctx ) == 0 )
- {
- rs->sr_err = LDAP_COMPARE_TRUE;
- break;
- }
- }
+ rs->sr_err = slap_compare_entry( op, e, op->orc_ava );
return_results:
send_ldap_result( op, rs );
done:
/* free entry */
if ( e != NULL ) {
- bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache,
- e, &lock );
+ bdb_cache_return_entry_r( bdb, e, &lock );
}
- LOCK_ID_FREE ( bdb->bi_dbenv, locker );
return rs->sr_err;
}