]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/backover.c
Happy New Year
[openldap] / servers / slapd / backover.c
index 2109d429c26871de5c6316fe36a330e5eca995f6..b5a44ea459b5e7e9f3f85b461b7dd0328d1d4aa9 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2013 The OpenLDAP Foundation.
+ * Copyright 2003-2018 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -665,8 +665,14 @@ int overlay_op_walk(
        if ( rc == SLAP_CB_BYPASS )
                rc = SLAP_CB_CONTINUE;
 
+       /* if an overlay halted processing, make sure
+        * any previously set cleanup handlers are run
+        */
+       if ( rc != SLAP_CB_CONTINUE )
+               goto cleanup;
+
        func = &oi->oi_orig->bi_op_bind;
-       if ( func[which] && rc == SLAP_CB_CONTINUE ) {
+       if ( func[which] ) {
                op->o_bd->bd_info = oi->oi_orig;
                rc = func[which]( op, rs );
        }
@@ -680,6 +686,7 @@ int overlay_op_walk(
         */
        if ( rc == LDAP_UNWILLING_TO_PERFORM ) {
                slap_callback *sc_next;
+cleanup:
                for ( ; op->o_callback && op->o_callback->sc_response !=
                        over_back_response; op->o_callback = sc_next ) {
                        sc_next = op->o_callback->sc_next;
@@ -1212,6 +1219,7 @@ overlay_remove( BackendDB *be, slap_overinst *on, Operation *op )
        rm_cb->sc_cleanup = overlay_remove_cb;
        rm_cb->sc_response = NULL;
        rm_cb->sc_private = (void*) rm_ctx;
+       rm_cb->sc_writewait = NULL;
 
        /* Append callback to the end of the list */
        if ( !op->o_callback ) {