diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-04-06 22:58:46 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2017-04-06 22:58:46 +0100 |
commit | 60272099eb6529d6d748c7dd04412b35c09f37e2 (patch) | |
tree | 6ec16fafcbfe0bec46bad93e7b4d4f442ccdffb3 | |
parent | 170f490458e506bc76038051b3db8229bcdec9c4 (diff) |
Callout/hold: ensure TLS-proxy process is not waited for as a transport process
-rw-r--r-- | src/src/deliver.c | 5 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 5 | ||||
-rw-r--r-- | test/scripts/2100-OpenSSL/2135 | 2 | ||||
-rw-r--r-- | test/scripts/2100-OpenSSL/2136 | 4 |
4 files changed, 11 insertions, 5 deletions
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 # # |