This is now possible on Linux, at least.
debug_printf("delay skipped in -bh checking mode\n");
}
+ /* NOTE 1: Remember that we may be
+ dealing with stdin/stdout here, in addition to TCP/IP connections.
+ Also, delays may be specified for non-SMTP input, where smtp_out and
+ smtp_in will be NULL. Whatever is done must work in all cases.
+
+ NOTE 2: The added feature of flushing the output before a delay must
+ apply only to SMTP input. Hence the test for smtp_out being non-NULL.
+ */
+
+ else
+ {
+ if (smtp_out != NULL && !disable_delay_flush)
+ mac_smtp_fflush();
+
+#if !defined(NO_POLL_H) && defined (_GNU_SOURCE)
+ {
+ struct pollfd p;
+ nfds_t n = 0;
+ if (smtp_out)
+ {
+ p.fd = fileno(smtp_out);
+ p.events = POLLRDHUP;
+ n = 1;
+ }
+ if (poll(&p, n, delay*1000) > 0)
+ HDEBUG(D_acl) debug_printf("delay cancelled by peer close\n");
+ }
+#else
/* It appears to be impossible to detect that a TCP/IP connection has
gone away without reading from it. This means that we cannot shorten
the delay below if the client goes away, because we cannot discover
Exim process is not held up unnecessarily. However, it seems that we
can't. The poll() function does not do the right thing, and in any case
it is not always available.
-
- NOTE 1: If ever this state of affairs changes, remember that we may be
- dealing with stdin/stdout here, in addition to TCP/IP connections.
- Also, delays may be specified for non-SMTP input, where smtp_out and
- smtp_in will be NULL. Whatever is done must work in all cases.
-
- NOTE 2: The added feature of flushing the output before a delay must
- apply only to SMTP input. Hence the test for smtp_out being non-NULL.
*/
- else
- {
- if (smtp_out != NULL && !disable_delay_flush) mac_smtp_fflush();
while (delay > 0) delay = sleep(delay);
+#endif
}
}
}
--- /dev/null
+# Exim test configuration 0609
+# Long ACL delays
+
+SERVER=
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/SERVER%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+disable_ipv6 = true
+
+acl_smtp_rcpt = delay4_accept
+log_selector = +smtp_connection
+#hosts_connection_nolog = : 127.0.0.1
+
+
+# ----- ACLs -----
+
+begin acl
+
+delay4_accept:
+ accept delay = 4s
+
+# ----- Routers -----
+
+begin routers
+
+accept:
+ driver = accept
+ transport = appendfile
+
+# ----- Transports -----
+
+begin transports
+
+appendfile:
+ driver = appendfile
+ file = DIR/test-mail/$local_part
+ user = CALLER
+
+# End
******** SERVER ********
1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
-1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
1999-03-02 09:44:33 SMTP connection from localhost (myhost.test.ex) [127.0.0.1] lost while reading message data (header)
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@myhost.test.ex H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@myhost.test.ex
--- /dev/null
+
+******** SERVER ********
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
+1999-03-02 09:44:33 SMTP connection from [127.0.0.1] (TCP/IP connection count = 1)
+1999-03-02 09:44:33 SMTP connection from [127.0.0.1] closed by QUIT
+1999-03-02 09:44:33 SMTP connection from [127.0.0.1] (TCP/IP connection count = 1)
+1999-03-02 09:44:33 unexpected disconnection while reading SMTP command from [127.0.0.1]
'tls_anycipher' =>
{ 'mainlog' => 's/ X=TLS\S+ / X=TLS_proto_and_cipher /' },
+ 'debug_pid' =>
+ { 'stderr' => 's/\d{1,5}/ppppp/g' },
+
};
exim -qf
****
killdaemon
+sleep 1
# This daemon should flush before delaying
exim -DSERVER=server -bd -oX PORT_D
****
--- /dev/null
+# Long ACL delay, truncated
+munge debug_pid
+need_ipv4
+#
+# We want the debug note of a truncated delay
+exim -d-all+acl -DSERVER=server -odq -bd -oX PORT_D
+****
+#
+# Server delays 4s before accepting RCPT
+client 127.0.0.1 PORT_D
+??? 220
+mail from:<x@y.test.ex>
+??? 250
+rcpt to:<delay4_accept@y.test.ex>
+??? 250
+quit
+??? 221
+****
+#
+# Server delays 4s before accepting RCPT
+# but client closes connection
+client 127.0.0.1 PORT_D
+??? 220
+mail from:<x@y.test.ex>
+??? 250
+rcpt to:<delay4_accept@y.test.ex>
+****
+killdaemon
+no_msglog_check
--- /dev/null
+
+******** SERVER ********
+Exim version x.yz ....
+configuration file is TESTSUITE/test-config
+admin user
+ppppp daemon_smtp_port overridden by -oX:
+ppppp <: ppppp
+ppppp listening on all interfaces (IPvppppp) port ppppp
+ppppp pid written to TESTSUITE/spool/exim-daemon.pid
+ppppp LOG: MAIN
+ppppp exim x.yz daemon started: pid=ppppp, no queue runs, listening for SMTP on port ppppp (IPvppppp)
+ppppp daemon running with uid=ppppp gid=ppppp euid=ppppp egid=ppppp
+ppppp Listening...
+ppppp Connection request from ppppp.ppppp.ppppp.ppppp port ppppp
+ppppp LOG: smtp_connection MAIN
+ppppp SMTP connection from [ppppp.ppppp.ppppp.ppppp] (TCP/IP connection count = ppppp)
+ppppp ppppp SMTP accept process running
+ppppp Listening...
+ppppp Process ppppp is handling incoming connection from [ppppp.ppppp.ppppp.ppppp]
+ppppp Process ppppp is ready for new message
+ppppp using ACL "delayppppp_accept"
+ppppp processing "accept"
+ppppp check delay = ppppps
+ppppp delay modifier requests ppppp-second delay
+ppppp accept: condition test succeeded in ACL "delayppppp_accept"
+ppppp end of ACL "delayppppp_accept": ACCEPT
+ppppp LOG: smtp_connection MAIN
+ppppp SMTP connection from [ppppp.ppppp.ppppp.ppppp] closed by QUIT
+ppppp child ppppp ended: status=pppppxppppp
+ppppp normal exit, ppppp
+ppppp ppppp SMTP accept processes now running
+ppppp Listening...
+ppppp Connection request from ppppp.ppppp.ppppp.ppppp port ppppp
+ppppp LOG: smtp_connection MAIN
+ppppp SMTP connection from [ppppp.ppppp.ppppp.ppppp] (TCP/IP connection count = ppppp)
+ppppp ppppp SMTP accept process running
+ppppp Listening...
+ppppp Process ppppp is handling incoming connection from [ppppp.ppppp.ppppp.ppppp]
+ppppp Process ppppp is ready for new message
+ppppp using ACL "delayppppp_accept"
+ppppp processing "accept"
+ppppp check delay = ppppps
+ppppp delay modifier requests ppppp-second delay
+ppppp delay cancelled by peer close
+ppppp accept: condition test succeeded in ACL "delayppppp_accept"
+ppppp end of ACL "delayppppp_accept": ACCEPT
+ppppp LOG: lost_incoming_connection MAIN
+ppppp unexpected disconnection while reading SMTP command from [ppppp.ppppp.ppppp.ppppp]
+ppppp child ppppp ended: status=pppppxppppp
+ppppp normal exit, ppppp
+ppppp ppppp SMTP accept processes now running
+ppppp Listening...
--- /dev/null
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> mail from:<x@y.test.ex>
+??? 250
+<<< 250 OK
+>>> rcpt to:<delay4_accept@y.test.ex>
+??? 250
+<<< 250 Accepted
+>>> quit
+??? 221
+<<< 221 myhost.test.ex closing connection
+End of script
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> mail from:<x@y.test.ex>
+??? 250
+<<< 250 OK
+>>> rcpt to:<delay4_accept@y.test.ex>
+End of script