]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.3-20051128
authorWietse Venema <wietse@porcupine.org>
Mon, 28 Nov 2005 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:31:49 +0000 (06:31 +0000)
14 files changed:
postfix/HISTORY
postfix/conf/access
postfix/html/access.5.html
postfix/html/smtpd.8.html
postfix/man/man5/access.5
postfix/man/man8/smtpd.8
postfix/proto/access
postfix/src/cleanup/cleanup_envelope.c
postfix/src/cleanup/cleanup_extracted.c
postfix/src/global/mail_version.h
postfix/src/pickup/Makefile.in
postfix/src/pickup/pickup.c
postfix/src/smtpd/smtpd.c
postfix/src/smtpd/smtpd_check.c

index 4faa2d5e1ce2fc095f9e7b1ce11333e64cc72f53..7dfc871a49729467e93e520e224259d4bc290271 100644 (file)
@@ -11466,6 +11466,15 @@ Apologies for any names omitted.
        Log warning when REDIRECT or FILTER are used in
        smtpd_etrn_restrictions. File: smtpd/smtpd_check.c.
 
+20051128
+
+       Bugfix: moved code around from one place to another to make
+       REDIRECT, FILTER, HOLD and DISCARD access(5) table actions
+       work in smtpd_end_of_data_restrictions.  PREPEND will not
+       be fixed; it must be specified before the message content
+       is received.  Files: smtpd/smtpd.c, smtpd/smtpd_check.c,
+       cleanup/cleanup_extracted.c, pickup/pickup.c.
+
 Open problems:
 
        "postsuper -r" no longer resets the message arrival time,
index af9435ee32f8be7731d69aa87155a9a1615c1af7..bacefdaa67cde345ffc4776a476a999572892eff 100644 (file)
 #               transport(5) table to direct mail to the discard(8)
 #               service.
 # 
-#               Note:  this  action  currently  does  not  work  in
+#               Note:  this  action  does  not  work in Postfix 2.2
 #               smtpd_end_of_data_restrictions.
 # 
 #               This feature is available in Postfix 2.0 and later.
 #               tent_filter  setting,  and  currently  affects  all
 #               recipients of the message.
 # 
-#               Note:  this  action  currently  does  not  work  in
+#               Note: this action does  not  work  in  Postfix  2.2
 #               smtpd_end_of_data_restrictions.
 # 
 #               This feature is available in Postfix 2.0 and later.
 #               Note: this action currently affects all  recipients
 #               of the message.
 # 
-#               Note:  this  action  currently  does  not  work  in
+#               Note:  this  action  does  not  work in Postfix 2.2
 #               smtpd_end_of_data_restrictions.
 # 
 #               This feature is available in Postfix 2.0 and later.
 #               Note: this action does not support multi-line  mes-
 #               sage headers.
 # 
+#               Note:  this  action must be used before the message
+#               content  is  received;  it  cannot   be   used   in
+#               smtpd_end_of_data_restrictions.
+# 
 #               This feature is available in Postfix 2.1 and later.
 # 
 #        REDIRECT user@domain
 #               Note: this action overrides the FILTER action,  and
 #               currently affects all recipients of the message.
 # 
-#               Note:  this  action  currently  does  not  work  in
+#               Note:  this  action  does  not  work in Postfix 2.2
 #               smtpd_end_of_data_restrictions.
 # 
 #               This feature is available in Postfix 2.1 and later.
index a9ec6353e76fcbc6271a36c58dce24f73a227a2f..3890e73a954bef925d8de1a00840cc8177e0261d 100644 (file)
@@ -227,7 +227,7 @@ ACCESS(5)                                                            ACCESS(5)
               <a href="transport.5.html">transport(5)</a> table to direct mail to the <a href="discard.8.html">discard(8)</a>
               service.
 
-              Note:  this  action  currently  does  not  work  in
+              Note:  this  action  does  not  work in Postfix 2.2
               <b><a href="postconf.5.html#smtpd_end_of_data_restrictions">smtpd_end_of_data_restrictions</a></b>.
 
               This feature is available in Postfix 2.0 and later.
@@ -251,7 +251,7 @@ ACCESS(5)                                                            ACCESS(5)
               <b><a href="postconf.5.html#content_filter">tent_filter</a></b>  setting,  and  currently  affects  all
               recipients of the message.
 
-              Note:  this  action  currently  does  not  work  in
+              Note: this action does  not  work  in  Postfix  2.2
               <b><a href="postconf.5.html#smtpd_end_of_data_restrictions">smtpd_end_of_data_restrictions</a></b>.
 
               This feature is available in Postfix 2.0 and later.
