[Exim] Exim4.01 Bug: LDAP connection pool reuse fails

Top Page
Delete this message
Reply to this message
Author: Jason Stratford
Date:  
To: exim-users
Subject: [Exim] Exim4.01 Bug: LDAP connection pool reuse fails
Hi,

My setup for exim4 uses LDAP lookups for users home directories as well
as other account details.

The problem is that when sending a message to one user that is CC'd to
another in the same domain, the first message gets delivered, but the
second one is deferred due to a failed LDAP lookup during the delivery
phase.
I have tracked this down to the search_tidyup() function being called at
the end of the delivery fork code, which appears to be clearing the
connection to the LDAP before the second delivery has finished using it,
but _after_ the second delivery has determined that it is using a pooled
connection. Result, second delivery goes bang.

The following patch appears to fix this problem, but I do not have
enough working knowledge of the code yet to know if this breaks
anything, or introduces leaks. For what its worth I think a similar
problem will occur for remote delivery paths as well. Feedback on
validity of this patch welcomed.

Cheers
Jason

--- ../exim-4.01/src/deliver.c    Mon Mar  4 10:03:41 2002
+++ src/deliver.c    Wed Mar 20 16:29:34 2002
@@ -1541,7 +1541,8 @@
   and close the pipe we were writing down before exiting. */


close(pfd[pipe_write]);
- search_tidyup();
+ /* Taken out for the moment as this causes multiple delivery chains
to fail */
+ /* search_tidyup(); */
exit(EXIT_SUCCESS);
}

@@ -2156,6 +2157,9 @@
     if (result == OK) logchar = '-';
     }
   }        /* Loop back for next batch of addresses */
+
+  /* Tidy up search conections here after all deliveries are complete
*/
+  search_tidyup();
 }