]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/transports/smtp.c
Callout/hold: ensure TLS-proxy process is not waited for as a transport process
[user/henk/code/exim.git] / src / src / transports / smtp.c
index c4626b3e99079b5744703267def7f2ef3f6c42d5..14eb76921edf43e175dbdd526012c06a50e8dcbd 100644 (file)
@@ -1347,15 +1347,22 @@ return checks;
 If given a nonzero size, first flush any buffered SMTP commands
 then emit the command.
 
-Reap previous SMTP command responses if requested.
-Reap one SMTP command response if requested.
+Reap previous SMTP command responses if requested, and always reap
+the response from a previous BDAT command.
+
+Args:
+ tctx          transport context
+ chunk_size    value for SMTP BDAT command
+ flags
+   tc_chunk_last       add LAST option to SMTP BDAT command
+   tc_reap_prev                reap response to previous SMTP commands
 
 Returns:       OK or ERROR
 */
 
 static int
-smtp_chunk_cmd_callback(int fd, transport_ctx * tctx,
-  unsigned chunk_size, unsigned flags)
+smtp_chunk_cmd_callback(transport_ctx * tctx, unsigned chunk_size,
+  unsigned flags)
 {
 smtp_transport_options_block * ob =
   (smtp_transport_options_block *)(tctx->tblock->options_block);
@@ -2750,6 +2757,7 @@ if (continue_hostname && continue_sequence == 1)
   address_item * addr;
 
   sx.peer_offered = smtp_peer_options;
+  sx.pending_MAIL = FALSE;
   sx.ok = TRUE;
   sx.next_addr = NULL;
 
@@ -3417,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);
            }