@@ -274,7 +274,7 @@ ACCESS(5)                                                            ACCESS(5)
               Note: this action currently affects all  recipients
               of the message.
 
-              Note:  this  action  currently  does  not  work  in
+              Note:  this  action  does  not  work in Postfix 2.2
               <b><a href="postconf.5.html#smtpd_end_of_data_restrictions">smtpd_end_of_data_restrictions</a></b>.
 
               This feature is available in Postfix 2.0 and later.
@@ -288,6 +288,10 @@ ACCESS(5)                                                            ACCESS(5)
               Note: this action does not support multi-line  mes-
               sage headers.
 
+              Note:  this  action must be used before the message
+              content  is  received;  it  cannot   be   used   in
+              <b><a href="postconf.5.html#smtpd_end_of_data_restrictions">smtpd_end_of_data_restrictions</a></b>.
+
               This feature is available in Postfix 2.1 and later.
 
        <b>REDIRECT</b> <i>user@domain</i>
@@ -298,7 +302,7 @@ ACCESS(5)                                                            ACCESS(5)
               Note: this action overrides the FILTER action,  and
               currently affects all recipients of the message.
 
-              Note:  this  action  currently  does  not  work  in
+              Note:  this  action  does  not  work in Postfix 2.2
               <b><a href="postconf.5.html#smtpd_end_of_data_restrictions">smtpd_end_of_data_restrictions</a></b>.
 
               This feature is available in Postfix 2.1 and later.
index 9509bc555115bf3ea726e0063961c758d76d1cd1..15a9c85ce09b118664568e3f4da49f32bd06fff0 100644 (file)
@@ -599,7 +599,7 @@ SMTPD(8)                                                              SMTPD(8)
        delivering mail.
 
        <b><a href="postconf.5.html#smtpd_error_sleep_time">smtpd_error_sleep_time</a> (1s)</b>
-              With   Postfix  2.1  and  later:  the  SMTP  server
+              With Postfix version 2.1 and later: the SMTP server
               response delay after a client has  made  more  than
               $<a href="postconf.5.html#smtpd_soft_error_limit">smtpd_soft_error_limit</a>   errors,  and  fewer  than
               $<a href="postconf.5.html#smtpd_hard_error_limit">smtpd_hard_error_limit</a> errors, without  delivering
index 496f58a2699921b74e280de104510c57b766f730..8f7df2a130c1da7848501febe674ac24107c6ae7 100644 (file)
@@ -212,7 +212,7 @@ Note: this action currently affects all recipients of the message.
 To discard only one recipient without discarding the entire message,
 use the transport(5) table to direct mail to the discard(8) service.
 .sp
-Note: this action currently does not work in
+Note: this action does not work in Postfix 2.2
 \fBsmtpd_end_of_data_restrictions\fR.
 .sp
 This feature is available in Postfix 2.0 and later.
@@ -232,7 +232,7 @@ about external content filters is in the Postfix FILTER_README file.
 Note: this action overrides the \fBmain.cf content_filter\fR setting,
 and currently affects all recipients of the message.
 .sp
-Note: this action currently does not work in
+Note: this action does not work in Postfix 2.2
 \fBsmtpd_end_of_data_restrictions\fR.
 .sp
 This feature is available in Postfix 2.0 and later.
@@ -252,7 +252,7 @@ or \fB$bounce_queue_lifetime\fR, or longer.
 .sp
 Note: this action currently affects all recipients of the message.
 .sp
-Note: this action currently does not work in
+Note: this action does not work in Postfix 2.2
 \fBsmtpd_end_of_data_restrictions\fR.
 .sp
 This feature is available in Postfix 2.0 and later.
@@ -263,6 +263,9 @@ header appears before the second etc. prepended header.
 .sp
 Note: this action does not support multi-line message headers.
 .sp
+Note: this action must be used before the message content
+is received; it cannot be used in \fBsmtpd_end_of_data_restrictions\fR.
+.sp
 This feature is available in Postfix 2.1 and later.
 .IP "\fBREDIRECT \fIuser@domain\fR"
 After the message is queued, send the message to the specified
@@ -271,7 +274,7 @@ address instead of the intended recipient(s).
 Note: this action overrides the FILTER action, and currently affects
 all recipients of the message.
 .sp
-Note: this action currently does not work in
+Note: this action does not work in Postfix 2.2
 \fBsmtpd_end_of_data_restrictions\fR.
 .sp
 This feature is available in Postfix 2.1 and later.
