From 06bc34ae0cbe877b13b4a38d6509fce01b614b1e Mon Sep 17 00:00:00 2001 From: Bradley Nicholes Date: Thu, 13 May 2004 14:29:11 +0000 Subject: [PATCH] if the call to ldap_simple_bind_s() fails, the connection is left in an unbound state. Make sure that the connection record is updated to show the current state. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103678 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/util_ldap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/experimental/util_ldap.c b/modules/experimental/util_ldap.c index 0fc8b533b8..7b57c26b31 100644 --- a/modules/experimental/util_ldap.c +++ b/modules/experimental/util_ldap.c @@ -333,9 +333,6 @@ LDAP_DECLARE(int) util_ldap_connection_open(request_rec *r, break; } - ldc->bound = 1; - ldc->reason = "LDAP: connection open successful"; - /* free the handle if there was an error */ if (LDAP_SUCCESS != result) @@ -345,6 +342,10 @@ LDAP_DECLARE(int) util_ldap_connection_open(request_rec *r, ldc->bound = 0; ldc->reason = "LDAP: ldap_simple_bind_s() failed"; } + else { + ldc->bound = 1; + ldc->reason = "LDAP: connection open successful"; + } return(result); } @@ -875,6 +876,9 @@ start_over: if (result != LDAP_SUCCESS) { ldc->reason = "ldap_simple_bind_s() to check user credentials failed"; ldap_msgfree(res); + ldap_unbind_s(ldc->ldap); + ldc->ldap = NULL; + ldc->bound = 0; return result; } else { -- 2.40.0