From: Jeremy Harris Date: Thu, 6 Apr 2017 21:58:46 +0000 (+0100) Subject: Callout/hold: ensure TLS-proxy process is not waited for as a transport process X-Git-Tag: exim-4_90_RC1~199 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=60272099eb6529d6d748c7dd04412b35c09f37e2;p=exim.git Callout/hold: ensure TLS-proxy process is not waited for as a transport process --- diff --git a/src/src/deliver.c b/src/src/deliver.c index 351a02b0a..139ee8374 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -8469,12 +8469,15 @@ if (cutthrough.fd >= 0 && cutthrough.callout_hold_only) if ((pid = fork()) < 0) goto fail; - else if (pid == 0) /* child */ + else if (pid == 0) /* child: fork again to totally dosconnect */ { + if ((pid = fork())) + _exit(pid ? EXIT_FAILURE : EXIT_SUCCESS); smtp_proxy_tls(big_buffer, big_buffer_size, pfd[0], 5*60); exim_exit(0); } + waitpid(pid, NULL, 0); (void) close(channel_fd); /* release the client socket */ channel_fd = pfd[1]; } diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 4ce839d63..14eb76921 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -3425,14 +3425,17 @@ propagate it from the initial int pid = fork(); if (pid > 0) /* parent */ { + waitpid(pid, NULL, 0); tls_close(FALSE, FALSE); (void)close(sx.inblock.sock); continue_transport = NULL; continue_hostname = NULL; return yield; } - else if (pid == 0) /* child */ + else if (pid == 0) /* child; fork again to disconnect totally */ { + if ((pid = fork())) + _exit(pid ? EXIT_FAILURE : EXIT_SUCCESS); smtp_proxy_tls(sx.buffer, sizeof(sx.buffer), pfd[0], sx.ob->command_timeout); exim_exit(0); } diff --git a/test/scripts/2100-OpenSSL/2135 b/test/scripts/2100-OpenSSL/2135 index e521c45e3..5f8ee7d86 100644 --- a/test/scripts/2100-OpenSSL/2135 +++ b/test/scripts/2100-OpenSSL/2135 @@ -17,7 +17,7 @@ body . quit **** -sleep 1 +sleep 2 killdaemon # # diff --git a/test/scripts/2100-OpenSSL/2136 b/test/scripts/2100-OpenSSL/2136 index aa13114d5..0eb18ffa9 100644 --- a/test/scripts/2100-OpenSSL/2136 +++ b/test/scripts/2100-OpenSSL/2136 @@ -31,7 +31,7 @@ body QUIT ??? 221 **** -sleep 1 +sleep 2 killdaemon # # @@ -62,7 +62,7 @@ body QUIT ??? 221 **** -sleep 1 +sleep 2 killdaemon # #