- if ( !found ) {
-#ifdef LDAP_SYNC
- for ( i = 0; i < nbackends; i++ ) {
- if ( strncmp( backends[i].be_type, "bdb", 3 ) ) continue;
- ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
- if ( bdb_cancel( &backends[i], conn, opid ) == LDAP_SUCCESS ) {
- return LDAP_SUCCESS;
- } else {
- *text = "message ID not found";
- return LDAP_NO_SUCH_OPERATION;
- }
- }
-#else
- *text = "message ID not found";
- ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
- return LDAP_NO_SUCH_OPERATION;
+ 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;