Update all copyright messages to cover 1995 - 2009. Remove tab from exim_checkaccess.src
[exim.git] / src / src / transports / pipe.c
index 97d69db0feb64a3653f3412c971fa8aa6309e55a..35048258e5f0363c6c41bad899c44fb0d30aa91c 100644 (file)
@@ -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 <login_cap.h>
 #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