openldap/servers/slapd/back-monitor/compare.c

76 lines
1.7 KiB
C
Raw Normal View History

/* compare.c - monitor backend compare routine */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
2010-04-13 18:17:29 -04:00
* Copyright 2001-2010 The OpenLDAP Foundation.
2003-12-08 12:41:40 -05:00
* Portions Copyright 2001-2003 Pierangelo Masarati.
* 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 file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* ACKNOWLEDGEMENTS:
* This work was initially developed by Pierangelo Masarati for inclusion
* in OpenLDAP Software.
*/
#include "portable.h"
#include <stdio.h>
#include <slap.h>
#include "back-monitor.h"
int
2007-03-19 21:07:10 -04:00
monitor_back_compare( Operation *op, SlapReply *rs )
{
monitor_info_t *mi = ( monitor_info_t * ) op->o_bd->be_private;
Entry *e, *matched = NULL;
2005-04-08 19:33:03 -04:00
int rc;
/* get entry with reader lock */
monitor_cache_dn2entry( op, rs, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
2003-04-07 19:22:27 -04:00
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {
2005-04-08 19:33:03 -04:00
if ( !access_allowed_mask( op, matched,
slap_schema.si_ad_entry,
NULL, ACL_DISCLOSE, NULL, NULL ) )
{
/* do nothing */ ;
} else {
2005-04-08 19:33:03 -04:00
rs->sr_matched = matched->e_dn;
}
}
2003-03-31 14:21:19 -05:00
send_ldap_result( op, rs );
2003-04-07 19:22:27 -04:00
if ( matched ) {
monitor_cache_release( mi, matched );
rs->sr_matched = NULL;
}
2005-04-08 19:33:03 -04:00
return rs->sr_err;
}
2010-12-23 16:45:36 -05:00
rs->sr_err = slap_compare_entry( op, e, op->orc_ava );
2005-04-08 19:33:03 -04:00
rc = rs->sr_err;
switch ( rc ) {
case LDAP_COMPARE_FALSE:
case LDAP_COMPARE_TRUE:
rc = LDAP_SUCCESS;
break;
2003-03-31 14:21:19 -05:00
}
2005-04-08 19:33:03 -04:00
send_ldap_result( op, rs );
rs->sr_err = rc;
2003-03-31 14:21:19 -05:00
monitor_cache_release( mi, e );
2005-04-08 19:33:03 -04:00
return rs->sr_err;
}