]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.4-20070215
authorWietse Venema <wietse@porcupine.org>
Thu, 15 Feb 2007 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:32:56 +0000 (06:32 +0000)
postfix/HISTORY
postfix/src/cleanup/Makefile.in
postfix/src/cleanup/cleanup.h
postfix/src/cleanup/cleanup_api.c
postfix/src/cleanup/cleanup_bounce.c
postfix/src/cleanup/cleanup_extracted.c
postfix/src/cleanup/cleanup_final.c [new file with mode: 0644]
postfix/src/global/mail_version.h
postfix/src/util/vstream.c

index 14cb15f59b90cefff99dc32288b20b739b3ce3a1..ea1ffb2be8ec32958018a9dcd7d17d507f4d13bb 100644 (file)
@@ -13239,6 +13239,15 @@ Apologies for any names omitted.
        routines that can't handle file descriptors >= FD_SETSIZE.
        Files: *qmgr/qmgr_transport.c, util/vstream.[hc]
 
+20070215
+
+       Bugfix (introduced 20070114 with Milter body edit support):
+       the cleanup server terminated with a fatal error when SMTP
+       mail exceeded the message size limit, instead of handling
+       it as a non-fatal error. Files: cleanup/cleanup_extracted.c,
+       cleanup/cleanup_final.c, cleanup/cleanup_bounce.c,
+       cleanup/cleanup_api.c.
+
 Wish list:
 
        Update message content length when adding/removing headers.
index 87f7aa12c3dbfa28385a9814f2380deeaab8c623..ecd317a6cd0d3cb6f1da01eb2987a15a0fd02960 100644 (file)
@@ -4,13 +4,13 @@ SRCS  = cleanup.c cleanup_out.c cleanup_envelope.c cleanup_message.c \
        cleanup_map11.c cleanup_map1n.c cleanup_masquerade.c \
        cleanup_out_recipient.c cleanup_init.c cleanup_api.c \
        cleanup_addr.c cleanup_bounce.c cleanup_milter.c \
-       cleanup_body_edit.c cleanup_region.c
+       cleanup_body_edit.c cleanup_region.c cleanup_final.c
 OBJS   = cleanup.o cleanup_out.o cleanup_envelope.o cleanup_message.o \
        cleanup_extracted.o cleanup_state.o cleanup_rewrite.o \
        cleanup_map11.o cleanup_map1n.o cleanup_masquerade.o \
        cleanup_out_recipient.o cleanup_init.o cleanup_api.o \
        cleanup_addr.o cleanup_bounce.o cleanup_milter.o \
-       cleanup_body_edit.o cleanup_region.o
+       cleanup_body_edit.o cleanup_region.o cleanup_final.o
 HDRS   =
 TESTSRC        = 
 DEFS   = -I. -I$(INC_DIR) -D$(SYSTYPE)
@@ -552,6 +552,32 @@ cleanup_extracted.o: ../../include/vstream.h
 cleanup_extracted.o: ../../include/vstring.h
 cleanup_extracted.o: cleanup.h
 cleanup_extracted.o: cleanup_extracted.c
+cleanup_final.o: ../../include/argv.h
+cleanup_final.o: ../../include/been_here.h
+cleanup_final.o: ../../include/cleanup_user.h
+cleanup_final.o: ../../include/dict.h
+cleanup_final.o: ../../include/header_opts.h
+cleanup_final.o: ../../include/htable.h
+cleanup_final.o: ../../include/mail_conf.h
+cleanup_final.o: ../../include/mail_stream.h
+cleanup_final.o: ../../include/maps.h
+cleanup_final.o: ../../include/match_list.h
+cleanup_final.o: ../../include/match_ops.h
+cleanup_final.o: ../../include/milter.h
+cleanup_final.o: ../../include/mime_state.h
+cleanup_final.o: ../../include/msg.h
+cleanup_final.o: ../../include/mymalloc.h
+cleanup_final.o: ../../include/nvtable.h
+cleanup_final.o: ../../include/rec_type.h
+cleanup_final.o: ../../include/resolve_clnt.h
+cleanup_final.o: ../../include/string_list.h
+cleanup_final.o: ../../include/sys_defs.h
+cleanup_final.o: ../../include/tok822.h
+cleanup_final.o: ../../include/vbuf.h
+cleanup_final.o: ../../include/vstream.h
+cleanup_final.o: ../../include/vstring.h
+cleanup_final.o: cleanup.h
+cleanup_final.o: cleanup_final.c
 cleanup_init.o: ../../include/argv.h
 cleanup_init.o: ../../include/been_here.h
 cleanup_init.o: ../../include/cleanup_user.h
