#include "back-monitor.h"
int
-monitor_back_compare(
- Backend *be,
- Connection *conn,
- Operation *op,
- struct berval *dn,
- struct berval *ndn,
- AttributeAssertion *ava
-)
+monitor_back_compare( struct slap_op *op, struct slap_rep *rs)
{
- struct monitorinfo *mi = (struct monitorinfo *) be->be_private; int rc;
+ struct monitorinfo *mi =
+ (struct monitorinfo *) op->o_bd->be_private;
Entry *e, *matched = NULL;
Attribute *a;
/* get entry with reader lock */
- monitor_cache_dn2entry( mi, ndn, &e, &matched );
+ monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
- send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
- matched ? matched->e_dn : NULL,
- NULL, NULL, NULL );
if ( matched ) {
+ rs->sr_matched = ch_strdup( matched->e_dn );
monitor_cache_release( mi, matched );
}
+ rs->sr_err = LDAP_NO_SUCH_OBJECT;
+
+ send_ldap_result( op, rs );
+
+ rs->sr_matched = NULL;
return( 0 );
}
- rc = access_allowed( be, conn, op, e, ava->aa_desc,
- &ava->aa_value, ACL_COMPARE, NULL );
- if ( !rc ) {
- send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
- NULL, NULL, NULL, NULL );
- rc = 1;
+ 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;
}
- rc = LDAP_NO_SUCH_ATTRIBUTE;
+ rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
- for ( a = attrs_find( e->e_attrs, ava->aa_desc );
+ for ( a = attrs_find( e->e_attrs, op->oq_compare.rs_ava->aa_desc );
a != NULL;
- a = attrs_find( a->a_next, ava->aa_desc )) {
- rc = LDAP_COMPARE_FALSE;
+ a = attrs_find( a->a_next, op->oq_compare.rs_ava->aa_desc )) {
+ rs->sr_err = LDAP_COMPARE_FALSE;
#ifdef SLAP_NVALUES
- if ( value_find_ex( ava->aa_desc,
- SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
- a->a_nvals, &ava->aa_value ) == 0 )
+ 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 ) == 0 )
#else
- if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
+ if ( value_find( ava->aa_desc, a->a_vals,
+ &op->oq_compare.rs_ava->aa_value ) == 0 )
#endif
{
- rc = LDAP_COMPARE_TRUE;
+ rs->sr_err = LDAP_COMPARE_TRUE;
break;
}
}
- send_ldap_result( conn, op, rc, NULL, NULL, NULL, NULL );
-
- if( rc != LDAP_NO_SUCH_ATTRIBUTE ) {
- rc = 0;
- }
-
return_results:;
+ send_ldap_result( op, rs );
+ if ( rs->sr_err == LDAP_COMPARE_FALSE
+ || rs->sr_err == LDAP_COMPARE_TRUE ) {
+ rs->sr_err = LDAP_SUCCESS;
+ }
+
monitor_cache_release( mi, e );
- return( rc );
+ return( rs->sr_err );
}
}
int
-monitor_back_search(
+monitor_back_search( Operation *op, SlapReply *rs )
+ /*
Backend *be,
Connection *conn,
Operation *op,
Filter *filter,
struct berval *filterstr,
AttributeName *attrs,
- int attrsonly
-)
+ int attrsonly
+ */
{
- struct monitorinfo *mi = (struct monitorinfo *) be->be_private;
+ struct monitorinfo *mi
+ = (struct monitorinfo *) op->o_bd->be_private;
int rc = LDAP_SUCCESS;
Entry *e, *matched = NULL;
int nentries = 0;
/* get entry with reader lock */
- monitor_cache_dn2entry( mi, nbase, &e, &matched );
+ monitor_cache_dn2entry( mi, &op->o_req_ndn, &e, &matched );
if ( e == NULL ) {
- send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT,
- matched ? matched->e_dn : NULL,
- NULL, NULL, NULL );
+ rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( matched ) {
+ rs->sr_matched = ch_strdup( matched->e_dn );
monitor_cache_release( mi, matched );
}
- return( rc );
+ send_ldap_result( op, rs );
+ rs->sr_matched = NULL;
+
+ return( 0 );
}
nentries = 0;