ph10 2004/10/14 15:52:45 BST
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src transport.c
exim-src/src/transports appendfile.c lmtp.c pipe.c smtp.c
Added files:
exim-test-orig/AutoTest/aux 589.script
exim-test-orig/AutoTest/confs 589
exim-test-orig/AutoTest/log 589
exim-test-orig/AutoTest/paniclog 589
exim-test-orig/AutoTest/scripts 589
exim-test-orig/AutoTest/stderr 589
exim-test-orig/AutoTest/stdout 589
Log:
Give more explanation in the error message when the command for a transport
filter fails to execute.
Revision Changes Path
1.5 +3 -0 exim/exim-doc/doc-txt/ChangeLog
1.2 +20 -15 exim/exim-src/src/transport.c
1.3 +6 -2 exim/exim-src/src/transports/appendfile.c
1.2 +3 -1 exim/exim-src/src/transports/lmtp.c
1.2 +4 -2 exim/exim-src/src/transports/pipe.c
1.2 +3 -2 exim/exim-src/src/transports/smtp.c
1.1 +14 -0 exim/exim-test-orig/AutoTest/aux/589.script (new)
1.1 +57 -0 exim/exim-test-orig/AutoTest/confs/589 (new)
1.1 +23 -0 exim/exim-test-orig/AutoTest/log/589 (new)
1.1 +2 -0 exim/exim-test-orig/AutoTest/paniclog/589 (new)
1.1 +34 -0 exim/exim-test-orig/AutoTest/scripts/589 (new)
1.1 +2 -0 exim/exim-test-orig/AutoTest/stderr/589 (new)
1.1 +15 -0 exim/exim-test-orig/AutoTest/stdout/589 (new)
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ChangeLog 14 Oct 2004 11:21:02 -0000 1.4
+++ ChangeLog 14 Oct 2004 14:52:45 -0000 1.5
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.4 2004/10/14 11:21:02 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.5 2004/10/14 14:52:45 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -15,6 +15,9 @@
3. Closing a stable door: arrange to panic-die if setitimer() ever fails. The
bug fixed in 4.43/37 would have been diagnosed quickly if this had been in
place.
+
+ 4. Give more explanation in the error message when the command for a transport
+ filter fails to execute.
Exim version 4.43
Index: transport.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transport.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- transport.c 7 Oct 2004 10:39:01 -0000 1.1
+++ transport.c 14 Oct 2004 14:52:45 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transport.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transport.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1095,29 +1095,34 @@
}
/* Wait for the writing process to complete. If it ends successfully,
-read the results from its pipe. */
+read the results from its pipe, provided we haven't already had a filter
+process failure. */
DEBUG(D_transport) debug_printf("waiting for writing process\n");
if (write_pid > 0)
{
- if ((rc = child_close(write_pid, 30)) == 0)
+ rc = child_close(write_pid, 30);
+ if (yield)
{
- BOOL ok;
- read(pfd[pipe_read], (void *)&ok, sizeof(BOOL));
- if (!ok)
+ if (rc == 0)
+ {
+ BOOL ok;
+ read(pfd[pipe_read], (void *)&ok, sizeof(BOOL));
+ if (!ok)
+ {
+ read(pfd[pipe_read], (void *)&save_errno, sizeof(int));
+ read(pfd[pipe_read], (void *)&(addr->more_errno), sizeof(int));
+ yield = FALSE;
+ }
+ }
+ else
{
- read(pfd[pipe_read], (void *)&save_errno, sizeof(int));
- read(pfd[pipe_read], (void *)&(addr->more_errno), sizeof(int));
yield = FALSE;
+ save_errno = ERRNO_FILTER_FAIL;
+ addr->more_errno = rc;
+ DEBUG(D_transport) debug_printf("writing process returned %d\n", rc);
}
- }
- else if (yield)
- {
- yield = FALSE;
- save_errno = ERRNO_FILTER_FAIL;
- addr->more_errno = rc;
- DEBUG(D_transport) debug_printf("writing process returned %d\n", rc);
- }
+ }
}
close(pfd[pipe_read]);
Index: appendfile.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/appendfile.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- appendfile.c 11 Oct 2004 09:49:43 -0000 1.2
+++ appendfile.c 14 Oct 2004 14:52:45 -0000 1.3
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.2 2004/10/11 09:49:43 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/appendfile.c,v 1.3 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2858,8 +2858,12 @@
from child_close() is in more_errno. */
else if (errno == ERRNO_FILTER_FAIL)
- addr->message = string_sprintf("filter process failure %d while writing "
- "to %s", addr->more_errno, dataname);
+ {
+ yield = PANIC;
+ addr->message = string_sprintf("transport filter process failed (%d) "
+ "while writing to %s%s", addr->more_errno, dataname,
+ (addr->more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
+ }
/* Handle failure to expand header changes */
Index: lmtp.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/lmtp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- lmtp.c 7 Oct 2004 13:10:02 -0000 1.1
+++ lmtp.c 14 Oct 2004 14:52:45 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/lmtp.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/lmtp.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -141,7 +141,9 @@
if (*errno_value == ERRNO_FILTER_FAIL)
{
- *message = string_sprintf("transport filter process failed (%d)", more_errno);
+ *message = string_sprintf("transport filter process failed (%d)%s",
+ more_errno,
+ (more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
return FALSE;
}
Index: pipe.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/pipe.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pipe.c 7 Oct 2004 13:10:02 -0000 1.1
+++ pipe.c 14 Oct 2004 14:52:45 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/pipe.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/pipe.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -800,14 +800,16 @@
}
else
{
- addr->transport_return = PANIC;
+ addr->transport_return = PANIC;
addr->basic_errno = errno;
if (errno == ERRNO_CHHEADER_FAIL)
addr->message =
string_sprintf("Failed to expand headers_add or headers_remove: %s",
expand_string_message);
else if (errno == ERRNO_FILTER_FAIL)
- addr->message = string_sprintf("Filter process failure");
+ addr->message = string_sprintf("Transport filter process failed (%d)%s",
+ addr->more_errno,
+ (addr->more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
else if (errno == ERRNO_WRITEINCOMPLETE)
addr->message = string_sprintf("Failed repeatedly to write data");
else
Index: smtp.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/transports/smtp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- smtp.c 7 Oct 2004 13:10:02 -0000 1.1
+++ smtp.c 14 Oct 2004 14:52:45 -0000 1.2
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.1 2004/10/07 13:10:02 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/transports/smtp.c,v 1.2 2004/10/14 14:52:45 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -389,8 +389,9 @@
if (*errno_value == ERRNO_FILTER_FAIL)
{
- *message = US string_sprintf("transport filter process failed (%d)",
- more_errno);
+ *message = US string_sprintf("transport filter process failed (%d)%s",
+ more_errno,
+ (more_errno == EX_EXECFAILED)? ": unable to execute command" : "");
return FALSE;
}
Index: 589.script
====================================================================
220 Welcome to this LMTP simulation
LHLO
250-Hello there
250 SIZE
MAIL FROM
250 OK
RCPT TO
250 OK
DATA
354 Send it
.
250 Number 1 is OK
QUIT
250 OK
Index: 589
====================================================================
# Exim test configuration 589
# Macros are set externally in order to get the path
# of the Exim that is being tested, and the directory
# in which the test data lives.
exim_path = EXIM_PATH
primary_hostname = myhost.test.ex
spool_directory = DIR/spool
# ----- Main settings -----
# ----- Routers -----
begin routers
r1:
driver = accept
transport = $h_transport:
# ----- Transports -----
begin transports
t1:
driver = appendfile
file = DIR/test-mail/$local_part
user = CALLER
transport_filter = /non/existent/file
t2:
driver = lmtp
command = DIR/mtpscript DIR/aux/589.script +DIR/spool/log/mainlog
transport_filter = /non/existent/file
t3:
driver = pipe
command = /bin/sh -c '/bin/cat > /dev/null'
transport_filter = /non/existent/file
t4:
driver = smtp
hosts = 127.0.0.1
port = 1225
allow_localhost
transport_filter = /non/existent/file
# ----- Retry -----
begin retry
* * F,1d,1d
# End
Index: 589
====================================================================
1999-03-02 09:44:33 10HmaX-0005vi-00 <= ph10@??? U=ph10 P=local S=288
1999-03-02 09:44:33 10HmaX-0005vi-00 == ph10@??? R=r1 T=t1 defer (-24): transport filter process failed (127) while writing to /source/exim4/AutoTest/test-mail/ph10: unable to execute command
1999-03-02 09:44:33 10HmaZ-0005vi-00 <= ph10@??? U=ph10 P=local S=288
220 Welcome to this LMTP simulation
LHLO
<<< LHLO myhost.test.ex
250-Hello there
250 SIZE
MAIL FROM
<<< MAIL FROM:<ph10@???>
250 OK
RCPT TO
<<< RCPT TO:<ph10@???>
250 OK
DATA
<<< DATA
354 Send it
.
1999-03-02 09:44:33 10HmaZ-0005vi-00 == ph10@??? R=r1 T=t2 defer (-1): transport filter process failed (127): unable to execute command
1999-03-02 09:44:33 10HmaY-0005vi-00 <= ph10@??? U=ph10 P=local S=288
1999-03-02 09:44:33 10HmaY-0005vi-00 == ph10@??? R=r1 T=t3 defer (-24): Transport filter process failed (127): unable to execute command
1999-03-02 09:44:33 10HmbA-0005vi-00 <= ph10@??? U=ph10 P=local S=288
1999-03-02 09:44:33 10HmbA-0005vi-00 == ph10@??? R=r1 T=t4 defer (-24): transport filter process failed (127): unable to execute command
Index: 589
====================================================================
1999-03-02 09:44:33 10HmaX-0005vi-00 == ph10@??? R=r1 T=t1 defer (-24): transport filter process failed (127) while writing to /source/exim4/AutoTest/test-mail/ph10: unable to execute command
1999-03-02 09:44:33 10HmaY-0005vi-00 == ph10@??? R=r1 T=t3 defer (-24): Transport filter process failed (127): unable to execute command
Index: 589
====================================================================
0 transport filter command fails to execute
exim -odi ph10
transport: t1
Test 1
****
0
exim -odi ph10
transport: t2
Test 2
****
0
exim -odi ph10
transport: t3
Test 3
****
0
server 1225
220 Welcome
EHLO
250-Hello there
250 SIZE
MAIL FROM
250 OK
RCPT TO
250 OK
DATA
354 Send it
****
0
exim -odi ph10
transport: t4
Test 4
****
no_msglog_check
Index: 589
====================================================================
1999-03-02 09:44:33 10HmaX-0005vi-00 == ph10@??? R=r1 T=t1 defer (-24): transport filter process failed (127) while writing to /source/exim4/AutoTest/test-mail/ph10: unable to execute command
1999-03-02 09:44:33 10HmaY-0005vi-00 == ph10@??? R=r1 T=t3 defer (-24): Transport filter process failed (127): unable to execute command
Index: 589
====================================================================
******** SERVER ********
Listening on port 1225 ...
Connection request from [127.0.0.1]
220 Welcome
EHLO myhost.test.ex
250-Hello there
250 SIZE
MAIL FROM:<ph10@???> SIZE=1320
250 OK
RCPT TO:<ph10@???>
250 OK
DATA
354 Send it
End of script