On Thu, 22 Jul 2004, Philip Hazel wrote:
> Thank you for diagnosing the problem so completely. I agree that it is a
> serious bug. I will try to get an emergency 4.41 release with only one
> change - a fix for this bug - out today if I can. Unfortunately, I lam
> going away from lunchtime tomorrow.
Having looked at the code, I think that the bug is just that some code
got moved to the wrong place. I have made the following patch for the
proposed 4.41 release. If anybody who is hitting the problem can test it
quickly - in the next 6 hours or so - I would be grateful.
Regards,
Philip
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.
*** exim-4.40/src/daemon.c Fri Jul 9 11:19:58 2004
--- daemon.c Thu Jul 22 09:17:11 2004
***************
*** 156,161 ****
--- 156,188 ----
DEBUG(D_any) debug_printf("Connection request from %s port %d\n",
sender_host_address, sender_host_port);
+ /* Set up the output stream, check the socket has duplicated, and set up the
+ input stream. These operations fail only the exceptional circumstances. Note
+ that never_error() won't use smtp_out if it is NULL. */
+
+ smtp_out = fdopen(accept_socket, "wb");
+ if (smtp_out == NULL)
+ {
+ never_error(US"daemon: fdopen() for smtp_out failed", US"", errno);
+ goto ERROR_RETURN;
+ }
+
+ dup_accept_socket = dup(accept_socket);
+ if (dup_accept_socket < 0)
+ {
+ never_error(US"daemon: couldn't dup socket descriptor",
+ US"Connection setup failed", errno);
+ goto ERROR_RETURN;
+ }
+
+ smtp_in = fdopen(dup_accept_socket, "rb");
+ if (smtp_in == NULL)
+ {
+ never_error(US"daemon: fdopen() for smtp_in failed",
+ US"Connection setup failed", errno);
+ goto ERROR_RETURN;
+ }
+
/* Get the data for the local interface address. */
if (getsockname(accept_socket, (struct sockaddr *)(&interface_sockaddr),
***************
*** 187,219 ****
whofrom[wfptr] = 0; /* Terminate the newly-built string */
- /* Set up the output stream, check the socket has duplicated, and set up the
- input stream. These operations fail only the exceptional circumstances. Note
- that never_error() won't use smtp_out if it is NULL. */
-
- smtp_out = fdopen(accept_socket, "wb");
- if (smtp_out == NULL)
- {
- never_error(US"daemon: fdopen() for smtp_out failed", US"", errno);
- goto ERROR_RETURN;
- }
-
- dup_accept_socket = dup(accept_socket);
- if (dup_accept_socket < 0)
- {
- never_error(US"daemon: couldn't dup socket descriptor",
- US"Connection setup failed", errno);
- goto ERROR_RETURN;
- }
-
- smtp_in = fdopen(dup_accept_socket, "rb");
- if (smtp_in == NULL)
- {
- never_error(US"daemon: fdopen() for smtp_in failed",
- US"Connection setup failed", errno);
- goto ERROR_RETURN;
- }
-
/* Check maximum number of connections. We do not check for reserved
connections or unacceptable hosts here. That is done in the subprocess because
it might take some time. */
--- 214,219 ----