]> git.sur5r.net Git - openldap/commitdiff
don't try to send results on abandon (ITS#3434)
authorPierangelo Masarati <ando@openldap.org>
Sun, 12 Dec 2004 23:23:00 +0000 (23:23 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 12 Dec 2004 23:23:00 +0000 (23:23 +0000)
servers/slapd/back-relay/init.c
servers/slapd/back-relay/op.c

index 290085afbc5ae49390e6daa044044d148f69447e..0692a15fb3649eb3d5f3890da446ae1b107edb7a 100644 (file)
@@ -50,9 +50,7 @@ relay_back_initialize( BackendInfo *bi )
        bi->bi_op_modrdn = relay_back_op_modrdn;
        bi->bi_op_add = relay_back_op_add;
        bi->bi_op_delete = relay_back_op_delete;
-#if 0  /* causes a deadlock */
        bi->bi_op_abandon = relay_back_op_abandon;
-#endif
        bi->bi_op_cancel = relay_back_op_cancel;
        bi->bi_extended = relay_back_op_extended;
        bi->bi_entry_release_rw = relay_back_entry_release_rw;
index 669da91f49d5e57e1295d549c9da852e34b642a8..4b6912ee7ae5090817b6f65f9f777b449b603e98 100644 (file)
@@ -47,6 +47,13 @@ relay_back_add_cb( slap_callback *cb, struct slap_op *op )
        op->o_callback = cb;
 }
 
+/*
+ * selects the backend if not enforced at config;
+ * in case of failure, behaves based on err:
+ *     -1                      don't send result
+ *     LDAP_SUCCESS            don't send result; may send referral
+ *     any valid error         send as error result
+ */
 static BackendDB *
 relay_back_select_backend( struct slap_op *op, struct slap_rep *rs, int err )
 {
@@ -56,16 +63,16 @@ relay_back_select_backend( struct slap_op *op, struct slap_rep *rs, int err )
        if ( bd == NULL ) {
                bd = select_backend( &op->o_req_ndn, 0, 1 );
                if ( bd == op->o_bd ) {
-                       if ( err != LDAP_SUCCESS ) {
+                       if ( err > LDAP_SUCCESS ) {
                                send_ldap_error( op, rs,
                                                LDAP_UNWILLING_TO_PERFORM, 
-                                               "would call self" );
+                                               "back-relay would call self" );
                        }
                        return NULL;
                }
        }
 
-       if ( bd == NULL ) {
+       if ( bd == NULL && err > -1 ) {
                if ( default_referral ) {
                        rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
@@ -368,7 +375,7 @@ relay_back_op_abandon( struct slap_op *op, struct slap_rep *rs )
        BackendDB               *bd;
        int                     rc = 1;
 
-       bd = relay_back_select_backend( op, rs, LDAP_NO_SUCH_OBJECT );
+       bd = relay_back_select_backend( op, rs, -1 );
        if ( bd == NULL ) {
                return 1;
        }
@@ -386,11 +393,6 @@ relay_back_op_abandon( struct slap_op *op, struct slap_rep *rs )
                if ( op->o_callback == &cb ) {
                        op->o_callback = op->o_callback->sc_next;
                }
-
-       } else {
-               send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
-                               "operation not supported "
-                               "within naming context" );
        }
 
        return rc;