Re: [exim-dev] [Bug 1375] Rebinding to existing ldap-connect…

Top Page
Delete this message
Reply to this message
Author: Todd Lyons
Date:  
To: 1375
CC: exim-dev
Subject: Re: [exim-dev] [Bug 1375] Rebinding to existing ldap-connection with starttls
On Fri, Aug 2, 2013 at 2:23 AM, Alexander Miroch
<miroch.alexander@???> wrote:
> http://bugs.exim.org/show_bug.cgi?id=1375
> +  int is_start_tls_called;
> +  lcp->is_start_tls_called = 0;
> -  if (eldap_start_tls)
> +  if (eldap_start_tls && !lcp->is_start_tls_called)
> +
> +       lcp->is_start_tls_called = 1;


Does anybody have any comment on this? I've converted his patch to
use BOOL instead of int. It builds with no errors, but I don't have
an infrastructure to test it. If Alexander and then commit it if
there are no objections. The diff looks like this:

diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c
index 40345ba..d9d7e3d 100644
--- a/src/src/lookups/ldap.c
+++ b/src/src/lookups/ldap.c
@@ -82,6 +82,7 @@ typedef struct ldap_connection {
BOOL bound;
int port;
LDAP *ld;
+ BOOL is_start_tls_called;
} LDAP_CONNECTION;

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

@@ -519,7 +521,7 @@ if (!lcp->bound ||
   {
   DEBUG(D_lookup) debug_printf("%sbinding with user=%s password=%s\n",
     (lcp->bound)? "re-" : "", user, password);
-  if (eldap_start_tls)
+  if (eldap_start_tls && !lcp->is_start_tls_called)
     {
 #if defined(LDAP_OPT_X_TLS) && !defined(LDAP_LIB_SOLARIS)
     /* The Oracle LDAP libraries (LDAP_LIB_TYPE=SOLARIS) don't support this.
@@ -533,6 +535,7 @@ if (!lcp->bound ||
           " %s", host, porttext, rc, ldap_err2string(rc));
       goto RETURN_ERROR;
       }
+    lcp->is_start_tls_called = TRUE;
 #else
     DEBUG(D_lookup)
       debug_printf("TLS initiation not supported with this Exim and
your LDAP library.\n");



...Todd
--
The total budget at all receivers for solving senders' problems is $0.
If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine