[exim-dev] [Bug 1375] Rebinding to existing ldap-connection …

Top Page
Delete this message
Reply to this message
Author: Alexander Miroch
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 1375] Rebinding to existing ldap-connection with starttls
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1375




--- Comment #1 from Alexander Miroch <miroch.alexander@???> 2013-08-02 10:23:43 ---
Update:
My guess about ldap_start_tls_s() was right.
I wrote a patch (workaround) that solves the problem for me


--- exim-4.80.1/src/lookups/ldap.c      2012-10-25 07:37:38.000000000 +0400
+++ exim-4.80/src/lookups/ldap.c        2013-08-01 17:08:28.281636173 +0400
@@ -82,6 +82,7 @@
   BOOL  bound;
   int   port;
   LDAP *ld;
+  int is_start_tls_called;
 } LDAP_CONNECTION;


static LDAP_CONNECTION *ldap_connections = NULL;
@@ -493,6 +494,7 @@
lcp->port = port;
lcp->ld = ld;
lcp->next = ldap_connections;
+ lcp->is_start_tls_called = 0;
ldap_connections = lcp;
}

@@ -521,7 +523,7 @@
     (lcp->bound)? "re-" : "", user, password);
 #ifdef LDAP_OPT_X_TLS
   /* The Oracle LDAP libraries (LDAP_LIB_TYPE=SOLARIS) don't support this: */
-  if (eldap_start_tls)
+  if (eldap_start_tls && !lcp->is_start_tls_called)
     {
         if ( (rc = ldap_start_tls_s(lcp->ld, NULL, NULL)) != LDAP_SUCCESS) {
             *errmsg = string_sprintf("failed to initiate TLS processing on an
"
@@ -529,6 +531,8 @@
                 " %s", host, porttext, rc, ldap_err2string(rc));
             goto RETURN_ERROR;
         }
+
+       lcp->is_start_tls_called = 1;
     }
 #endif
   if ((msgid = ldap_bind(lcp->ld, CS user, CS password, LDAP_AUTH_SIMPLE))



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email