]> granicus.if.org Git - apache/commitdiff
if the call to ldap_simple_bind_s() fails, the connection is left in an unbound state...
authorBradley Nicholes <bnicholes@apache.org>
Thu, 13 May 2004 14:29:11 +0000 (14:29 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Thu, 13 May 2004 14:29:11 +0000 (14:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103678 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/util_ldap.c

index 0fc8b533b8f86a6bbba160dc494247a080ec2395..7b57c26b31e620de495455e937c9b0ee96e54af7 100644 (file)
@@ -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 {