#include "proto-back-monitor.h"
int
-monitor_back_modify(
- Backend *be,
- Connection *conn,
- Operation *op,
- struct berval *dn,
- struct berval *ndn,
- Modifications *modlist
-)
+monitor_back_modify( Operation *op, SlapReply *rs )
+ /*
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ Modifications *modlist
+ */
{
- int rc = 0;
- struct monitorinfo *mi = (struct monitorinfo *) be->be_private;
- Entry *matched;
- Entry *e;
+ int rc = 0;
+ struct monitorinfo *mi
+ = (struct monitorinfo *) op->o_bd->be_private;
+ Entry *matched;
+ Entry *e;
#ifdef NEW_LOGGING
- LDAP_LOG( BACK_MON, ENTRY,
- "monitor_back_modify: enter\n", 0, 0, 0 );
+ LDAP_LOG( BACK_MON, ENTRY, "monitor_back_modify: enter\n", 0, 0, 0 );
#else
Debug(LDAP_DEBUG_ARGS, "monitor_back_modify:\n", 0, 0, 0);
#endif
/* acquire and lock entry */
- 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 );
+ rs->sr_err = LDAP_NO_SUCH_OBJECT;
+ if ( matched ) {
+ rs->sr_matched = ch_strdup( matched->e_dn );
+ }
+ send_ldap_result( op, rs );
if ( matched != NULL ) {
+ rs->sr_matched = NULL;
monitor_cache_release( mi, matched );
return( 0 );
}
}
- if ( !acl_check_modlist( be, conn, op, e, modlist )) {
+ if ( !acl_check_modlist( op, e, op->oq_modify.rs_modlist )) {
rc = LDAP_INSUFFICIENT_ACCESS;
} else {
- rc = monitor_entry_modify( mi, e, modlist );
+ rc = monitor_entry_modify( mi, e, op->oq_modify.rs_modlist );
}
- send_ldap_result( conn, op, rc, NULL, NULL, NULL, NULL );
+ rs->sr_err = rc;
+ send_ldap_result( op, rs );
monitor_cache_release( mi, e );
static int
monitor_send_children(
+ /*
Backend *be,
Connection *conn,
Operation *op,
Filter *filter,
AttributeName *attrs,
int attrsonly,
+ */
+ Operation *op,
+ SlapReply *rs,
Entry *e_parent,
int sub,
int *nentriesp
)
{
- struct monitorinfo *mi = (struct monitorinfo *) be->be_private;
+ struct monitorinfo *mi =
+ (struct monitorinfo *) op->o_bd->be_private;
Entry *e, *e_tmp, *e_ch;
struct monitorentrypriv *mp;
int nentries;
monitor_entry_update( mi, e );
- rc = test_filter( be, conn, op, e, filter );
+ rc = test_filter( op, e, op->oq_search.rs_filter );
if ( rc == LDAP_COMPARE_TRUE ) {
- send_search_entry( be, conn, op, e,
- attrs, attrsonly, NULL );
+ rs->sr_entry = e;
+ send_search_entry( op, rs );
nentries++;
}
if ( ( mp->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
&& sub ) {
- rc = monitor_send_children( be, conn, op, filter,
- attrs, attrsonly,
- e, sub, &nentries );
+ rc = monitor_send_children( op, rs, e, sub, &nentries );
if ( rc ) {
return( rc );
}
int
monitor_back_search( Operation *op, SlapReply *rs )
- /*
- Backend *be,
- Connection *conn,
- Operation *op,
- struct berval *base,
- struct berval *nbase,
- int scope,
- int deref,
- int slimit,
- int tlimit,
- Filter *filter,
- struct berval *filterstr,
- AttributeName *attrs,
- int attrsonly
- */
{
struct monitorinfo *mi
= (struct monitorinfo *) op->o_bd->be_private;
}
nentries = 0;
- switch ( scope ) {
+ switch ( op->oq_search.rs_scope ) {
case LDAP_SCOPE_BASE:
monitor_entry_update( mi, e );
- rc = test_filter( be, conn, op, e, filter );
- if ( rc == LDAP_COMPARE_TRUE ) {
- send_search_entry( be, conn, op, e, attrs,
- attrsonly, NULL );
+ rc = test_filter( op, e, op->oq_search.rs_filter );
+ if ( rc == LDAP_COMPARE_TRUE ) {
+ rs->sr_entry = e;
+ send_search_entry( op, rs );
nentries = 1;
}
rc = LDAP_SUCCESS;
break;
case LDAP_SCOPE_ONELEVEL:
- rc = monitor_send_children( be, conn, op, filter,
- attrs, attrsonly,
- e, 0, &nentries );
+ rc = monitor_send_children( op, rs, e, 0, &nentries );
if ( rc ) {
rc = LDAP_OTHER;
- }
+ }
break;
case LDAP_SCOPE_SUBTREE:
monitor_entry_update( mi, e );
- rc = test_filter( be, conn, op, e, filter );
+ rc = test_filter( op, e, op->oq_search.rs_filter );
if ( rc == LDAP_COMPARE_TRUE ) {
- send_search_entry( be, conn, op, e, attrs,
- attrsonly, NULL );
+ send_search_entry( op, rs );
nentries++;
}
- rc = monitor_send_children( be, conn, op, filter,
- attrs, attrsonly,
- e, 1, &nentries );
+ rc = monitor_send_children( op, rs, e, 1, &nentries );
if ( rc ) {
rc = LDAP_OTHER;
}
break;
}
- send_search_result( conn, op, rc,
- NULL, NULL, NULL, NULL, nentries );
+ rs->sr_nentries = nentries;
+ rs->sr_err = rc;
+ send_search_result( op, rs );
return( rc == LDAP_SUCCESS ? 0 : 1 );
}
+