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,
# 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.
<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.
<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.
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.
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>
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.
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
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.
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"
# 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.
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);
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",
/*
* 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 */
* 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
# 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
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
#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. */
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
* 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
/* 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"
}
/*
- * 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, "");
}
/*
- * 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) {
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.
*/
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);