X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/929ba01ccb7fafbe89e4fa60e93ab2b5f4aab1df..0a49a7a4f1090b6f1ce1d0f9d969804c9226b53e:/src/src/transports/pipe.c diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 97d69db0f..35048258e 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -1,17 +1,17 @@ -/* $Cambridge: exim/src/src/transports/pipe.c,v 1.10 2006/02/21 16:24:20 ph10 Exp $ */ +/* $Cambridge: exim/src/src/transports/pipe.c,v 1.14 2009/11/16 19:50:39 nm4 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2006 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ #include "../exim.h" #include "pipe.h" -#ifdef HAVE_LOGIN_CAP +#ifdef HAVE_SETCLASSRESOURCES #include #endif @@ -75,7 +75,7 @@ optionlist pipe_transport_options[] = { (void *)offsetof(pipe_transport_options_block, umask) }, { "use_bsmtp", opt_bool, (void *)offsetof(pipe_transport_options_block, use_bsmtp) }, - #ifdef HAVE_LOGIN_CAP + #ifdef HAVE_SETCLASSRESOURCES { "use_classresources", opt_bool, (void *)offsetof(pipe_transport_options_block, use_classresources) }, #endif @@ -154,7 +154,7 @@ gid = gid; errmsg = errmsg; ob = ob; -#ifdef HAVE_LOGIN_CAP +#ifdef HAVE_SETCLASSRESOURCES if (ob->use_classresources) { struct passwd *pw = getpwuid(uid); @@ -924,6 +924,18 @@ if ((rc = child_close(pid, timeout)) != 0) "transport: %s%s", tblock->name, strerror(errno), tmsg); } + /* Since the transport_filter timed out we assume it has sent the child process + a malformed or incomplete data stream. Kill off the child process + and prevent checking its exit status as it will has probably exited in error. + This prevents the transport_filter timeout message from getting overwritten + by the exit error which is not the cause of the problem. */ + + else if (transport_filter_timed_out) + { + killpg(pid, SIGKILL); + kill(outpid, SIGKILL); + } + /* Either the process completed, but yielded a non-zero (necessarily positive) status, or the process was terminated by a signal (rc will contain the negation of the signal number). Treat killing by signal as failure unless