#include "slap.h"
+#ifdef LDAP_EXOP_X_CANCEL
+
#include <lber_pvt.h>
#include <lutil.h>
int cancel_extop(
Connection *conn,
Operation *op,
- const char *reqoid,
+ struct berval *reqoid,
struct berval *reqdata,
char **rspoid,
struct berval **rspdata,
int found = 0;
int opid;
BerElement *ber;
+ int i;
assert( reqoid != NULL );
- assert( strcmp( LDAP_EXOP_X_CANCEL, reqoid ) == 0 );
+ assert( ber_bvcmp( &slap_EXOP_CANCEL, reqoid ) == 0 );
if ( reqdata == NULL ) {
*text = "no message ID supplied";
}
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
- if ( found )
- return LDAP_SUCCESS;
+ if ( found ) return LDAP_SUCCESS;
found = 0;
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
}
if ( !found ) {
- *text = "message ID not found";
+#ifdef LDAP_SYNC
+ for ( i = 0; i < nbackends; i++ ) {
+ Backend *be = &backends[i];
+ if( !be->be_cancel ) continue;
+
+ ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+
+ if ( be->be_cancel( be, conn, op, opid ) == LDAP_SUCCESS ) {
+ return LDAP_SUCCESS;
+ } else {
+ *text = "message ID not found";
+ return LDAP_NO_SUCH_OPERATION;
+ }
+ }
+#else
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
- return LDAP_NO_SUCH_OPERATION;
+ *text = "message ID not found";
+ return LDAP_NO_SUCH_OPERATION;
+#endif
}
- if ( op->o_cancel != LDAP_CANCEL_NONE ) {
- *text = "message ID already being cancelled";
+ if ( op->o_cancel != SLAP_CANCEL_NONE ) {
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+ *text = "message ID already being cancelled";
return LDAP_PROTOCOL_ERROR;
}
- op->o_cancel = LDAP_CANCEL_REQ;
+ op->o_cancel = SLAP_CANCEL_REQ;
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
- while ( op->o_cancel == LDAP_CANCEL_REQ ) {
+ while ( op->o_cancel == SLAP_CANCEL_REQ ) {
ldap_pvt_thread_yield();
}
- if ( op->o_cancel == LDAP_CANCEL_ACK ) {
+ if ( op->o_cancel == SLAP_CANCEL_ACK ) {
rc = LDAP_SUCCESS;
} else {
rc = op->o_cancel;
}
- op->o_cancel = LDAP_CANCEL_DONE;
+ op->o_cancel = SLAP_CANCEL_DONE;
return rc;
}
+
+#endif /* LDAP_EXOP_X_CANCEL */