From ab0c09385647073ba0c11c88f82f6c309a266cda Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Tue, 2 Sep 2008 22:46:10 +0000 Subject: [PATCH] ITS#5601 --- CHANGES | 1 + servers/slapd/backover.c | 21 +++++++++++++++++++++ servers/slapd/overlays/rwm.c | 11 ++++++++++- servers/slapd/proto-slap.h | 3 +++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 4b86a70969..ad6e1f5dec 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ OpenLDAP 2.4 Change Log OpenLDAP 2.4.12 Engineering Fixed slapo-constraint string termination (ITS#5609) + Fixed slapo-rwm callback cleanup (ITS#5601) OpenLDAP 2.4.11 Release (2008/07/16) Fixed liblber ber_get_next length decoding (ITS#5580) diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 6855246ece..2f23fb0d19 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -597,6 +597,27 @@ over_acl_attribute( return rc; } +int +overlay_callback_after_backover( Operation *op, slap_callback *sc, int append ) +{ + slap_callback **scp; + + for ( scp = &op->o_callback; *scp != NULL; scp = &(*scp)->sc_next ) { + if ( (*scp)->sc_response == over_back_response ) { + sc->sc_next = (*scp)->sc_next; + (*scp)->sc_next = sc; + return 0; + } + } + + if ( append ) { + *scp = sc; + return 0; + } + + return 1; +} + /* * default return code in case of missing backend function * and overlay stack returning SLAP_CB_CONTINUE diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 5275aa57a5..49ad6fd636 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -104,6 +104,15 @@ rwm_op_cleanup( Operation *op, SlapReply *rs ) op->ore_reqdata = ros->ore_reqdata; } break; + case LDAP_REQ_BIND: + if ( rs->sr_err == LDAP_SUCCESS ) { +#if 0 + /* too late, conn_mutex released */ + ber_bvreplace( &op->o_conn->c_ndn, + &op->o_req_ndn ); +#endif + } + break; default: break; } op->o_callback = op->o_callback->sc_next; @@ -354,7 +363,7 @@ rwm_op_bind( Operation *op, SlapReply *rs ) return -1; } - op->o_callback = &roc->cb; + overlay_callback_after_backover( op, &roc->cb, 1 ); return SLAP_CB_CONTINUE; } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index db339ac0c0..ea22921999 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -473,6 +473,9 @@ LDAP_SLAPD_F (void) overlay_move LDAP_P(( LDAP_SLAPD_F (void) overlay_remove LDAP_P(( BackendDB *be, slap_overinst *on )); #endif /* SLAP_CONFIG_DELETE */ +LDAP_SLAPD_F (int) overlay_callback_after_backover LDAP_P(( + Operation *op, slap_callback *sc, int append )); + /* * bconfig.c */ -- 2.39.5