]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/backover.c
Updated notices
[openldap] / servers / slapd / backover.c
index 29edb8470c3615e61741752376c611ad166d173a..386a78b422d930a6dd04b2fdb795143d13efbab0 100644 (file)
@@ -1,16 +1,21 @@
 /* backover.c - backend overlay routines */
 /* $OpenLDAP$ */
-/*
- * Copyright 2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- */
-
-/*
- * Functions to overlay other modules over a backend.
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2003 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
  *
- *  -- Howard Chu
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
 
+/* Functions to overlay other modules over a backend. */
+
 #include "portable.h"
 
 #include <stdio.h>
@@ -165,7 +170,7 @@ over_op_func(
        BI_op_bind **func;
        BackendDB *be = op->o_bd, db = *op->o_bd;
        slap_callback cb = {over_back_response, NULL};
-       int rc = 0;
+       int rc = SLAP_CB_CONTINUE;
 
        op->o_bd = &db;
        cb.sc_private = op->o_callback;
@@ -176,16 +181,20 @@ over_op_func(
                if ( func[which] ) {
                        db.bd_info = (BackendInfo *)on;
                        rc = func[which]( op, rs );
-                       if ( rc ) break;
+                       if ( rc != SLAP_CB_CONTINUE ) break;
                }
        }
 
+       op->o_bd = be;
        func = &oi->oi_bd.bd_info->bi_op_bind;
-       if ( func[which] ) {
+       if ( func[which] && rc == SLAP_CB_CONTINUE ) {
                rc = func[which]( op, rs );
        }
-
-       op->o_bd = be;
+       /* should not fall thru this far without anything happening... */
+       if ( rc == SLAP_CB_CONTINUE ) {
+               rc = LDAP_UNWILLING_TO_PERFORM;
+       }
+       op->o_callback = cb.sc_private;
        return rc;
 }
 
@@ -321,7 +330,7 @@ overlay_config( BackendDB *be, const char *ov )
         */
        oi = (slap_overinfo *) be->bd_info;
        for ( prev=NULL, on2 = oi->oi_list; on2; prev=on2, on2=on2->on_next );
-       on2 = ch_malloc( sizeof(slap_overinst) );
+       on2 = ch_calloc( 1, sizeof(slap_overinst) );
        if ( !prev ) {
                oi->oi_list = on2;
        } else {
@@ -329,6 +338,7 @@ overlay_config( BackendDB *be, const char *ov )
        }
        *on2 = *on;
        on2->on_next = NULL;
+       on2->on_info = oi;
 
        /* Any initialization needed? */
        if ( on->on_bi.bi_db_init ) {