From efe74fbae0a4161c85b47de810ce3a0672f4633c Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 19 Jul 2005 11:16:24 +0000 Subject: [PATCH] fix yet another leak --- servers/slapd/back-meta/bind.c | 13 ++++++++----- servers/slapd/back-meta/conn.c | 22 +++++++++++----------- servers/slapd/back-meta/unbind.c | 2 -- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index a3d67e4595..23b85e3f06 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -276,9 +276,10 @@ retry_lock:; msc->msc_ld = NULL; msc->msc_bound = 0; - /* mc here must be the regular mc, reset and ready for init */ - rc = meta_back_init_one_conn( op, rs, mt, msc, - LDAP_BACK_DONTSEND ); + /* mc here must be the regular mc, + * reset and ready for init */ + rc = meta_back_init_one_conn( op, rs, + mt, msc, LDAP_BACK_DONTSEND ); } else { /* can't do anything about it */ @@ -448,8 +449,10 @@ retry_lock:; msc->msc_ld = NULL; msc->msc_bound = 0; - /* mc here must be the regular mc, reset and ready for init */ - rc = meta_back_init_one_conn( op, rs, mt, msc, LDAP_BACK_DONTSEND ); + /* mc here must be the regular mc, + * reset and ready for init */ + rc = meta_back_init_one_conn( op, rs, + mt, msc, LDAP_BACK_DONTSEND ); } else { diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index 36fdc72a46..d31363de56 100644 --- a/servers/slapd/back-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -217,8 +217,7 @@ meta_back_init_one_conn( * Already init'ed */ if ( msc->msc_ld != NULL ) { - rs->sr_err = LDAP_SUCCESS; - goto error_return; + return rs->sr_err = LDAP_SUCCESS; } /* @@ -242,14 +241,14 @@ meta_back_init_one_conn( } #ifdef HAVE_TLS - /* start TLS ("start-tls"/"try-start-tls" statements) */ + /* start TLS ("tls [try-]{start|propagate}" statement) */ if ( ( LDAP_BACK_USE_TLS( mi ) || ( op->o_conn->c_is_tls && LDAP_BACK_PROPAGATE_TLS( mi ) ) ) && !ldap_is_ldaps_url( mt->mt_uri ) ) { #ifdef SLAP_STARTTLS_ASYNCHRONOUS /* - * use asynchronous StartTLS - * in case, chase referral (not implemented yet) + * use asynchronous StartTLS; in case, chase referral + * FIXME: OpenLDAP does not return referral on StartTLS yet */ int msgid; @@ -345,11 +344,6 @@ retry:; (void *)&network_timeout ); } - /* - * Sets a cookie for the rewrite session - */ - ( void )rewrite_session_init( mt->mt_rwmap.rwm_rw, op->o_conn ); - /* * If the connection DN is not null, an attempt to rewrite it is made */ @@ -382,7 +376,13 @@ retry:; msc->msc_bound = META_UNBOUND; error_return:; - if ( rs->sr_err != LDAP_SUCCESS ) { + if ( rs->sr_err == LDAP_SUCCESS ) { + /* + * Sets a cookie for the rewrite session + */ + ( void )rewrite_session_init( mt->mt_rwmap.rwm_rw, op->o_conn ); + + } else { rs->sr_err = slap_map_api2result( rs ); if ( sendok & LDAP_BACK_SENDERR ) { send_ldap_result( op, rs ); diff --git a/servers/slapd/back-meta/unbind.c b/servers/slapd/back-meta/unbind.c index aedf29a5a6..e3d8a60421 100644 --- a/servers/slapd/back-meta/unbind.c +++ b/servers/slapd/back-meta/unbind.c @@ -90,8 +90,6 @@ retry_lock:; rewrite_session_delete( mi->mi_targets[ i ].mt_rwmap.rwm_rw, conn ); } - /* no response to unbind */ - return 0; } -- 2.39.5