index 19ea129ce5e56924cc9d779054aacd741afee71a..16de5979eac19197e1b42b62c2da5b2e39644a2b 100644 (file)
@@ -495,7 +495,7 @@ run-away software.  The behavior is controlled by an error counter
 that counts the number of errors within an SMTP session that a
 client makes without delivering mail.
 .IP "\fBsmtpd_error_sleep_time (1s)\fR"
-With Postfix 2.1 and later: the SMTP server response delay after
+With Postfix version 2.1 and later: the SMTP server response delay after
 a client has made more than $smtpd_soft_error_limit errors, and
 fewer than $smtpd_hard_error_limit errors, without delivering mail.
 .IP "\fBsmtpd_soft_error_limit (10)\fR"
index c6a1d97aed2151bcaa51223ab45748bb90c18be0..289b68f11b25cdd106450c5392bc090ca427a31a 100644 (file)
 #      To discard only one recipient without discarding the entire message,
 #      use the transport(5) table to direct mail to the discard(8) service.
 # .sp
-#      Note: this action currently does not work in
+#      Note: this action does not work in Postfix 2.2
 #      \fBsmtpd_end_of_data_restrictions\fR.
 # .sp
 #      This feature is available in Postfix 2.0 and later.
 #      Note: this action overrides the \fBmain.cf content_filter\fR setting,
 #      and currently affects all recipients of the message.
 # .sp
-#      Note: this action currently does not work in
+#      Note: this action does not work in Postfix 2.2
 #      \fBsmtpd_end_of_data_restrictions\fR.
 # .sp
 #      This feature is available in Postfix 2.0 and later.
 # .sp
 #      Note: this action currently affects all recipients of the message.
 # .sp
-#      Note: this action currently does not work in
+#      Note: this action does not work in Postfix 2.2
 #      \fBsmtpd_end_of_data_restrictions\fR.
 # .sp
 #      This feature is available in Postfix 2.0 and later.
 # .sp
 #      Note: this action does not support multi-line message headers.
 # .sp
+#      Note: this action must be used before the message content
+#      is received; it cannot be used in \fBsmtpd_end_of_data_restrictions\fR.
+# .sp
 #      This feature is available in Postfix 2.1 and later.
 # .IP "\fBREDIRECT \fIuser@domain\fR"
 #      After the message is queued, send the message to the specified
 #      Note: this action overrides the FILTER action, and currently affects
 #      all recipients of the message.
 # .sp
-#      Note: this action currently does not work in
+#      Note: this action does not work in Postfix 2.2
 #      \fBsmtpd_end_of_data_restrictions\fR.
 # .sp
 #      This feature is available in Postfix 2.1 and later.
