- if ( !found ) {
-#ifdef LDAP_SYNC
- for ( i = 0; i < nbackends; i++ ) {
- Backend *be = &backends[i];
- if( !be->be_cancel ) continue;
+ if ( o == NULL ) {
+ rc = LDAP_NO_SUCH_OPERATION;
+ rs->sr_text = "message ID not found";
+
+ } else if ( o->o_tag == LDAP_REQ_BIND
+ || o->o_tag == LDAP_REQ_UNBIND
+ || o->o_tag == LDAP_REQ_ABANDON ) {
+ rc = LDAP_CANNOT_CANCEL;
+
+ } else if ( o->o_cancel != SLAP_CANCEL_NONE ) {
+ rc = LDAP_OPERATIONS_ERROR;
+ rs->sr_text = "message ID already being cancelled";
+
+#if 0
+ } else if ( o->o_abandon ) {
+ /* TODO: Would this break something when
+ * o_abandon="suppress response"? (ITS#6138)
+ */
+ rc = LDAP_TOO_LATE;
+#endif
+
+ } else {
+ rc = LDAP_SUCCESS;
+ o->o_cancel = SLAP_CANCEL_REQ;
+ o->o_abandon = 1;
+ }
+
+ out:
+ ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );