From: Wietse Venema
Although my email address is "wietse@porcupine.org", all my mail systems announce themselves with the SMTP HELO command as @@ -127,6 +127,18 @@ Received: from host.example.com (EHLO porcupine.org) ... +
Some forgeries show up in the way that a mail server reports +itself in Received: message headers. Keeping in mind that all my +systems have a mail server name of hostname.porcupine.org, +the following is definitely a forgery:
+ ++++Received: by porcupine.org ... +Received: from host.example.com ( ... ) by porcupine.org ... ++
Another frequent sign of forgery is the Message-ID: header. My systems produce a Message-ID: of <stuff@hostname.porcupine.org>. The following @@ -149,18 +161,26 @@ patterns like this:
body_checks = regexp:/etc/postfix/body_checks /etc/postfix/header_checks: + if /^Received:/ /^Received: +from +(porcupine\.org) +/ reject forged client name in Received: header: $1 /^Received: +from +[^ ]+ +\(([^ ]+ +[he]+lo=|[he]+lo +)(porcupine\.org)\)/ reject forged client name in Received: header: $2 + /^Received:.* +by +(porcupine\.org)[[:>:]]/ + reject forged mail server name in Received: header: $1 + endif /^Message-ID:.*@(porcupine\.org)/ reject forged domain name in Message-ID: header: $1 /etc/postfix/body_checks: + if /^[> ]*Received:/ /^[> ]*Received: +from +(porcupine\.org) / reject forged client name in Received: header: $1 /^[> ]*Received: +from +[^ ]+ +\(([^ ]+ +[he]+lo=|[he]+lo +)(porcupine\.org)\)/ reject forged client name in Received: header: $2 + /^[> ]*Received:.* +by +(porcupine\.org)[[:>:]]/ + reject forged mail server name in Received: header: $1 + endif /^[> ]*Message-ID:.*@(porcupine\.org)/ reject forged domain name in Message-ID: header: $1 @@ -181,6 +201,14 @@ the "\", the "." would match any character. and ")" literally. Without the "\", the "(" and ")" would be grouping operators. +The "[[:>:]]" matches the end of a word. On +some systems you should specify "\>" instead. For details +see your system documentation.
+ +The "if /pattern/" and "endif" eliminate unnecessary +matching attempts. DO NOT indent lines starting with /pattern/ +between the "if" and "endif"!
+ @@ -251,7 +279,7 @@ reality, my patterns list multiple email addresses asThe "[[:<:]]" and "[[:>:]]" match the beginning and end of a word, respectively. On some systems you should specify "\<" and "\>" instead. For -details see your system documentation. +details see your system documentation.
The "\." matches "." literally. Without the "\", the "." would match any character.
diff --git a/postfix/html/DEBUG_README.html b/postfix/html/DEBUG_README.html index 71fdfd08e..0f785d55b 100644 --- a/postfix/html/DEBUG_README.html +++ b/postfix/html/DEBUG_README.html @@ -24,7 +24,7 @@ system when things do not work according to expectation. The methods vary from making Postfix log a lot of detail, to running some daemon processes under control of a call tracer or debugger. -The text assumes that the Postfix main.cf and master.cf +
The text assumes that the Postfix main.cf and master.cf configuration files are stored in directory /etc/postfix. You can use the command "postconf config_directory" to find out the actual location of this directory on your machine.
@@ -54,8 +54,11 @@ snifferA common mistake is to turn on chroot operation in the master.cf +
A common mistake is to turn on chroot operation in the master.cf file without going through all the necessary steps to set up a chroot environment. This causes Postfix daemon processes to fail due to all kinds of missing files.
@@ -163,7 +166,7 @@ chroot turned off:--/etc/postfix/master.cf: +/etc/postfix/master.cf: # ============================================================= # service type private unpriv chroot wakeup maxproc command # (yes) (yes) (yes) (never) (100) @@ -172,8 +175,8 @@ chroot turned off:
Inspect master.cf for any processes that have chroot operation -not turned off. If you find any, save a copy of the master.cf file, +
Inspect master.cf for any processes that have chroot operation +not turned off. If you find any, save a copy of the master.cf file, and edit the entries in question. After executing the command "postfix reload", see if the problem has gone away.
@@ -187,14 +190,14 @@ prepare Postfix for chrooted operation.In /etc/postfix/main.cf, list the remote site name or address +
In /etc/postfix/main.cf, list the remote site name or address in the debug_peer_list parameter. For example, in order to make the software log a lot of information to the syslog daemon for connections from or to the loopback interface:
@@ -223,13 +226,13 @@ utility that is available from-/etc/postfix/main.cf: +/etc/postfix/main.cf: debug_peer_list = 127.0.0.1
Append one or more "-v" options to selected daemon -definitions in /etc/postfix/master.cf and type "postfix reload". +definitions in /etc/postfix/master.cf and type "postfix reload". This will cause a lot of activity to be logged to the syslog daemon. Example:
@@ -291,22 +294,22 @@ what is going on within the process.-/etc/postfix/master.cf: +/etc/postfix/master.cf: smtp inet n - n - - smtpd -v
Append a -D option to the suspect command in -/etc/postfix/master.cf, for example:
+/etc/postfix/master.cf, for example:--/etc/postfix/master.cf: +/etc/postfix/master.cf: smtp inet n - n - - smtpd -D
Edit the debugger_command definition in /etc/postfix/main.cf +
Edit the debugger_command definition in /etc/postfix/main.cf so that it invokes the call tracer of your choice, for example:
-/etc/postfix/main.cf: +/etc/postfix/main.cf: debugger_command = PATH=/bin:/usr/bin:/usr/local/bin; (truss -p $process_id 2>&1 | logger -p mail.info) & sleep 5 @@ -315,22 +318,22 @@ so that it invokes the call tracer of your choice, for example:Type "postfix reload" and watch the logfile.
-Running daemon programs with the interactive -xxgdb debugger
+Running daemon programs with the interactive +ddd debugger
If you have X Windows installed on the Postfix machine, then -an interactive debugger such as xxgdb can be convenient. +an interactive debugger such as ddd can be convenient.
-Edit the debugger_command definition in /etc/postfix/main.cf -so that it invokes xxgdb:
+Edit the debugger_command definition in /etc/postfix/main.cf +so that it invokes ddd:
@@ -346,11 +349,11 @@ $ export XAUTHORITY=$HOME/.Xauthority (sh syntax)-/etc/postfix/main.cf: +/etc/postfix/main.cf: debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin - xxgdb $daemon_directory/$process_name $process_id & sleep 5 + ddd $daemon_directory/$process_name $process_id & sleep 5
Append a -D option to the suspect daemon definition in -/etc/postfix/master.cf, for example:
+/etc/postfix/master.cf, for example:@@ -362,6 +365,52 @@ settings.-/etc/postfix/master.cf: +/etc/postfix/master.cf: smtp inet n - n - - smtpd -D
Whenever the suspect daemon process is started, a debugger window pops up and you can watch in detail what happens.
+If you have the screen command installed on the Postfix machine, then +you can run an interactive debugger such as gdb as follows.
+ +Edit the debugger_command definition in /etc/postfix/main.cf +so that it runs gdb inside a detached screen session: +
+ +++ ++/etc/postfix/main.cf: + debugger_command = + PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; HOME=/root; + export HOME; screen -e^tt -dmS $process_name gdb + $daemon_directory/$process_name $process_id & sleep 2 ++
Be sure that gdb is in the command search path.
+ +Append a -D option to the suspect daemon definition in +/etc/postfix/master.cf, for example:
+ +++ ++/etc/postfix/master.cf: + smtp inet n - n - - smtpd -D ++
Execute the command "postfix reload" and wait until a +daemon process is started (you can see this in the maillog file). +
+ +Then attach to the screen, and debug away:
+ ++++# HOME=/root screen -r +gdb) continue +gdb) where ++
Edit the debugger_command definition in /etc/postfix/main.cf +
Edit the debugger_command definition in /etc/postfix/main.cf so that it invokes the gdb debugger:
-/etc/postfix/main.cf: +/etc/postfix/main.cf: debugger_command = PATH=/bin:/usr/bin:/usr/local/bin; export PATH; (echo cont; echo where; sleep 8640000) | gdb $daemon_directory/$process_name @@ -385,11 +434,11 @@ so that it invokes the gdb debugger:
Append a -D option to the suspect daemon in -/etc/postfix/master.cf, for example:
+/etc/postfix/master.cf, for example:@@ -500,7 +549,7 @@ by "D" so that the helpers can still recognize syntactical errors.-/etc/postfix/master.cf: +/etc/postfix/master.cf: smtp inet n - n - - smtpd -D
Output from "postconf -n". Please do not send your -main.cf file or 400+ lines of postconf output.
+main.cf file or 400+ lines of postconf output.Better, provide output from the postfinger tool. This can be found at http://ftp.wl0.org/SOURCES/postfinger.
diff --git a/postfix/html/Makefile.in b/postfix/html/Makefile.in index 777024146..22f7c23fb 100644 --- a/postfix/html/Makefile.in +++ b/postfix/html/Makefile.in @@ -25,9 +25,6 @@ MAN2HTML = man2html -t "Postfix manual - `IFS=.; set \`echo $@\`; echo \"$$1($$2 update: $(DAEMONS) $(COMMANDS) $(CONFIG) $(OTHER) -Makefile: Makefile.in - (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../src/makedefs; cat $?) >$@ - clean: echo clean diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 2c5304b81..49ac96961 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -4837,7 +4837,8 @@ Examples:The maximum amount of time that an idle Postfix daemon process waits for the next service request before exiting. This parameter -is ignored by the Postfix queue manager. +is ignored by the Postfix queue manager and by other long-lived +Postfix daemon processes.
@@ -6751,7 +6752,7 @@ Example: (default: empty)
A sender-dependent override for the global relayhost parameter -setting. The tables are searched by the sender address and by the +setting. The tables are searched by the envelope sender address and @domain. This information is overruled with relay_transport, default_transport and with the transport(5) table.
diff --git a/postfix/man/Makefile.in b/postfix/man/Makefile.in index 31e948f6f..7ff2e3471 100644 --- a/postfix/man/Makefile.in +++ b/postfix/man/Makefile.in @@ -23,9 +23,6 @@ TOOLS = man1/smtp-sink.1 man1/smtp-source.1 man1/qmqp-sink.1 \ update: $(DAEMONS) $(COMMANDS) $(CONFIG) $(TOOLS) -Makefile: Makefile.in - (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../src/makedefs; cat $?) >$@ - clean: rm -f cat?/* diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 15cc3134f..688476ed8 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -2627,7 +2627,8 @@ masquerade_exceptions = root .SH max_idle (default: 100s) The maximum amount of time that an idle Postfix daemon process waits for the next service request before exiting. This parameter -is ignored by the Postfix queue manager. +is ignored by the Postfix queue manager and by other long-lived +Postfix daemon processes. .PP Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks). The default time unit is s (seconds). @@ -3750,7 +3751,7 @@ sender_canonical_maps = hash:/etc/postfix/sender_canonical .ft R .SH sender_dependent_relayhost_maps (default: empty) A sender-dependent override for the global relayhost parameter -setting. The tables are searched by the sender address and by the +setting. The tables are searched by the envelope sender address and @domain. This information is overruled with relay_transport, default_transport and with the \fBtransport\fR(5) table. .PP diff --git a/postfix/proto/ADDRESS_REWRITING_README.html b/postfix/proto/ADDRESS_REWRITING_README.html index 76c78e0cb..21895ae5e 100644 --- a/postfix/proto/ADDRESS_REWRITING_README.html +++ b/postfix/proto/ADDRESS_REWRITING_README.html @@ -1174,13 +1174,13 @@ to mailbox, or delivery to non-Postfix command. Content-Description: Notification Content-Type: text/plain -This is the Postfix program at host spike.porcupine.org. +This is the mail system at host spike.porcupine.org. Enclosed is the mail delivery report that you requested. - The Postfix program + The mail system -<postfix-users@postfix.org>: delivery via mail.cloud9.net[168.100.1.4]: 250 Ok +<postfix-users@postfix.org>: delivery via mail.cloud9.net[168.100.1.4]: 250 2.1.5 Ok @@ -1210,13 +1210,13 @@ Content-Type: message/delivery-status Reporting-MTA: dns; spike.porcupine.org X-Postfix-Queue-ID: 84863BC0E5 X-Postfix-Sender: rfc822; wietse@porcupine.org -Arrival-Date: Tue, 13 Apr 2004 19:27:43 -0400 (EDT) +Arrival-Date: Sun, 26 Nov 2006 17:01:01 -0500 (EST) Final-Recipient: rfc822; postfix-users@postfix.org Action: deliverable -Status: 2.0.0 +Status: 2.1.5 Remote-MTA: dns; mail.cloud9.net -Diagnostic-Code: smtp; 250 Ok +Diagnostic-Code: smtp; 250 2.1.5 Ok @@ -1232,11 +1232,11 @@ Content-Description: Message Content-Type: message/rfc822 Received: by spike.porcupine.org (Postfix, from userid 1001) - id 84863BC0E5; Tue, 13 Apr 2004 19:27:43 -0400 (EDT) + id 84863BC0E5; id DA77DBC0A9; Sun, 26 Nov 2006 17:01:01 -0500 (EST) Subject: probe To: postfix-users@postfix.org -Message-Id: <20040413232743.84863BC0E5@spike.porcupine.org> -Date: Tue, 13 Apr 2004 19:27:43 -0400 (EDT) +Message-Id: <20061126220101.84863BC0E5@spike.porcupine.org> +Date: Sun, 26 Nov 2006 17:01:01 -0500 (EST) From: wietse@porcupine.org (Wietse Venema) diff --git a/postfix/proto/BACKSCATTER_README.html b/postfix/proto/BACKSCATTER_README.html index 1b9a7864e..4c7dd3677 100644 --- a/postfix/proto/BACKSCATTER_README.html +++ b/postfix/proto/BACKSCATTER_README.html @@ -38,7 +38,7 @@ recipient addresses?Although my email address is "wietse@porcupine.org", all my mail systems announce themselves with the SMTP HELO command as @@ -127,6 +127,18 @@ Received: from host.example.com (EHLO porcupine.org) ... +
Some forgeries show up in the way that a mail server reports +itself in Received: message headers. Keeping in mind that all my +systems have a mail server name of hostname.porcupine.org, +the following is definitely a forgery:
+ ++++Received: by porcupine.org ... +Received: from host.example.com ( ... ) by porcupine.org ... ++
Another frequent sign of forgery is the Message-ID: header. My systems produce a Message-ID: of <stuff@hostname.porcupine.org>. The following @@ -149,18 +161,26 @@ patterns like this:
body_checks = regexp:/etc/postfix/body_checks /etc/postfix/header_checks: + if /^Received:/ /^Received: +from +(porcupine\.org) +/ reject forged client name in Received: header: $1 /^Received: +from +[^ ]+ +\(([^ ]+ +[he]+lo=|[he]+lo +)(porcupine\.org)\)/ reject forged client name in Received: header: $2 + /^Received:.* +by +(porcupine\.org)[[:>:]]/ + reject forged mail server name in Received: header: $1 + endif /^Message-ID:.*@(porcupine\.org)/ reject forged domain name in Message-ID: header: $1 /etc/postfix/body_checks: + if /^[> ]*Received:/ /^[> ]*Received: +from +(porcupine\.org) / reject forged client name in Received: header: $1 /^[> ]*Received: +from +[^ ]+ +\(([^ ]+ +[he]+lo=|[he]+lo +)(porcupine\.org)\)/ reject forged client name in Received: header: $2 + /^[> ]*Received:.* +by +(porcupine\.org)[[:>:]]/ + reject forged mail server name in Received: header: $1 + endif /^[> ]*Message-ID:.*@(porcupine\.org)/ reject forged domain name in Message-ID: header: $1 @@ -181,6 +201,14 @@ the "\", the "." would match any character. and ")" literally. Without the "\", the "(" and ")" would be grouping operators. +The "[[:>:]]" matches the end of a word. On +some systems you should specify "\>" instead. For details +see your system documentation.
+ +The "if /pattern/" and "endif" eliminate unnecessary +matching attempts. DO NOT indent lines starting with /pattern/ +between the "if" and "endif"!
+The "[[:<:]]" and "[[:>:]]" match the beginning and end of a word, respectively. On some systems you should specify "\<" and "\>" instead. For -details see your system documentation. +details see your system documentation.
The "\." matches "." literally. Without the "\", the "." would match any character.
diff --git a/postfix/proto/DEBUG_README.html b/postfix/proto/DEBUG_README.html index f663add13..cdfc09a4b 100644 --- a/postfix/proto/DEBUG_README.html +++ b/postfix/proto/DEBUG_README.html @@ -54,8 +54,11 @@ snifferType "postfix reload" and watch the logfile.
-If you have X Windows installed on the Postfix machine, then -an interactive debugger such as xxgdb can be convenient. +an interactive debugger such as ddd can be convenient.
Edit the debugger_command definition in /etc/postfix/main.cf -so that it invokes xxgdb:
+so that it invokes ddd:
/etc/postfix/main.cf:
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
- xxgdb $daemon_directory/$process_name $process_id & sleep 5
+ ddd $daemon_directory/$process_name $process_id & sleep 5
@@ -362,6 +365,52 @@ settings.
Whenever the suspect daemon process is started, a debugger window pops up and you can watch in detail what happens.
+If you have the screen command installed on the Postfix machine, then +you can run an interactive debugger such as gdb as follows.
+ +Edit the debugger_command definition in /etc/postfix/main.cf +so that it runs gdb inside a detached screen session: +
+ +++ ++/etc/postfix/main.cf: + debugger_command = + PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; HOME=/root; + export HOME; screen -e^tt -dmS $process_name gdb + $daemon_directory/$process_name $process_id & sleep 2 ++
Be sure that gdb is in the command search path.
+ +Append a -D option to the suspect daemon definition in +/etc/postfix/master.cf, for example:
+ +++ ++/etc/postfix/master.cf: + smtp inet n - n - - smtpd -D ++
Execute the command "postfix reload" and wait until a +daemon process is started (you can see this in the maillog file). +
+ +Then attach to the screen, and debug away:
+ ++++# HOME=/root screen -r +gdb) continue +gdb) where ++
The maximum amount of time that an idle Postfix daemon process waits for the next service request before exiting. This parameter -is ignored by the Postfix queue manager. +is ignored by the Postfix queue manager and by other long-lived +Postfix daemon processes.
@@ -8998,7 +8999,7 @@ is placed into the Postfix configuration directory.
%PARAM sender_dependent_relayhost_maps emptyA sender-dependent override for the global relayhost parameter -setting. The tables are searched by the sender address and by the +setting. The tables are searched by the envelope sender address and @domain. This information is overruled with relay_transport, default_transport and with the transport(5) table.
diff --git a/postfix/src/anvil/Makefile.in b/postfix/src/anvil/Makefile.in index 3a40defa9..62946461e 100644 --- a/postfix/src/anvil/Makefile.in +++ b/postfix/src/anvil/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/bounce/Makefile.in b/postfix/src/bounce/Makefile.in index 2916a25c2..ddfaaa2eb 100644 --- a/postfix/src/bounce/Makefile.in +++ b/postfix/src/bounce/Makefile.in @@ -36,7 +36,7 @@ main.cf: $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/cleanup/Makefile.in b/postfix/src/cleanup/Makefile.in index 843e94dbc..2b1993750 100644 --- a/postfix/src/cleanup/Makefile.in +++ b/postfix/src/cleanup/Makefile.in @@ -27,7 +27,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/cleanup/cleanup_message.c b/postfix/src/cleanup/cleanup_message.c index 5af24c59c..5e71c8b89 100644 --- a/postfix/src/cleanup/cleanup_message.c +++ b/postfix/src/cleanup/cleanup_message.c @@ -596,6 +596,16 @@ static void cleanup_header_done_callback(void *context) TOK822 *token; time_t tv; + /* + * XXX Workaround: when we reach the end of headers, mime_state_update() + * may execute up to three call-backs before returning to the caller: + * head_out(), head_end(), and body_out() or body_end(). As long as + * call-backs don't return a result, each call-back has to check for + * itself if the previous call-back experienced a problem. + */ + if (CLEANUP_OUT_OK(state) == 0) + return; + /* * Add a missing (Resent-)Message-Id: header. The message ID gives the * time in GMT units, plus the local queue ID. @@ -706,6 +716,16 @@ static void cleanup_body_callback(void *context, int type, { CLEANUP_STATE *state = (CLEANUP_STATE *) context; + /* + * XXX Workaround: when we reach the end of headers, mime_state_update() + * may execute up to three call-backs before returning to the caller: + * head_out(), head_end(), and body_out() or body_end(). As long as + * call-backs don't return a result, each call-back has to check for + * itself if the previous call-back experienced a problem. + */ + if (CLEANUP_OUT_OK(state) == 0) + return; + /* * Crude message body content filter for emergencies. This code has * several problems: it sees one line at a time; it looks at long lines @@ -892,6 +912,15 @@ void cleanup_message(CLEANUP_STATE *state, int type, const char *buf, ssize_t cleanup_mime_error_callback, (void *) state); + /* + * XXX Workaround: truncate a long message header so that we don't exceed + * the Milter request size limit of 65535. + */ +#define KLUDGE_HEADER_LIMIT 60000 + if ((cleanup_milters || state->milters) + && var_header_limit > KLUDGE_HEADER_LIMIT) + var_header_limit = KLUDGE_HEADER_LIMIT; + /* * Pass control to the header processing routine. */ diff --git a/postfix/src/cleanup/cleanup_milter.c b/postfix/src/cleanup/cleanup_milter.c index 87a079577..5836159c4 100644 --- a/postfix/src/cleanup/cleanup_milter.c +++ b/postfix/src/cleanup/cleanup_milter.c @@ -1805,6 +1805,7 @@ int main(int unused_argc, char **argv) msg_vstream_init(argv[0], VSTREAM_ERR); var_line_limit = DEF_LINE_LIMIT; + var_header_limit = DEF_HEADER_LIMIT; for (;;) { ARGV *argv; diff --git a/postfix/src/cleanup/cleanup_out.c b/postfix/src/cleanup/cleanup_out.c index c81637372..52d3211fb 100644 --- a/postfix/src/cleanup/cleanup_out.c +++ b/postfix/src/cleanup/cleanup_out.c @@ -175,9 +175,22 @@ void cleanup_out_header(CLEANUP_STATE *state, VSTRING *header_buf) * of such header lines. NB: This code destroys the header. We could try * to avoid clobbering it, but we're not going to use the data any * further. + * + * XXX We prefer to truncate a header at the last line boundary before the + * header size limit. If this would undershoot the limit by more than + * 10%, we truncate between line boundaries to avoid losing too much + * text. This "unkind cut" may result in syntax errors and may trigger + * warnings from down-stream MTAs. */ for (line = start; line; line = next_line) { next_line = split_at(line, '\n'); + if ((next_line ? next_line - 1 : line + strlen(line)) + > start + var_header_limit) { + if (line - start > 0.9 * var_header_limit) /* nice cut */ + break; + start[var_header_limit] = 0; /* unkind cut */ + next_line = 0; + } if (line == start || IS_SPACE_TAB(*line)) { cleanup_out_string(state, REC_TYPE_NORM, line); } else { diff --git a/postfix/src/discard/Makefile.in b/postfix/src/discard/Makefile.in index df5478594..e39100098 100644 --- a/postfix/src/discard/Makefile.in +++ b/postfix/src/discard/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/dns/Makefile.in b/postfix/src/dns/Makefile.in index 2ed6fd65d..bbc5e9884 100644 --- a/postfix/src/dns/Makefile.in +++ b/postfix/src/dns/Makefile.in @@ -21,7 +21,7 @@ all: $(LIB) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/error/Makefile.in b/postfix/src/error/Makefile.in index 86f6a40d3..84ececa7e 100644 --- a/postfix/src/error/Makefile.in +++ b/postfix/src/error/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/flush/Makefile.in b/postfix/src/flush/Makefile.in index c6d309bc9..b83c38529 100644 --- a/postfix/src/flush/Makefile.in +++ b/postfix/src/flush/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/fsstone/Makefile.in b/postfix/src/fsstone/Makefile.in index a390e794e..098b141ea 100644 --- a/postfix/src/fsstone/Makefile.in +++ b/postfix/src/fsstone/Makefile.in @@ -17,7 +17,7 @@ all: $(PROG) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ fsstone: fsstone.o $(LIBS) $(CC) $(CFLAGS) -o $@ fsstone.o $(LIBS) $(SYSLIBS) diff --git a/postfix/src/global/Makefile.in b/postfix/src/global/Makefile.in index ab9162360..778e3c5c1 100644 --- a/postfix/src/global/Makefile.in +++ b/postfix/src/global/Makefile.in @@ -105,7 +105,7 @@ all: $(LIB) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/global/dict_proxy.c b/postfix/src/global/dict_proxy.c index 5ce496af7..b8da5abce 100644 --- a/postfix/src/global/dict_proxy.c +++ b/postfix/src/global/dict_proxy.c @@ -90,6 +90,7 @@ static const char *dict_proxy_lookup(DICT *dict, const char *key) DICT_PROXY *dict_proxy = (DICT_PROXY *) dict; VSTREAM *stream; int status; + int count = 0; /* * The client and server live in separate processes that may start and @@ -103,6 +104,7 @@ static const char *dict_proxy_lookup(DICT *dict, const char *key) for (;;) { stream = clnt_stream_access(proxy_stream); errno = 0; + count += 1; if (attr_print(stream, ATTR_FLAG_NONE, ATTR_TYPE_STR, MAIL_ATTR_REQ, PROXY_REQ_LOOKUP, ATTR_TYPE_STR, MAIL_ATTR_TABLE, dict->name, @@ -114,7 +116,7 @@ static const char *dict_proxy_lookup(DICT *dict, const char *key) ATTR_TYPE_INT, MAIL_ATTR_STATUS, &status, ATTR_TYPE_STR, MAIL_ATTR_VALUE, dict_proxy->result, ATTR_TYPE_END) != 2) { - if (msg_verbose || (errno != EPIPE && errno != ENOENT)) + if (msg_verbose || count > 1 || (errno && errno != EPIPE && errno != ENOENT)) msg_warn("%s: service %s: %m", myname, VSTREAM_PATH(stream)); } else { if (msg_verbose) diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 7efa772c4..50368ed84 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -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 "20061019" +#define MAIL_RELEASE_DATE "20061201" #define MAIL_VERSION_NUMBER "2.4" #ifdef SNAPSHOT diff --git a/postfix/src/global/mime_state.c b/postfix/src/global/mime_state.c index 66b93fb7a..7e7f162dd 100644 --- a/postfix/src/global/mime_state.c +++ b/postfix/src/global/mime_state.c @@ -182,6 +182,13 @@ /* .IP state /* MIME parser state created with mime_state_alloc(). /* BUGS +/* NOTE: when the end of headers is reached, mime_state_update() +/* may execute up to three call-backs before returning to the +/* caller: head_out(), head_end(), and body_out() or body_end(). +/* As long as call-backs return no result, it is up to the +/* call-back routines to check if a previous call-back experienced +/* an error. +/* /* Different mail user agents treat malformed message boundary /* strings in different ways. The Postfix MIME processor cannot /* be bug-compatible with everything. diff --git a/postfix/src/global/resolve_clnt.c b/postfix/src/global/resolve_clnt.c index 1b9ae4e8d..b96f0a736 100644 --- a/postfix/src/global/resolve_clnt.c +++ b/postfix/src/global/resolve_clnt.c @@ -164,6 +164,7 @@ void resolve_clnt(const char *class, const char *sender, const char *myname = "resolve_clnt"; VSTREAM *stream; int server_flags; + int count = 0; /* * One-entry cache. @@ -226,6 +227,7 @@ void resolve_clnt(const char *class, const char *sender, for (;;) { stream = clnt_stream_access(rewrite_clnt_stream); errno = 0; + count += 1; if (attr_print(stream, ATTR_FLAG_NONE, ATTR_TYPE_STR, MAIL_ATTR_REQ, class, ATTR_TYPE_STR, MAIL_ATTR_SENDER, sender, @@ -239,7 +241,7 @@ void resolve_clnt(const char *class, const char *sender, ATTR_TYPE_STR, MAIL_ATTR_RECIP, reply->recipient, ATTR_TYPE_INT, MAIL_ATTR_FLAGS, &reply->flags, ATTR_TYPE_END) != 5) { - if (msg_verbose || (errno != EPIPE && errno != ENOENT)) + if (msg_verbose || count > 1 || (errno && errno != EPIPE && errno != ENOENT)) msg_warn("problem talking to service %s: %m", var_rewrite_service); } else { diff --git a/postfix/src/global/rewrite_clnt.c b/postfix/src/global/rewrite_clnt.c index 601f7ca00..8bb3f0a52 100644 --- a/postfix/src/global/rewrite_clnt.c +++ b/postfix/src/global/rewrite_clnt.c @@ -82,6 +82,7 @@ VSTRING *rewrite_clnt(const char *rule, const char *addr, VSTRING *result) { VSTREAM *stream; int server_flags; + int count = 0; /* * One-entry cache. @@ -129,6 +130,7 @@ VSTRING *rewrite_clnt(const char *rule, const char *addr, VSTRING *result) for (;;) { stream = clnt_stream_access(rewrite_clnt_stream); errno = 0; + count += 1; if (attr_print(stream, ATTR_FLAG_NONE, ATTR_TYPE_STR, MAIL_ATTR_REQ, REWRITE_ADDR, ATTR_TYPE_STR, MAIL_ATTR_RULE, rule, @@ -139,7 +141,7 @@ VSTRING *rewrite_clnt(const char *rule, const char *addr, VSTRING *result) ATTR_TYPE_INT, MAIL_ATTR_FLAGS, &server_flags, ATTR_TYPE_STR, MAIL_ATTR_ADDR, result, ATTR_TYPE_END) != 2) { - if (msg_verbose || (errno != EPIPE && errno != ENOENT)) + if (msg_verbose || count > 1 || (errno && errno != EPIPE && errno != ENOENT)) msg_warn("problem talking to service %s: %m", var_rewrite_service); } else { diff --git a/postfix/src/global/scache_clnt.c b/postfix/src/global/scache_clnt.c index 10573e7df..658e88f75 100644 --- a/postfix/src/global/scache_clnt.c +++ b/postfix/src/global/scache_clnt.c @@ -91,6 +91,7 @@ static void scache_clnt_save_endp(SCACHE *scache, int endp_ttl, VSTREAM *stream; int status; int tries; + int count = 0; if (msg_verbose) msg_info("%s: endp=%s prop=%s fd=%d", @@ -110,6 +111,7 @@ static void scache_clnt_save_endp(SCACHE *scache, int endp_ttl, for (tries = 0; sp->auto_clnt != 0; tries++) { if ((stream = auto_clnt_access(sp->auto_clnt)) != 0) { errno = 0; + count += 1; if (attr_print(stream, ATTR_FLAG_NONE, ATTR_TYPE_STR, MAIL_ATTR_REQ, SCACHE_REQ_SAVE_ENDP, ATTR_TYPE_INT, MAIL_ATTR_TTL, endp_ttl, @@ -126,7 +128,7 @@ static void scache_clnt_save_endp(SCACHE *scache, int endp_ttl, || attr_scan(stream, ATTR_FLAG_STRICT, ATTR_TYPE_INT, MAIL_ATTR_STATUS, &status, ATTR_TYPE_END) != 1) { - if (msg_verbose || (errno != EPIPE && errno != ENOENT)) + if (msg_verbose || count > 1 || (errno && errno != EPIPE && errno != ENOENT)) msg_warn("problem talking to service %s: %m", VSTREAM_PATH(stream)); /* Give up or recover. */ @@ -281,7 +283,7 @@ static void scache_clnt_save_dest(SCACHE *scache, int dest_ttl, myname, status); break; } - } + } /* Give up or recover. */ if (tries >= SCACHE_MAX_TRIES - 1) { msg_warn("disabling connection caching"); diff --git a/postfix/src/global/verify_clnt.c b/postfix/src/global/verify_clnt.c index 916cce3fc..7468c1f0c 100644 --- a/postfix/src/global/verify_clnt.c +++ b/postfix/src/global/verify_clnt.c @@ -96,6 +96,7 @@ int verify_clnt_query(const char *addr, int *addr_status, VSTRING *why) { VSTREAM *stream; int request_status; + int count = 0; /* * Do client-server plumbing. @@ -109,6 +110,7 @@ int verify_clnt_query(const char *addr, int *addr_status, VSTRING *why) for (;;) { stream = clnt_stream_access(vrfy_clnt); errno = 0; + count += 1; if (attr_print(stream, ATTR_FLAG_NONE, ATTR_TYPE_STR, MAIL_ATTR_REQ, VRFY_REQ_QUERY, ATTR_TYPE_STR, MAIL_ATTR_ADDR, addr, @@ -119,7 +121,7 @@ int verify_clnt_query(const char *addr, int *addr_status, VSTRING *why) ATTR_TYPE_INT, MAIL_ATTR_ADDR_STATUS, addr_status, ATTR_TYPE_STR, MAIL_ATTR_WHY, why, ATTR_TYPE_END) != 3) { - if (msg_verbose || (errno != EPIPE && errno != ENOENT)) + if (msg_verbose || count > 1 || (errno && errno != EPIPE && errno != ENOENT)) msg_warn("problem talking to service %s: %m", var_verify_service); } else { diff --git a/postfix/src/local/Makefile.in b/postfix/src/local/Makefile.in index 486f206e7..bd9814b5f 100644 --- a/postfix/src/local/Makefile.in +++ b/postfix/src/local/Makefile.in @@ -24,7 +24,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/master/Makefile.in b/postfix/src/master/Makefile.in index ba4658c9c..2138f0a48 100644 --- a/postfix/src/master/Makefile.in +++ b/postfix/src/master/Makefile.in @@ -27,7 +27,7 @@ all: $(PROG) $(LIB) $(OBJS) $(LIB_OBJ): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) diff --git a/postfix/src/milter/Makefile.in b/postfix/src/milter/Makefile.in index fb507c9cf..4b10cda9b 100644 --- a/postfix/src/milter/Makefile.in +++ b/postfix/src/milter/Makefile.in @@ -21,7 +21,7 @@ all: $(LIB) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/milter/milter8.c b/postfix/src/milter/milter8.c index 2fe60af83..f5ac7240a 100644 --- a/postfix/src/milter/milter8.c +++ b/postfix/src/milter/milter8.c @@ -877,6 +877,7 @@ static const char *milter8_event(MILTER8 *milter, int event, int skip_reply, ARGV *macros,...) { + const char *myname = "milter8_event"; va_list ap; ssize_t data_len; int err; @@ -890,6 +891,17 @@ static const char *milter8_event(MILTER8 *milter, int event, #define DONT_SKIP_REPLY 0 + /* + * Sanity check. + */ + if (milter->fp == 0 || milter->def_reply != 0) { + msg_warn("%s: attempt to send event %s to milter %s after error", + myname, + (smfic_name = str_name_code(smfic_table, event)) != 0 ? + smfic_name : "(unknown MTA event)", milter->m.name); + return (milter->def_reply); + } + /* * Skip this event if it doesn't exist in the protocol that I announced. */ @@ -1204,7 +1216,7 @@ static const char *milter8_event(MILTER8 *milter, int event, (ssize_t) index, STR(milter->buf)); if (edit_resp) - return (milter8_def_reply(milter, edit_resp)); + return (edit_resp); continue; #endif @@ -1222,7 +1234,7 @@ static const char *milter8_event(MILTER8 *milter, int event, STR(milter->buf), STR(milter->body)); if (edit_resp) - return (milter8_def_reply(milter, edit_resp)); + return (edit_resp); continue; /* @@ -1251,7 +1263,7 @@ static const char *milter8_event(MILTER8 *milter, int event, STR(milter->buf), STR(milter->body)); if (edit_resp) - return (milter8_def_reply(milter, edit_resp)); + return (edit_resp); continue; #endif @@ -1267,7 +1279,7 @@ static const char *milter8_event(MILTER8 *milter, int event, edit_resp = parent->add_rcpt(parent->chg_context, STR(milter->buf)); if (edit_resp) - return (milter8_def_reply(milter, edit_resp)); + return (edit_resp); continue; /* @@ -1282,7 +1294,7 @@ static const char *milter8_event(MILTER8 *milter, int event, edit_resp = parent->del_rcpt(parent->chg_context, STR(milter->buf)); if (edit_resp) - return (milter8_def_reply(milter, edit_resp)); + return (edit_resp); continue; /* @@ -1299,7 +1311,7 @@ static const char *milter8_event(MILTER8 *milter, int event, edit_resp = parent->repl_body(parent->chg_context, milter->body); if (edit_resp) - return (milter8_def_reply(milter, edit_resp)); + return (edit_resp); continue; #endif } @@ -1946,6 +1958,16 @@ static void milter8_header(void *ptr, int unused_header_class, char *cp; int skip_reply; + /* + * XXX Workaround: mime_state_update() may invoke multiple call-backs + * before returning to the caller. + */ +#define MILTER8_MESSAGE_DONE(milter, msg_ctx) \ + ((milter)->state != MILTER8_STAT_MESSAGE || (msg_ctx)->resp != 0) + + if (MILTER8_MESSAGE_DONE(milter, msg_ctx)) + return; + /* * XXX Sendmail compatibility. Don't expose our first (received) header * to mail filter applications. See also cleanup_milter.c for code to @@ -2009,6 +2031,8 @@ static void milter8_eoh(void *ptr) MILTER_MSG_CONTEXT *msg_ctx = (MILTER_MSG_CONTEXT *) ptr; MILTER8 *milter = msg_ctx->milter; + if (MILTER8_MESSAGE_DONE(milter, msg_ctx)) + return; if (msg_verbose) msg_info("%s: eoh milter %s", myname, milter->m.name); msg_ctx->resp = @@ -2031,6 +2055,9 @@ static void milter8_body(void *ptr, int rec_type, ssize_t space; ssize_t count; + if (MILTER8_MESSAGE_DONE(milter, msg_ctx)) + return; + /* * XXX Sendmail compatibility: don't expose our first body line. */ @@ -2098,6 +2125,8 @@ static void milter8_eob(void *ptr) MILTER_MSG_CONTEXT *msg_ctx = (MILTER_MSG_CONTEXT *) ptr; MILTER8 *milter = msg_ctx->milter; + if (MILTER8_MESSAGE_DONE(milter, msg_ctx)) + return; if (msg_verbose) msg_info("%s: eob milter %s", myname, milter->m.name); msg_ctx->resp = @@ -2183,9 +2212,7 @@ static const char *milter8_message(MILTER *m, VSTREAM *qfile, msg_ctx.resp = "450 4.3.0 Queue file write error"; break; } - if (msg_ctx.resp != 0) - break; - if (milter->state != MILTER8_STAT_MESSAGE) + if (MILTER8_MESSAGE_DONE(milter, &msg_ctx)) break; if (rec_type != REC_TYPE_NORM && rec_type != REC_TYPE_CONT) break; diff --git a/postfix/src/oqmgr/Makefile.in b/postfix/src/oqmgr/Makefile.in index f3937eb56..1420a87e5 100644 --- a/postfix/src/oqmgr/Makefile.in +++ b/postfix/src/oqmgr/Makefile.in @@ -22,7 +22,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/oqmgr/qmgr_entry.c b/postfix/src/oqmgr/qmgr_entry.c index 3783a61f1..ccffdb0b0 100644 --- a/postfix/src/oqmgr/qmgr_entry.c +++ b/postfix/src/oqmgr/qmgr_entry.c @@ -237,7 +237,7 @@ void qmgr_entry_done(QMGR_ENTRY *entry, int which) #define FUDGE(x) ((x) * (var_qmgr_fudge / 100.0)) message->refcount--; if (message->rcpt_offset > 0 - && qmgr_recipient_count < FUDGE(var_qmgr_rcpt_limit)) + && qmgr_recipient_count < FUDGE(var_qmgr_rcpt_limit) - 100) qmgr_message_realloc(message); if (message->refcount == 0) qmgr_active_done(message); diff --git a/postfix/src/pickup/Makefile.in b/postfix/src/pickup/Makefile.in index ca118fcf6..f416e3cb1 100644 --- a/postfix/src/pickup/Makefile.in +++ b/postfix/src/pickup/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/pipe/Makefile.in b/postfix/src/pipe/Makefile.in index 1e10bd08f..f4e286670 100644 --- a/postfix/src/pipe/Makefile.in +++ b/postfix/src/pipe/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postalias/Makefile.in b/postfix/src/postalias/Makefile.in index a60ec6806..109dd6f71 100644 --- a/postfix/src/postalias/Makefile.in +++ b/postfix/src/postalias/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ update: ../../bin/$(PROG) diff --git a/postfix/src/postcat/Makefile.in b/postfix/src/postcat/Makefile.in index 04be39e01..e92b6b71f 100644 --- a/postfix/src/postcat/Makefile.in +++ b/postfix/src/postcat/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postconf/Makefile.in b/postfix/src/postconf/Makefile.in index e721b8db2..3002e2cf2 100644 --- a/postfix/src/postconf/Makefile.in +++ b/postfix/src/postconf/Makefile.in @@ -28,7 +28,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postdrop/Makefile.in b/postfix/src/postdrop/Makefile.in index fead147a3..178b14ba9 100644 --- a/postfix/src/postdrop/Makefile.in +++ b/postfix/src/postdrop/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postfix/Makefile.in b/postfix/src/postfix/Makefile.in index 543a684c7..f61f6703d 100644 --- a/postfix/src/postfix/Makefile.in +++ b/postfix/src/postfix/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postkick/Makefile.in b/postfix/src/postkick/Makefile.in index 261d6d080..527598be8 100644 --- a/postfix/src/postkick/Makefile.in +++ b/postfix/src/postkick/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postlock/Makefile.in b/postfix/src/postlock/Makefile.in index d46df3e14..b97c2b9d4 100644 --- a/postfix/src/postlock/Makefile.in +++ b/postfix/src/postlock/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postlog/Makefile.in b/postfix/src/postlog/Makefile.in index 65029b795..d0e135930 100644 --- a/postfix/src/postlog/Makefile.in +++ b/postfix/src/postlog/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postmap/Makefile.in b/postfix/src/postmap/Makefile.in index 3acf6f2db..a71a34f84 100644 --- a/postfix/src/postmap/Makefile.in +++ b/postfix/src/postmap/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ update: ../../bin/$(PROG) diff --git a/postfix/src/postqueue/Makefile.in b/postfix/src/postqueue/Makefile.in index f9b06cb93..51894330c 100644 --- a/postfix/src/postqueue/Makefile.in +++ b/postfix/src/postqueue/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/postsuper/Makefile.in b/postfix/src/postsuper/Makefile.in index 6200c3a5b..b131fe88b 100644 --- a/postfix/src/postsuper/Makefile.in +++ b/postfix/src/postsuper/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/proxymap/Makefile.in b/postfix/src/proxymap/Makefile.in index 4d84aa6da..565afbf6d 100644 --- a/postfix/src/proxymap/Makefile.in +++ b/postfix/src/proxymap/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/qmgr/Makefile.in b/postfix/src/qmgr/Makefile.in index f4b3dff9f..0f5489ebe 100644 --- a/postfix/src/qmgr/Makefile.in +++ b/postfix/src/qmgr/Makefile.in @@ -24,7 +24,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/qmgr/qmgr_job.c b/postfix/src/qmgr/qmgr_job.c index 30365f6a8..cc86d0b46 100644 --- a/postfix/src/qmgr/qmgr_job.c +++ b/postfix/src/qmgr/qmgr_job.c @@ -763,6 +763,16 @@ static QMGR_PEER *qmgr_job_peer_select(QMGR_JOB *job) QMGR_PEER *peer; QMGR_MESSAGE *message = job->message; + /* + * Workaround to prevent queue manager starvation until the last slow + * batch of multi-recipient mail is finished. Postfix 2.4 has a final + * solution, but that involves major changes. + */ + if (message->rcpt_offset != 0 + && message->rcpt_limit > message->rcpt_count - 100 + && message->refcount > 0) { + qmgr_message_realloc(message); + } if (HAS_ENTRIES(job) && (peer = qmgr_peer_select(job)) != 0) return (peer); diff --git a/postfix/src/qmgr/qmgr_message.c b/postfix/src/qmgr/qmgr_message.c index aa71e1907..dcb796df0 100644 --- a/postfix/src/qmgr/qmgr_message.c +++ b/postfix/src/qmgr/qmgr_message.c @@ -361,6 +361,9 @@ static int qmgr_message_read(QMGR_MESSAGE *message) if (recipient_limit < message->rcpt_limit) recipient_limit = message->rcpt_limit; } + /* Keep interrupt latency in check. */ + if (recipient_limit > 5000) + recipient_limit = 5000; if (recipient_limit <= 0) msg_panic("%s: no recipient slots available", message->queue_id); diff --git a/postfix/src/qmqpd/Makefile.in b/postfix/src/qmqpd/Makefile.in index 8b54f7e24..84c5523b8 100644 --- a/postfix/src/qmqpd/Makefile.in +++ b/postfix/src/qmqpd/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/scache/Makefile.in b/postfix/src/scache/Makefile.in index 8060c9c93..e5282e84f 100644 --- a/postfix/src/scache/Makefile.in +++ b/postfix/src/scache/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/sendmail/Makefile.in b/postfix/src/sendmail/Makefile.in index 27be129d7..cf9dbeeaa 100644 --- a/postfix/src/sendmail/Makefile.in +++ b/postfix/src/sendmail/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/showq/Makefile.in b/postfix/src/showq/Makefile.in index df28b0583..2783e9700 100644 --- a/postfix/src/showq/Makefile.in +++ b/postfix/src/showq/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/smtp/Makefile.in b/postfix/src/smtp/Makefile.in index dad89aae9..9b10ef251 100644 --- a/postfix/src/smtp/Makefile.in +++ b/postfix/src/smtp/Makefile.in @@ -23,7 +23,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/smtpd/Makefile.in b/postfix/src/smtpd/Makefile.in index 69ac49e33..a7a3e9c5d 100644 --- a/postfix/src/smtpd/Makefile.in +++ b/postfix/src/smtpd/Makefile.in @@ -25,7 +25,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/smtpstone/Makefile.in b/postfix/src/smtpstone/Makefile.in index 212fa78ec..fd86e89e1 100644 --- a/postfix/src/smtpstone/Makefile.in +++ b/postfix/src/smtpstone/Makefile.in @@ -17,7 +17,7 @@ all: $(PROG) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ smtp-sink: smtp-sink.o $(LIBS) $(CC) $(CFLAGS) -o $@ smtp-sink.o $(LIBS) $(SYSLIBS) @@ -114,14 +114,19 @@ qmqp-source.o: ../../include/vbuf.h qmqp-source.o: ../../include/vstream.h qmqp-source.o: ../../include/vstring.h qmqp-source.o: qmqp-source.c +smtp-sink.o: ../../include/chroot_uid.h smtp-sink.o: ../../include/events.h smtp-sink.o: ../../include/get_hostname.h smtp-sink.o: ../../include/inet_proto.h smtp-sink.o: ../../include/iostuff.h smtp-sink.o: ../../include/listen.h +smtp-sink.o: ../../include/mail_date.h +smtp-sink.o: ../../include/make_dirs.h smtp-sink.o: ../../include/msg.h smtp-sink.o: ../../include/msg_vstream.h +smtp-sink.o: ../../include/myaddrinfo.h smtp-sink.o: ../../include/mymalloc.h +smtp-sink.o: ../../include/myrand.h smtp-sink.o: ../../include/sane_accept.h smtp-sink.o: ../../include/smtp_stream.h smtp-sink.o: ../../include/stringops.h diff --git a/postfix/src/spawn/Makefile.in b/postfix/src/spawn/Makefile.in index bb5127200..24d2cc2fe 100644 --- a/postfix/src/spawn/Makefile.in +++ b/postfix/src/spawn/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/tls/Makefile.in b/postfix/src/tls/Makefile.in index 8b8d254bf..2c48df724 100644 --- a/postfix/src/tls/Makefile.in +++ b/postfix/src/tls/Makefile.in @@ -29,7 +29,7 @@ all: $(LIB) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/tlsmgr/Makefile.in b/postfix/src/tlsmgr/Makefile.in index 68cbe886c..05301e47b 100644 --- a/postfix/src/tlsmgr/Makefile.in +++ b/postfix/src/tlsmgr/Makefile.in @@ -19,7 +19,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../../makedefs && cat $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/trivial-rewrite/Makefile.in b/postfix/src/trivial-rewrite/Makefile.in index e8366c313..eadb385c0 100644 --- a/postfix/src/trivial-rewrite/Makefile.in +++ b/postfix/src/trivial-rewrite/Makefile.in @@ -23,7 +23,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/util/Makefile.in b/postfix/src/util/Makefile.in index aadfe11c9..9a9d8e730 100644 --- a/postfix/src/util/Makefile.in +++ b/postfix/src/util/Makefile.in @@ -110,7 +110,7 @@ all: $(LIB) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/verify/Makefile.in b/postfix/src/verify/Makefile.in index c454c6712..f9671f8da 100644 --- a/postfix/src/verify/Makefile.in +++ b/postfix/src/verify/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/virtual/Makefile.in b/postfix/src/virtual/Makefile.in index 55ee026a1..51360fe43 100644 --- a/postfix/src/virtual/Makefile.in +++ b/postfix/src/virtual/Makefile.in @@ -18,7 +18,7 @@ $(PROG): $(OBJS) $(LIBS) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/xsasl/Makefile.in b/postfix/src/xsasl/Makefile.in index 13d0eca2d..65aeb6894 100644 --- a/postfix/src/xsasl/Makefile.in +++ b/postfix/src/xsasl/Makefile.in @@ -25,7 +25,7 @@ all: $(LIB) $(OBJS): ../../conf/makedefs.out Makefile: Makefile.in - (cat ../../conf/makedefs.out $?) >$@ + cat ../../conf/makedefs.out $? >$@ test: $(TESTPROG) diff --git a/postfix/src/xsasl/xsasl_cyrus_client.c b/postfix/src/xsasl/xsasl_cyrus_client.c index bbaa7d15d..4e525e031 100644 --- a/postfix/src/xsasl/xsasl_cyrus_client.c +++ b/postfix/src/xsasl/xsasl_cyrus_client.c @@ -159,7 +159,7 @@ static int xsasl_cyrus_client_get_user(void *context, int unused_id, const char **result, unsigned *len) { - const char *myname = "xsasl_cyrus_get_user"; + const char *myname = "xsasl_cyrus_client_get_user"; XSASL_CYRUS_CLIENT *client = (XSASL_CYRUS_CLIENT *) context; if (msg_verbose) @@ -182,7 +182,7 @@ static int xsasl_cyrus_client_get_user(void *context, int unused_id, static int xsasl_cyrus_client_get_passwd(sasl_conn_t *conn, void *context, int id, sasl_secret_t **psecret) { - const char *myname = "xsasl_cyrus_get_passwd"; + const char *myname = "xsasl_cyrus_client_get_passwd"; XSASL_CYRUS_CLIENT *client = (XSASL_CYRUS_CLIENT *) context; int len;