From: Howard Chu Date: Tue, 19 May 2015 14:37:24 +0000 (+0100) Subject: ITS#8142 drop client connection on remote failure X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=117edd79ce539756495032120063bce68f590ada;p=openldap ITS#8142 drop client connection on remote failure also cleanup of return-code handling --- diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index ccaefca207..d336dbb723 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -1573,6 +1573,7 @@ retry:; op->o_tag = o_tag; rs->sr_text = "Proxy can't contact remote server"; send_ldap_result( op, rs ); + rs->sr_err = SLAPD_DISCONNECT; } rc = 0; diff --git a/servers/slapd/back-ldap/delete.c b/servers/slapd/back-ldap/delete.c index be3053b59e..06e39f51d5 100644 --- a/servers/slapd/back-ldap/delete.c +++ b/servers/slapd/back-ldap/delete.c @@ -53,7 +53,6 @@ retry: rc = ldap_back_controls_add( op, rs, lc, &ctrls ); if ( rc != LDAP_SUCCESS ) { send_ldap_result( op, rs ); - rc = rs->sr_err; goto cleanup; } @@ -82,5 +81,5 @@ cleanup: ldap_back_release_conn( li, lc ); } - return rc; + return rs->sr_err; } diff --git a/servers/slapd/back-ldap/modify.c b/servers/slapd/back-ldap/modify.c index 50cc5ea8ec..d9de25054d 100644 --- a/servers/slapd/back-ldap/modify.c +++ b/servers/slapd/back-ldap/modify.c @@ -98,7 +98,6 @@ retry:; rc = ldap_back_controls_add( op, rs, lc, &ctrls ); if ( rc != LDAP_SUCCESS ) { send_ldap_result( op, rs ); - rc = -1; goto cleanup; } @@ -132,6 +131,6 @@ cleanup:; ldap_back_release_conn( li, lc ); } - return rc; + return rs->sr_err; } diff --git a/servers/slapd/back-ldap/modrdn.c b/servers/slapd/back-ldap/modrdn.c index ecbb6b8b8b..87f8a6847c 100644 --- a/servers/slapd/back-ldap/modrdn.c +++ b/servers/slapd/back-ldap/modrdn.c @@ -85,7 +85,6 @@ retry: rc = ldap_back_controls_add( op, rs, lc, &ctrls ); if ( rc != LDAP_SUCCESS ) { send_ldap_result( op, rs ); - rc = -1; goto cleanup; } @@ -119,6 +118,6 @@ cleanup: ldap_back_release_conn( li, lc ); } - return rc; + return rs->sr_err; } diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 41cb685e18..3a08b96851 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -645,6 +645,8 @@ finish:; ldap_back_release_conn( li, lc ); } + if ( rs->sr_err == LDAP_UNAVAILABLE ) + rs->sr_err = SLAPD_DISCONNECT; return rs->sr_err; }