index c419f247259b4619ecc8f344f608629946bbe3cb..d73058a8c6db1a2b2f1b966f628009a9eab9e6fa 100644 (file)
@@ -233,6 +233,11 @@ extern void cleanup_message(CLEANUP_STATE *, int, const char *, ssize_t);
   */
 extern void cleanup_extracted(CLEANUP_STATE *, int, const char *, ssize_t);
 
+ /*
+  * cleanup_final.c
+  */
+extern void cleanup_final(CLEANUP_STATE *);
+
  /*
   * cleanup_rewrite.c
   */
index c06627436949e2b3dfce5d084d636e7450446741..4f402b6b72b45d213e695fd314edfc5d13a5fc61 100644 (file)
@@ -199,7 +199,6 @@ void    cleanup_control(CLEANUP_STATE *state, int flags)
 
 int     cleanup_flush(CLEANUP_STATE *state)
 {
-    const char *myname = "cleanup_flush";
     int     status;
     char   *junk;
     VSTRING *trace_junk;
@@ -239,17 +238,9 @@ int     cleanup_flush(CLEANUP_STATE *state)
     /*
      * Update the preliminary message size and count fields with the actual
      * values.
-     * 
-     * XXX This ugly code was moved up here from a lower-level module.
      */
-    if (vstream_fseek(state->dst, 0L, SEEK_SET) < 0)
-       msg_fatal("%s: vstream_fseek %s: %m", myname, cleanup_path);
-    cleanup_out_format(state, REC_TYPE_SIZE, REC_TYPE_SIZE_FORMAT,
-           (REC_TYPE_SIZE_CAST1) (state->xtra_offset - state->data_offset),
-                      (REC_TYPE_SIZE_CAST2) state->data_offset,
-                      (REC_TYPE_SIZE_CAST3) state->rcpt_count,
-                      (REC_TYPE_SIZE_CAST4) state->qmgr_opts,
-                      (REC_TYPE_SIZE_CAST5) state->cont_length);
+    if (CLEANUP_OUT_OK(state))
+       cleanup_final(state);
 
     /*
      * If there was an error that requires us to generate a bounce message
index 93012f0c2bebb0cd71cc730e68a3f0021bd4b390..d0d4c4f3e9693608b08caf0eb65ab7ec02ed38aa 100644 (file)
@@ -130,11 +130,11 @@ int     cleanup_bounce(CLEANUP_STATE *state)
      * expand the recipient count by virtual_alias_expansion_limit (default:
      * 1000) times.
      * 
-     * After a queue file size error, purge any unwritten data (so that
+     * After a queue file write error, purge any unwritten data (so that
      * vstream_fseek() won't fail while trying to flush it) and reset the
      * stream error flags to avoid false alarms.
      */
-    if (state->errs & CLEANUP_STAT_SIZE) {
+    if (vstream_ferror(state->dst) || vstream_fflush(state->dst)) {
        (void) vstream_fpurge(state->dst, VSTREAM_PURGE_BOTH);
        vstream_clearerr(state->dst);
     }
index e3bf7e0ba2ee2b5565376e02abce334be8dc151a..d47c0fe6aecca840d8cabc3eaddadce10b07971d 100644 (file)
 /* DESCRIPTION
 /*     This module processes message records with information extracted
 /*     from message content, or with recipients that are stored after the
-/*     message content. It updates recipient records, and writes extracted
-/*     information records to the output.
+/*     message content. It updates recipient records, writes extracted
+/*     information records to the output, and writes the queue
+/*     file end marker.  The queue file is left in a state that
+/*     is suitable for Milter inspection, but the size record still
+/*     contains dummy values.
 /*
 /*     Arguments:
 /* .IP state
@@ -299,20 +302,4 @@ void    cleanup_extracted_finish(CLEANUP_STATE *state)
      * Terminate the extracted segment.
      */
     cleanup_out_string(state, REC_TYPE_END, "");
-
-    /*
-     * vstream_fseek() would flush the buffer anyway, but the code just reads
-     * better if we flush first, because it makes seek error handling more
-     * straightforward.
-     */
-    if (vstream_fflush(state->dst)) {
-       if (errno == EFBIG) {
-           msg_warn("%s: queue file size limit exceeded", state->queue_id);
-           state->errs |= CLEANUP_STAT_SIZE;
-       } else {
-           msg_warn("%s: write queue file: %m", state->queue_id);
-           state->errs |= CLEANUP_STAT_WRITE;
-       }
-       return;
-    }
 }
diff --git a/postfix/src/cleanup/cleanup_final.c b/postfix/src/cleanup/cleanup_final.c
new file mode 100644 (file)
index 0000000..fc482c5
--- /dev/null
@@ -0,0 +1,77 @@
+/*++
+/* NAME
+/*     cleanup_final 3
+/* SUMMARY
+/*     finalize queue file
+/* SYNOPSIS
+/*     #include "cleanup.h"
+/*
+/*     void    cleanup_final(state)
+/*     CLEANUP_STATE *state;
+/* DESCRIPTION
+/*     cleanup_final() performs final queue file content (not
+/*     attribute) updates so that the file is ready to be closed.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+/* System library. */
+
+#include <sys_defs.h>
+#include <errno.h>
+
+/* Utility library. */
+
+#include <msg.h>
+
+/* Global library. */
+
+#include <cleanup_user.h>
+#include <rec_type.h>
+
+/* Application-specific. */
+
+#include "cleanup.h"
+
+/* cleanup_final - final queue file content updates */
+
+void    cleanup_final(CLEANUP_STATE *state)
+{
+    const char *myname = "cleanup_final";
+
+    /*
+     * vstream_fseek() would flush the buffer anyway, but the code just reads
+     * better if we flush first, because it makes seek error handling more
+     * straightforward.
+     */
+    if (vstream_fflush(state->dst)) {
+       if (errno == EFBIG) {
+           msg_warn("%s: queue file size limit exceeded", state->queue_id);
+           state->errs |= CLEANUP_STAT_SIZE;
+       } else {
+           msg_warn("%s: write queue file: %m", state->queue_id);
+           state->errs |= CLEANUP_STAT_WRITE;
+       }
+       return;
+    }
+
+    /*
+     * Update the preliminary message size and count fields with the actual
+     * values.
+     */
+    if (vstream_fseek(state->dst, 0L, SEEK_SET) < 0)
+       msg_fatal("%s: vstream_fseek %s: %m", myname, cleanup_path);
+    cleanup_out_format(state, REC_TYPE_SIZE, REC_TYPE_SIZE_FORMAT,
+           (REC_TYPE_SIZE_CAST1) (state->xtra_offset - state->data_offset),
+                      (REC_TYPE_SIZE_CAST2) state->data_offset,
+                      (REC_TYPE_SIZE_CAST3) state->rcpt_count,
+                      (REC_TYPE_SIZE_CAST4) state->qmgr_opts,
+                      (REC_TYPE_SIZE_CAST5) state->cont_length);
+}
index 4a9f60a5d90348a8da1b608667cf02165e2c5a65..e289aab1e8d1f118e06ca3239f88d47ee10f744d 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20070214"
+#define MAIL_RELEASE_DATE      "20070215"
 #define MAIL_VERSION_NUMBER    "2.4"
 
 #ifdef SNAPSHOT
index 90d3ab2ed30cdc8208850f81fcdbf3b63230a1a6..e9b4a9fb4c4239e05293e2e37df71901ae9876be 100644 (file)
 /*
 /*     vstream_ferror() returns non-zero when a previous operation on the
 /*     specified stream caused a non-EOF error condition, including timeout.
-/*     After a non-EOF, non-timeout, error on a stream, no I/O request will
+/*     After a non-EOF error on a stream, no I/O request will
 /*     complete until after vstream_clearerr() is called for that stream.
 /*
 /*     vstream_ftimeout() returns non-zero when a previous operation on the
-/*     specified stream caused a timeout error condition.
-/*     Although further I/O requests after timeout may complete
-/*     succesfully, vstream_ftimeout() will keep returning non-zero
-/*     until vstream_clearerr() is called for that stream.
+/*     specified stream caused a timeout error condition. See
+/*     vstream_ferror() for error persistence details.
 /*
 /*     vstream_clearerr() resets the timeout, error and end-of-file indication
 /*     of the specified stream, and returns no useful result.