]> git.sur5r.net Git - openldap/commitdiff
ITS#6133: Handlers for Abandon, Cancel, connection init/destroy
authorHallvard Furuseth <hallvard@openldap.org>
Thu, 21 May 2009 00:09:30 +0000 (00:09 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Thu, 21 May 2009 00:09:30 +0000 (00:09 +0000)
should not exist.  Catch coredump.  Fix error/result code handling.

servers/slapd/back-relay/init.c
servers/slapd/back-relay/op.c

index 3c8354f026ad9d40081cfcc8d0a1746ea4ac9997..f4d96cd01517d38f52630c3d37c50923f63c8ec4 100644 (file)
@@ -158,20 +158,12 @@ 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;
-       bi->bi_op_abandon = relay_back_op_abandon;
-       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;
        bi->bi_entry_get_rw = relay_back_entry_get_rw;
-#if 0  /* see comment in op.c */
-       bi->bi_chk_referrals = relay_back_chk_referrals;
-#endif
        bi->bi_operational = relay_back_operational;
        bi->bi_has_subordinates = relay_back_has_subordinates;
 
-       bi->bi_connection_init = relay_back_connection_init;
-       bi->bi_connection_destroy = relay_back_connection_destroy;
-
        bi->bi_cf_ocs = relayocs;
 
        return config_register_schema( relaycfg, relayocs );
index 11d20beef7a4d42b63d11c5e0bd69fde72afe23b..d581ecc9fd57444977c3cdfc570697c026d84f8b 100644 (file)
@@ -74,27 +74,21 @@ relay_back_select_backend( Operation *op, SlapReply *rs, slap_mask_t fail_mode )
 
        if ( bd == NULL && !BER_BVISNULL( &op->o_req_ndn ) ) {
                bd = select_backend( &op->o_req_ndn, 1 );
-               if ( bd->be_private == op->o_bd->be_private ) {
+       }
+
+       if ( bd != NULL ) {
+                       if ( bd->be_private != op->o_bd->be_private ) {
+                               return bd;
+                       }
+
                        Debug( LDAP_DEBUG_ANY,
                                "%s: back-relay for DN=\"%s\" would call self.\n",
                                op->o_log_prefix, op->o_req_dn.bv_val, 0 );
-                       if ( fail_mode & RB_ERR ) {
-                               rs->sr_err = rc;
-                               if ( fail_mode & RB_SEND ) {
-                                       send_ldap_result( op, rs );
-                               }
-                       }
-
-                       return NULL;
-               }
-       }
 
-       if ( bd == NULL ) {
-               if ( ( fail_mode & RB_REFERRAL )
-                       && ( fail_mode & RB_SEND )
+       } else if ( ( fail_mode & RB_REFERRAL_SEND ) == RB_REFERRAL_SEND
                        && !BER_BVISNULL( &op->o_req_ndn )
                        && default_referral )
-               {
+       {
                        rs->sr_err = LDAP_REFERRAL;
 
                        /* if we set sr_err to LDAP_REFERRAL,
@@ -114,18 +108,16 @@ relay_back_select_backend( Operation *op, SlapReply *rs, slap_mask_t fail_mode )
                        }
 
                        return NULL;
-               }
+       }
 
-               /* NOTE: err is LDAP_INVALID_CREDENTIALS for bind,
-                * LDAP_NO_SUCH_OBJECT for other operations.
-                * noSuchObject cannot be returned by bind */
+       if ( fail_mode & RB_ERR ) {
                rs->sr_err = rc;
                if ( fail_mode & RB_SEND ) {
                        send_ldap_result( op, rs );
                }
        }
 
-       return bd;
+       return NULL;
 }
 
 static int
@@ -294,6 +286,7 @@ relay_back_op_delete( Operation *op, SlapReply *rs )
                RB_UNSUPPORTED_SEND );
 }
 
+#if 0 /* Should not exist - see ITS#6133 */
 int
 relay_back_op_abandon( Operation *op, SlapReply *rs )
 {
@@ -331,6 +324,7 @@ relay_back_op_cancel( Operation *op, SlapReply *rs )
 
        return rc;
 }
+#endif /*0*/
 
 int
 relay_back_op_extended( Operation *op, SlapReply *rs )
@@ -402,6 +396,7 @@ relay_back_entry_get_rw( Operation *op, struct berval *ndn,
 
 }
 
+#if 0
 /*
  * NOTE: even the existence of this function is questionable: we cannot
  * pass the bi_chk_referrals() call thru the rwm overlay because there
@@ -414,6 +409,7 @@ relay_back_chk_referrals( Operation *op, SlapReply *rs )
 {
        BackendDB               *bd;
 
+       /* FIXME: Can send success on failure. Should send referral or nothing. */
        bd = relay_back_select_backend( op, rs,
                ( LDAP_SUCCESS | RB_ERR_REFERRAL_SEND ) );
        /* FIXME: this test only works if there are no overlays, so
@@ -434,22 +430,22 @@ relay_back_chk_referrals( Operation *op, SlapReply *rs )
 
        return relay_back_op( op, rs, bd, bd->be_chk_referrals, LDAP_SUCCESS );
 }
+#endif /*0*/
 
 int
 relay_back_operational( Operation *op, SlapReply *rs )
 {
        BackendDB               *bd;
 
-       bd = relay_back_select_backend( op, rs,
-               ( LDAP_SUCCESS | RB_ERR ) );
+       bd = relay_back_select_backend( op, rs, LDAP_SUCCESS );
        /* FIXME: this test only works if there are no overlays, so
         * it is nearly useless; if made stricter, no nested back-relays
         * can be instantiated... too bad. */
        if ( bd == NULL || bd == op->o_bd ) {
-               return 0;
+               return LDAP_SUCCESS;
        }
 
-       return relay_back_op( op, rs, bd, bd->be_operational, 0 );
+       return relay_back_op( op, rs, bd, bd->be_operational, LDAP_SUCCESS );
 }
 
 int
@@ -478,6 +474,7 @@ relay_back_has_subordinates( Operation *op, Entry *e, int *hasSubs )
        return rc;
 }
 
+#if 0 /* Should not exist - see ITS#6133 */
 int
 relay_back_connection_init( BackendDB *bd, Connection *c )
 {
@@ -512,6 +509,7 @@ relay_back_connection_destroy( BackendDB *bd, Connection *c )
        return 0;
 
 }
+#endif /*0*/
 
 /*
  * FIXME: must implement tools as well