Callout/hold: ensure TLS-proxy process is not waited for as a transport process
authorJeremy Harris <jgh146exb@wizmail.org>
Thu, 6 Apr 2017 21:58:46 +0000 (22:58 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Thu, 6 Apr 2017 21:58:46 +0000 (22:58 +0100)
src/src/deliver.c
src/src/transports/smtp.c
test/scripts/2100-OpenSSL/2135
test/scripts/2100-OpenSSL/2136

index 351a02b0ad7b7cff767a7cc3e02c3a4e9b59e209..139ee837424c76d644a42e0089a976aa65a9cf57 100644 (file)
@@ -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];
     }
index 4ce839d63631e42b60089992438df343d7d9b9e5..14eb76921edf43e175dbdd526012c06a50e8dcbd 100644 (file)
@@ -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);
            }
index e521c45e3c3a6dcdc4c6dbaa91dbf4d12a8c5d81..5f8ee7d865f0dd57da408d11d3fdea45b05201e9 100644 (file)
@@ -17,7 +17,7 @@ body
 .
 quit
 ****
-sleep 1
+sleep 2
 killdaemon
 #
 #
index aa13114d5288719f4631b01cdd7fd5f666543e42..0eb18ffa956fabc9324bcb31eb192ada5be5bc70 100644 (file)
@@ -31,7 +31,7 @@ body
 QUIT
 ??? 221
 ****
-sleep 1
+sleep 2
 killdaemon
 #
 #
@@ -62,7 +62,7 @@ body
 QUIT
 ??? 221
 ****
-sleep 1
+sleep 2
 killdaemon
 #
 #