index 3d9b2da7bd18c694ae23d53034a70a332b983de2..002d14f7ca1e3eb16f77fcb695c107487ebb6a5a 100644 (file)
@@ -123,7 +123,7 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type,
 
     if (type == REC_TYPE_FLGS) {
        /* Not part of queue file format. */
-       extra_opts = atol(buf);
+       extra_opts = atoi(buf);
        if (extra_opts & ~CLEANUP_FLAG_MASK_EXTRA)
            msg_warn("%s: ignoring bad extra flags: 0x%x",
                     state->queue_id, extra_opts);
index 4746b214e312de99b1983a039326d7134a9c3336..30ca702d58300a6e5e3ce9c72a865fc096386278 100644 (file)
@@ -99,18 +99,26 @@ void    cleanup_extracted_process(CLEANUP_STATE *state, int type,
                                          const char *buf, ssize_t len)
 {
     const char *encoding;
-    const char generated_by_cleanup[] = {
-       REC_TYPE_FILT, REC_TYPE_RDR, REC_TYPE_ATTR,
-       REC_TYPE_RRTO, REC_TYPE_ERTO, 0,
-    };
     char   *attr_name;
     char   *attr_value;
     const char *error_text;
+    int     extra_opts;
     int     junk;
 
     if (msg_verbose)
        msg_info("extracted envelope %c %.*s", type, (int) len, buf);
 
+    if (type == REC_TYPE_FLGS) {
+       /* Not part of queue file format. */
+       extra_opts = atoi(buf);
+       if (extra_opts & ~CLEANUP_FLAG_MASK_EXTRA)
+           msg_warn("%s: ignoring bad extra flags: 0x%x",
+                    state->queue_id, extra_opts);
+       else
+           state->flags |= extra_opts;
+       return;
+    }
+
     if (strchr(REC_TYPE_EXTRACT, type) == 0) {
        msg_warn("%s: message rejected: "
                 "unexpected record type %d in extracted envelope",
@@ -237,22 +245,12 @@ void    cleanup_extracted_process(CLEANUP_STATE *state, int type,
 
     /*
      * Extracted envelope non-recipient record processing.
-     * 
-     * XXX We currently cannot have FILTER, REDIRECT etc. action records after
-     * the message content, as that would break the use of "postsuper -r" to
-     * reset such information. See also smtpd/smtpd_check.c.
      */
     if (state->flags & CLEANUP_FLAG_INRCPT)
        /* Tell qmgr that recipient records are mixed with other information. */
        state->qmgr_opts |= QMGR_READ_FLAG_MIXED_RCPT_OTHER;
-    if (strchr(generated_by_cleanup, type) != 0) {
-       /* Use our own header/body info instead. */
-       return;
-    } else {
-       /* Pass on other non-recipient record. */
-       cleanup_out(state, type, buf, len);
-       return;
-    }
+    cleanup_out(state, type, buf, len);
+    return;
 }
 
 /* cleanup_extracted_finish - complete the third message segment */
index 80974246ff3da08526e48cda7b07b2339fe2e1bd..9ddaf21a25b07ea396527d10a8103e8c11f99b19 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      "20051126"
+#define MAIL_RELEASE_DATE      "20051128"
 #define MAIL_VERSION_NUMBER    "2.3"
 
 #ifdef SNAPSHOT
index 3a47b32552a9e39a4c7cb4e4c98dd50ca6a4fc3d..fdfc1ce2a9259342a840d23ce7b678cc7d7d12a4 100644 (file)
@@ -57,6 +57,7 @@ depend: $(MAKES)
 # do not edit below this line - it is generated by 'make depend'
 pickup.o: ../../include/attr.h
 pickup.o: ../../include/cleanup_user.h
+pickup.o: ../../include/dsn_attr_map.h
 pickup.o: ../../include/input_transp.h
 pickup.o: ../../include/iostuff.h
 pickup.o: ../../include/lex_822.h
@@ -74,6 +75,7 @@ pickup.o: ../../include/record.h
 pickup.o: ../../include/safe_open.h
 pickup.o: ../../include/scan_dir.h
 pickup.o: ../../include/set_ugid.h
+pickup.o: ../../include/stringops.h
 pickup.o: ../../include/sys_defs.h
 pickup.o: ../../include/vbuf.h
 pickup.o: ../../include/vstream.h
index fa352280b10a86a1fd0c3579ce405c6ac95a3e35..29b7bb25afc000c50b21ea62aa7496ec4cc127b4 100644 (file)
 #include <set_ugid.h>
 #include <safe_open.h>
 #include <watchdog.h>
+#include <stringops.h>
 
 /* Global library. */
 
 #include <rec_type.h>
 #include <lex_822.h>
 #include <input_transp.h>
+#include <dsn_attr_map.h>
 
 /* Single-threaded server skeleton. */
 
@@ -199,6 +201,8 @@ static int copy_segment(VSTREAM *qfile, VSTREAM *cleanup, PICKUP_INFO *info,
     int     type;
     int     check_first = (*expected == REC_TYPE_CONTENT[0]);
     int     time_seen = 0;
+    char   *attr_name;
+    char   *attr_value;
 
     /*
      * Limit the input record size. All front-end programs should protect the
@@ -235,9 +239,28 @@ static int copy_segment(VSTREAM *qfile, VSTREAM *cleanup, PICKUP_INFO *info,
         * XXX Workaround: REC_TYPE_FILT (used in envelopes) == REC_TYPE_CONT
         * (used in message content).
         */
-       if (type == REC_TYPE_FILT && *expected != REC_TYPE_CONTENT[0])
-           /* Use our own content filter settings instead. */
-           continue;
+       if (*expected != REC_TYPE_CONTENT[0]) {
+           if (type == REC_TYPE_FILT)
+               /* Discard FILTER record after "postsuper -r". */
+               continue;
+           if (type == REC_TYPE_RDR)
+               /* Discard REDIRECT record after "postsuper -r". */
+               continue;
+       }
+       if (*expected == REC_TYPE_EXTRACT[0]) {
+           if (type == REC_TYPE_RRTO)
+               /* Discard return-receipt record after "postsuper -r". */
+               continue;
+           if (type == REC_TYPE_ERTO)
+               /* Discard errors-to record after "postsuper -r". */
+               continue;
+           if (type == REC_TYPE_ATTR
+               && split_nameval(vstring_str(buf),
+                                &attr_name, &attr_value) == 0
+               && dsn_attr_map(attr_name) == 0)
+               /* Discard other/header/body action after "postsuper -r". */
+               continue;
+       }
 
        /*
         * XXX Force an empty record when the queue file content begins with
index 5ad9a1f7522ecbce6099cd380309138ae027ff31..952722ae556d9d7c50a4905b1f074174f8a5fe72 100644 (file)
 /*     that counts the number of errors within an SMTP session that a
 /*     client makes without delivering mail.
 /* .IP "\fBsmtpd_error_sleep_time (1s)\fR"
-/*     With Postfix 2.1 and later: the SMTP server response delay after
+/*     With Postfix version 2.1 and later: the SMTP server response delay after
 /*     a client has made more than $smtpd_soft_error_limit errors, and
 /*     fewer than $smtpd_hard_error_limit errors, without delivering mail.
 /* .IP "\fBsmtpd_soft_error_limit (10)\fR"
@@ -2117,19 +2117,15 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
     }
 
     /*
-     * Flush out any access table actions that are delegated to the cleanup
-     * server, and that may trigger before we accept the first valid
-     * recipient.
+     * Flush out a first batch of access table actions that are delegated to
+     * the cleanup server, and that may trigger before we accept the first
+     * valid recipient. There will be more after end-of-data.
      * 
      * Terminate the message envelope segment. Start the message content
      * segment, and prepend our own Received: header. If there is only one
      * recipient, list the recipient address.
      */
     if (state->cleanup) {
-       if (state->saved_filter)
-           rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s", state->saved_filter);
-       if (state->saved_redirect)
-           rec_fprintf(state->cleanup, REC_TYPE_RDR, "%s", state->saved_redirect);
        if (state->saved_flags)
            rec_fprintf(state->cleanup, REC_TYPE_FLGS, "%d", state->saved_flags);
        rec_fputs(state->cleanup, REC_TYPE_MESG, "");
@@ -2301,13 +2297,28 @@ static int data_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *unused_argv)
     }
 
     /*
-     * Send the end-of-segment markers and finish the queue file record
-     * stream.
+     * Flush out access table actions that are delegated to the cleanup
+     * server. There is similar code at the beginning of the DATA command.
+     * 
+     * Send the end-of-segment markers and finish the queue file record stream.
      */
     else {
+       if (state->err == CLEANUP_STAT_OK) {
+           rec_fputs(state->cleanup, REC_TYPE_XTRA, "");
+           if (state->saved_filter)
+               rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s",
+                           state->saved_filter);
+           if (state->saved_redirect)
+               rec_fprintf(state->cleanup, REC_TYPE_RDR, "%s",
+                           state->saved_redirect);
+           if (state->saved_flags)
+               rec_fprintf(state->cleanup, REC_TYPE_FLGS, "%d",
+                           state->saved_flags);
+           if (vstream_ferror(state->cleanup))
+               state->err = CLEANUP_STAT_WRITE;
+       }
        if (state->err == CLEANUP_STAT_OK)
-           if (rec_fputs(state->cleanup, REC_TYPE_XTRA, "") < 0
-               || rec_fputs(state->cleanup, REC_TYPE_END, "") < 0
+           if (rec_fputs(state->cleanup, REC_TYPE_END, "") < 0
                || vstream_fflush(state->cleanup))
                state->err = CLEANUP_STAT_WRITE;
        if (state->err == 0) {
index 46f3f1a852c4c9b3d1f1203ed302baebbb3bd2d8..8910cd9054bf7551035c21ec8c9432c245df1295 100644 (file)
@@ -1836,17 +1836,6 @@ static int can_delegate_action(SMTPD_STATE *state, const char *table,
        return (0);
     }
 
-    /*
-     * XXX We currently cannot have FILTER, REDIRECT etc. action records
-     * after the message content, as that would break the use of "postsuper
-     * -r" to reset such information. See cleanup/cleanup_extracted.c.
-     */
-    if (strcmp(state->where, SMTPD_AFTER_DOT) == 0) {
-       msg_warn("access table %s: action %s is unavailable in %s",
-                table, action, VAR_EOD_CHECKS);
-       return (0);
-    }
-
     /*
      * ETRN does not receive mail so we can't store queue file records.
      */
@@ -2074,6 +2063,11 @@ static int check_table_result(SMTPD_STATE *state, const char *table,
        if (not_in_client_helo(state, table, "PREPEND", reply_class) == 0)
            return (SMTPD_CHECK_DUNNO);
 #endif
+       if (strcmp(state->where, SMTPD_AFTER_DOT) == 0) {
+           msg_warn("access table %s: action PREPEND must be used before %s",
+                    table, VAR_EOD_CHECKS);
+           return (SMTPD_CHECK_DUNNO);
+       }
        if (*cmd_text == 0 || is_header(cmd_text) == 0) {
            msg_warn("access table %s entry \"%s\" requires header: text",
                     table, datum);