]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/retcode.c
check for ee == NULL
[openldap] / servers / slapd / overlays / retcode.c
index 4c8af8898695bcc2e7c3cb3509c6e1f9ccb2da3f..e7639befa832952fb013629c4acfc3d3f8519a67 100644 (file)
@@ -31,6 +31,7 @@
 #include <ac/socket.h>
 
 #include "slap.h"
+#include "config.h"
 #include "lutil.h"
 #include "ldif.h"
 
@@ -202,11 +203,11 @@ retcode_cb_response( Operation *op, SlapReply *rs )
 {
        retcode_cb_t    *rdc = (retcode_cb_t *)op->o_callback->sc_private;
 
+       op->o_tag = rdc->rdc_tag;
        if ( rs->sr_type == REP_SEARCH ) {
                ber_tag_t       o_tag = op->o_tag;
                int             rc;
 
-               op->o_tag = rdc->rdc_tag;
                if ( op->o_tag == LDAP_REQ_SEARCH ) {
                        rs->sr_attrs = rdc->rdc_attrs;
                }
@@ -216,7 +217,11 @@ retcode_cb_response( Operation *op, SlapReply *rs )
                return rc;
        }
 
-       if ( rs->sr_err == LDAP_SUCCESS ) {
+       switch ( rs->sr_err ) {
+       case LDAP_SUCCESS:
+       case LDAP_NO_SUCH_OBJECT:
+               /* in case of noSuchObject, stop the internal search
+                * for in-directory error stuff */
                if ( !op->o_abandon ) {
                        rdc->rdc_flags = SLAP_CB_CONTINUE;
                }
@@ -300,8 +305,9 @@ retcode_op_func( Operation *op, SlapReply *rs )
 
                        case LDAP_REQ_BIND:
                                /* skip if rootdn */
+                               /* FIXME: better give the db a chance? */
                                if ( be_isroot_pw( op ) ) {
-                                       return SLAP_CB_CONTINUE;
+                                       return LDAP_SUCCESS;
                                }
                                return retcode_op_internal( op, rs );
 
@@ -721,7 +727,7 @@ retcode_response( Operation *op, SlapReply *rs )
 }
 
 static int
-retcode_db_init( BackendDB *be )
+retcode_db_init( BackendDB *be, ConfigReply *cr )
 {
        slap_overinst   *on = (slap_overinst *)be->bd_info;
        retcode_t       *rd;
@@ -1083,7 +1089,7 @@ retcode_db_config(
 }
 
 static int
-retcode_db_open( BackendDB *be )
+retcode_db_open( BackendDB *be, ConfigReply *cr)
 {
        slap_overinst   *on = (slap_overinst *)be->bd_info;
        retcode_t       *rd = (retcode_t *)on->on_bi.bi_private;
@@ -1207,7 +1213,7 @@ retcode_db_open( BackendDB *be )
 }
 
 static int
-retcode_db_destroy( BackendDB *be )
+retcode_db_destroy( BackendDB *be, ConfigReply *cr )
 {
        slap_overinst   *on = (slap_overinst *)be->bd_info;
        retcode_t       *rd = (retcode_t *)on->on_bi.bi_private;
@@ -1367,6 +1373,8 @@ retcode_initialize( void )
                                "retcode: register_at failed\n", 0, 0, 0 );
                        return code;
                }
+
+               (*retcode_at[ i ].ad)->ad_type->sat_flags |= SLAP_AT_HIDE;
        }
 
        for ( i = 0; retcode_oc[ i ].desc != NULL; i++ ) {
@@ -1376,6 +1384,8 @@ retcode_initialize( void )
                                "retcode: register_oc failed\n", 0, 0, 0 );
                        return code;
                }
+
+               (*retcode_oc[ i ].oc)->soc_flags |= SLAP_OC_HIDE;
        }
 
        retcode.on_bi.bi_type = "retcode";