X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2Fback-bdb%2Fcompare.c;h=6cc97f854647a729c797179590c913f92519d69d;hb=c59f0869ec670a8b2f58cb69a5c92202fd33f0c3;hp=e3323b4d3a7c294a14b559200f213809a25b0825;hpb=a632038df9c4889ddae6407524f9bf76cd028396;p=openldap diff --git a/servers/slapd/back-bdb/compare.c b/servers/slapd/back-bdb/compare.c index e3323b4d3a..6cc97f8546 100644 --- a/servers/slapd/back-bdb/compare.c +++ b/servers/slapd/back-bdb/compare.c @@ -1,8 +1,17 @@ /* compare.c - bdb backend compare routine */ /* $OpenLDAP$ */ -/* - * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file +/* This work is part of OpenLDAP Software . + * + * Copyright 2000-2004 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . */ #include "portable.h" @@ -36,7 +45,7 @@ bdb_compare( Operation *op, SlapReply *rs ) dn2entry_retry: /* get entry */ - rs->sr_err = bdb_dn2entry( op->o_bd, NULL, &op->o_req_ndn, &ei, 1, locker, &lock, op->o_tmpmemctx ); + rs->sr_err = bdb_dn2entry( op, NULL, &op->o_req_ndn, &ei, 1, locker, &lock ); switch( rs->sr_err ) { case DB_NOTFOUND: @@ -102,8 +111,15 @@ dn2entry_retry: goto done; } - rs->sr_err = access_allowed( op, e, - op->oq_compare.rs_ava->aa_desc, &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL ); + if ( get_assert( op ) && + ( test_filter( op, e, get_assertion( op )) != LDAP_COMPARE_TRUE )) + { + rs->sr_err = LDAP_ASSERTION_FAILED; + goto return_results; + } + + rs->sr_err = access_allowed( op, e, op->oq_compare.rs_ava->aa_desc, + &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL ); if ( ! rs->sr_err ) { rs->sr_err = LDAP_INSUFFICIENT_ACCESS; goto return_results;