From: Wietse Venema Date: Thu, 5 Oct 2000 05:00:00 +0000 (-0500) Subject: snapshot-20001005 X-Git-Tag: v20010228~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92472d4e5d430a33f47d099a0f472ebe2b3e66e5;p=thirdparty%2Fpostfix.git snapshot-20001005 --- diff --git a/postfix/ETRN_README b/postfix/ETRN_README index ec87fd504..4f5b1685f 100644 --- a/postfix/ETRN_README +++ b/postfix/ETRN_README @@ -17,17 +17,18 @@ The SMTP ETRN command was designed for sites that have intermittent Internet connectivity. With ETRN, a site can tell the mail server of its provider to "Please deliver all my mail now". -Postfix versions before 20001003 implemented the ETRN command in -a lame manner: they would attempt to deliver all queued mail. This -is slow on mail servers that queue mail for many customers. +Postfix versions before 20001005 implemented the ETRN command in +a lame manner: they simply attempted to deliver all queued mail. +This is slow on mail servers that queue mail for many customers. -As of version 20001003, Postfix has a faster ETRN implementation. -At the same time, the command "sendmail -qR" is now implemented by -sending an ETRN command to the local SMTP server. +As of version 20001005, Postfix has a fast ETRN implementation that +does not require Postfix to examine every queue file. The command +"sendmail -qR" is now implemented by sending an ETRN command to +the local SMTP server. -Postfix "fast ETRN/sendmail -qR" speeds up deliveries by looking -only at mail that is queued for a given destination site. Postfix -"slow ETRN" is still used as a fall-back method. +Postfix "fast ETRN/sendmail -qR" speeds up deliveries by attempting +to deliver only mail that is queued for a given destination site. +The old Postfix "slow ETRN" is still used as a fall-back method. How Postfix fast ETRN works =========================== @@ -46,10 +47,12 @@ only for destinations that Postfix is willing to relay mail to: fast_flush_policy = relay -The relay_domains parameter specifies what destinations Postfix -will relay to. For destinations without "fast ETRN/sendmail -qR" -service, Postfix falls back to the old "slow ETRN" which delivers -all queued mail. +The "relay_domains" parameter specifies what destinations Postfix +will relay to. + +For destinations that are not eligible for the new "fast ETRN/sendmail +-qR" service, Postfix falls back to the old "slow ETRN" method +which attempts to deliver all queued mail. To enable "fast ETRN/sendmail -qR" for all destinations, specify: @@ -69,16 +72,16 @@ mail logfiles. If you omit this step, the logfiles will eventually become populated as Postfix routinely attempts to deliver delayed mail, but that will take a couple hours. -To test the "fast ETRN" service, telnet to the Postfix SMTP server -from a client that is allowed to execute ETRN commands (by default, -that's every client), and type: +After the "sendmail -q" has completed all delivery attempts (that +can take a while), you're ready to test the "fast ETRN" service. +Telnet to the Postfix SMTP server from a client that is allowed to +execute ETRN commands (by default, that's every client), and type: helo my.client.name etrn some.customer.domain -where "some.customer.domain" is the name of a domain that your mail -server is willing to relay mail to, and that your server has some -mail queued for. +where "some.customer.domain" is the name of a domain that has a +non-empty logfile somewhere under /var/spool/postfix/flush. In the maillog file, you should immediately see a couple of logfile records, as evidence that the queue manager has opened queue files: @@ -89,15 +92,19 @@ records, as evidence that the queue manager has opened queue files: from=, size=4711, nrcpt=1 (queue active) What happens next depends on whether the destination is reachable. +If it's not reachable, the mail queue IDs will be added back to +the some.customer.domain logfile under /var/spool/postfix/flush. Repeat the exercise with another domain that your server is willing -to relay to, but that has no mail queued. +to relay to (domain listed in "relay_domains"), but that has no mail +queued. helo my.client.name etrn some.other.customer.domain -This time, the "etrn" command should not trigger any mail deliveries -at all. +This time, the "etrn" command should trigger NO mail deliveries at +all. If this triggers delivery of all mail, then you used the wrong +domain name, or "fast ETRN" service is turned off. Finally, repeat the exercise with a destination that your mail server is not willing to relay to. It does not matter if your diff --git a/postfix/HISTORY b/postfix/HISTORY index 27868f5c7..828ae4a3e 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -4330,13 +4330,26 @@ Apologies for any names omitted. 20001003 Feature: the fast flush refresh and purge time interval - parameters can now be specified in seconds or in user-specified - units by providing an appropriate suffix: s (seconds), m - (minutes), h (hours), d (days), w (weeks). unit. This - was needed so that I could test the flush server code in - a reasonable way. Other time parameters will be migrated - as time permits. Files: global/mail_conf_time.c, + parameters can now be specified in user-specified units by + providing an appropriate suffix: s (seconds), m (minutes), + h (hours), d (days), w (weeks). unit. This was needed so + that I could test the flush server code in a reasonable + way (its timeouts are normally specified in days or hours, + and I don't have that much time for testing). Other Postfix + time interval parameters will be migrated as time permits. + Files: conf/sample-flush.cf, global/mail_conf_time.c, postconf/postconf.c. Unfeature: qmgr_hog_factor is now disabled by default. It - was just too confusing. + was just too confusing. If you don't know what this means, + do not worry. + +20001005 + + Cleanup: after "postfix reload" do not penalize mail that + was in the active queue, but make it ready for immediate + delivery so that ETRN etc. works as intended. Files: + *qmgr/qmgr.c, *qmgr/qmgr_active.c. + + Portability: Redhat 7 library interfaces have changed + incompatibly, which breaks existing software. File makedefs. diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index dfa8a726f..c92903b46 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -1,4 +1,4 @@ -Incompatible changes with snapshot-20001003 +Incompatible changes with snapshot-20001005 =========================================== If this release does not work for you, you can go back to a previous @@ -10,43 +10,33 @@ Some recommended parameter settings have changed, and a new entry must be added to the master.cf file before you can start Postfix again. -After installing the new Postfix release: +1 - The recommended Postfix configuration no longer uses flat + directories for the "active", "bounce", and "defer" queue + directories. The "flush" directory for the new "flush" service + directory should not be flat either. -- Check the output from "postconf hash_queue_names". The recommended - setting now includes the names of the "active", "bounce", "defer", - and "flush" directories. + Upon start-up, Postfix checks if the hash_queue_names configuration + parameter is properly set up, and will add any queue directory + names that are missing. - If your setting does not contain at least these directory names, - either you need to remove the explicit setting from the main.cf - file (so that Postfix uses the recommended default setting), or - you need to update it. +2 - In order to improve performance of one-to-one mail deliveries + the queue manager will now look at up to 10000 queue files + (was: 1000). The default qmgr_message_active_limit setting + was changed accordingly. -- Check the output from "postconf qmgr_message_active_limit". The - recommended value has changed to 10000. + If you have a non-default qmgr_message_active_limit in main.cf, + you may want adjust it. - If your setting is lower, either you need to remove the explicit - setting from the main.cf file (so that Postfix uses the recommended - default setting), or you need to update it. +3 - The new "flush" service needs to be configured in master.cf. -- Add a new entry to the master.cf file for the new flush service: + Upon start-up, Postfix checks if the new "flush" service is + configured in the master.cf file, and will add an entry if it + is missing. - flush unix - - n 1000? 0 flush +Should you wish to back out to a previous Postfix release there is +no need to undo the above changes. - This entry is not needed if you won't use the fast flush service. - This service is used by default; to disable the fast flush service, - you need to specify in the main.cf file: - - fast_flush_policy = none - - In the new master.cf entry, the 1000? requests that the "fast - flush" service does some cleaning up every 15 minutes, but only - if the fast flush service is actually being used. The 0 means - that Postfix should run as many flush servers as are needed. - Changing this may cause deadlock. - -Now you can start Postfix again. - -Major changes with snapshot-20001001 +Major changes with snapshot-20001005 ==================================== In order to improve performance of one-to-one deliveries, Postfix @@ -57,9 +47,9 @@ SMTP ETRN command - it attempted to deliver all mail in the queue, regardless of its destination. This is slow if your mail server queues mail for lots of different destinations. -This release introduces fast "ETRN" and "sendmail -qR". Unlike -their lame predecessor, these deliver only mail that is queued for -the specified destinations. +This release introduces fast "ETRN" and "sendmail -qR". These +deliver only mail that is queued for the specified destination, +without requiring Postfix to open every file in the mail queue. Postfix now maintains per-destination logfiles with information about what mail is queued for specific destinations. By default, diff --git a/postfix/conf/main.cf b/postfix/conf/main.cf index ab0909982..92a27f328 100644 --- a/postfix/conf/main.cf +++ b/postfix/conf/main.cf @@ -356,8 +356,8 @@ mail_owner = postfix # # The fast_flush_policy controls what destinations are eligible for # this "fast ETRN/sendmail -qR" service. Specify "all" to make all -# destinations eligible, "relay" for relay destinations only, and -# "none" to turn this feature off. +# destinations eligible, "relay" for relay destinations only (the +# default), and "none" to turn this feature off. # #fast_flush_policy = all #fast_flush_policy = relay diff --git a/postfix/conf/postfix-script-nosgid b/postfix/conf/postfix-script-nosgid index 425fe6acd..25235a208 100755 --- a/postfix/conf/postfix-script-nosgid +++ b/postfix/conf/postfix-script-nosgid @@ -227,6 +227,31 @@ check) done done + # Look for incomplete upgrades. + + test -f $config_directory/master.cf || { + $FATAL no $config_directory/master.cf file found + exit 1 + } + grep 'flush.*flush' $config_directory/master.cf >/dev/null || { + $WARN adding missing entry for flush service to master.cf + cat >>$config_directory/master.cf </dev/null) || missing="$missing active" + (echo "$found" | grep bounce >/dev/null) || missing="$missing bounce" + (echo "$found" | grep defer >/dev/null) || missing="$missing defer" + (echo "$found" | grep flush >/dev/null) || missing="$missing flush" + test -n "$missing" && { + $WARN fixing main.cf hash_queue_names for missing $missing + $command_directory/postconf -e hash_queue_names="$found$missing" + } + + # See if all queue files are in the right place. + $command_directory/postsuper || exit 1 find corrupt -type f -exec $WARN damaged message: {} \; diff --git a/postfix/conf/postfix-script-sgid b/postfix/conf/postfix-script-sgid index 1c6231f13..2cf7f5c38 100755 --- a/postfix/conf/postfix-script-sgid +++ b/postfix/conf/postfix-script-sgid @@ -228,6 +228,32 @@ check) done done + # Look for incomplete upgrades. + + test -f $config_directory/master.cf || { + $FATAL no $config_directory/master.cf file found + exit 1 + } + grep 'flush.*flush' $config_directory/master.cf >/dev/null || { + $WARN adding missing entry for flush service to master.cf + cat >>$config_directory/master.cf </dev/null) || missing="$missing active" + (echo "$found" | grep bounce >/dev/null) || missing="$missing bounce" + (echo "$found" | grep defer >/dev/null) || missing="$missing defer" + (echo "$found" | grep flush >/dev/null) || missing="$missing flush" + test -n "$missing" && { + $WARN fixing main.cf hash_queue_names for missing $missing + $command_directory/postconf -e hash_queue_names="$found$missing" + } + + # See if all queue files are in the right place. + + $command_directory/postsuper || exit 1 find corrupt -type f -exec $WARN damaged message: {} \; diff --git a/postfix/conf/sample-flush.cf b/postfix/conf/sample-flush.cf index 0d6bb8154..0cc0105aa 100644 --- a/postfix/conf/sample-flush.cf +++ b/postfix/conf/sample-flush.cf @@ -2,43 +2,47 @@ # HERE JUST SERVES AS AN EXAMPLE. # # This file contains example settings of Postfix parameters that -# control the fast flush service, which is the engine that implements -# ETRN and "sendmail -qR". +# control the fast flush service, which is the code that implements +# fast ETRN and fast "sendmail -qR". # The fast_flush_policy parameter specifies what destinations are # eligible for per-destination logfiles with mail that is queued to # those destinations. # -# When a destination is eligible, ETRN and "sendmail -qR" are -# implemented by delivering only messages that are queued for that -# destination (Postfix will deliver to all recipients of those -# messages, regardless of their destination). +# When a destination is eligible for "fast flush" logfiles, ETRN and +# "sendmail -qR" are implemented by delivering only messages that +# are listed in the logfile for that destination (in fact, Postfix +# will deliver to all recipients of those messages, regardless of +# their destination, but that is not an issue when you relay mail +# for an eligible site). # -# When a destination is not eligible, ETRN and "sendmail -qR" are -# implemented simply by attempting to deliver all queued mail. +# When a destination is not eligible for "fast flush" logfiles, ETRN +# and "sendmail -qR" are implemented simply by attempting to deliver +# all queued mail. That's the slow service that Postfix used to +# implement before 20001005. # -# By default, Postfix maintains per-destination deferred mail logfiles -# only for destinations that the Postfix SMTP server is willing to -# relay to (see the relay_domains parameter in sample-smtpd.cf). +# By default, Postfix maintains "fast flush" logfiles only for +# destinations that the Postfix SMTP server is willing to relay to +# (see the relay_domains parameter in sample-smtpd.cf). # -# Specify "all" to enable per-destination deferred mail logfiles -# for all destinations, "none" to disable the logfiles altogether. +# Specify "all" to enable "fast flush" logfiles for all destinations, +# "none" to disable the logfiles altogether. # #fast_flush_policy = all fast_flush_policy = relay #fast_flush_policy = none -# The fast_flush_purge_delay parameter controls how long an empty -# per-destination deferred mail logfile is allowed to live. +# The fast_flush_purge_time parameter controls how long an empty +# per-destination "fast flush" logfile is allowed to live. # # You can specify the time as a number, or as a number followed by # a letter that indicates the time unit: s=seconds, m=minutes, h=hours, # d=days, w=weeks. The default time unit is days. # -fast_flush_purge_delay = 7d +fast_flush_purge_time = 7d -# The fast_flush_refresh_delay parameter controls how long a non-empty -# per-destination deferred mail logfile is allowed to remain unread +# The fast_flush_refresh_time parameter controls how long a non-empty +# per-destination "fast flush" logfile is allowed to remain unread # before its contents need to be refreshed. The contents of a logfile # are refreshed by requesting delivery of messages listed in the # logfile. @@ -47,4 +51,4 @@ fast_flush_purge_delay = 7d # a letter that indicates the time unit: s=seconds, m=minutes, h=hours, # d=days, w=weeks. The default time unit is hours. # -fast_flush_refresh_delay = 12h +fast_flush_refresh_time = 12h diff --git a/postfix/html/flush.8.html b/postfix/html/flush.8.html index 5f00b04ae..e8f8d77f3 100644 --- a/postfix/html/flush.8.html +++ b/postfix/html/flush.8.html @@ -6,7 +6,7 @@ FLUSH(8) FLUSH(8) NAME - flush - Postfix fast flush cache manager + flush - Postfix fast flush server SYNOPSIS flush [generic Postfix daemon options] @@ -27,7 +27,7 @@ FLUSH(8) FLUSH(8) Per-destination logfiles of deferred mail are maintained only for eligible destinations. The policy is specified - with the fast_flush_cache_policy configuration parameter: + with the fast_flush_policy configuration parameter: all Maintain per-destination logfiles for all destina- tions. @@ -43,21 +43,21 @@ FLUSH(8) FLUSH(8) This server implements the following requests: FLUSH_REQ_ADD sitename queue_id - Inform the cache manager that the specified message - is queued for sitename. Depending on caching pol- - icy, the cache manager stores or ignores the infor- - mation. + Inform the fast flush server that the specified + message is queued for sitename. Depending on log- + ging policy, the fast flush server stores or + ignores the information. FLUSH_REQ_SEND sitename Request delivery of mail that is queued for site- name. If the destination is eligible for a fast flush logfile, this request triggers delivery of - specific messages; the per-destination logfile is - truncated to zero length; if mail is undeliverable, - it will be logged to the per-destination logfile. + messages listed in that destination's logfile, and + the logfile is truncated to zero length; if mail is + undeliverable it will be added back to the logfile. If the destination is not eligible for a fast flush - logfile, this request triggers delivery of all + logfile, this request triggers delivery of all queued mail. @@ -72,33 +72,27 @@ FLUSH(8) FLUSH(8) TRIGGER_REQ_WAKEUP - This wakeup request from the master is an alterna- + This wakeup request from the master is an alterna- tive way to request FLUSH_REQ_REFRESH. FLUSH_REQ_REFRESH (completes in the background) Refresh non-empty per-destination logfiles that - were not read in $fast_flush_refresh_delay hours, - by simulating send requests (see above) for the - corresponding destinations. + were not read in $fast_flush_refresh_time hours, by + simulating send requests (see above) for the corre- + sponding destinations. Delete empty per-destination logfiles that were not - updated in fast_flush_purge_delay days. + updated in fast_flush_purge_time days. FLUSH_REQ_PURGE (completes in the background) - Refresh all non-empty per-destination logfiles, by + Refresh all non-empty per-destination logfiles, by simulating send requests (see above) for the corre- sponding destinations. This can be incredibly - expensive when caching is enabled for all deferred + expensive when logging is enabled for all deferred mail, and is not recommended. Delete empty per-destination logfiles that were not - updated in fast_flush_purge_delay days. - - Fast flush logfiles are truncated only after a - FLUSH_REQ_SEND request, not when mail is actually deliv- - ered, and therefore can accumulate outdated or redundant - data. In order to maintain sanity, FLUSH_REQ_REFRESH must - be executed periodically. + updated in fast_flush_purge_time days. The server response is one of: @@ -106,25 +100,31 @@ FLUSH(8) FLUSH(8) The request completed normally. FLUSH_STAT_BAD - The flush server rejected the request (bad request + The flush server rejected the request (bad request name, bad request parameter value). FLUSH_STAT_FAIL The request failed. SECURITY - The fast flush server is not security-sensitive. It does - not talk to the network, and it does not talk to local - users. The fast flush server can run chrooted at fixed + The fast flush server is not security-sensitive. It does + not talk to the network, and it does not talk to local + users. The fast flush server can run chrooted at fixed low privilege. DIAGNOSTICS Problems and transactions are logged to syslogd(8). BUGS - In reality, this server schedules delivery of all recipi- - ents of a deferred message. This limitation is due to the - fact that one queue runner has to handle mail for multiple + Fast flush logfiles are truncated only after a + FLUSH_REQ_SEND request, not when mail is actually deliv- + ered, and therefore can accumulate outdated or redundant + data. In order to maintain sanity, FLUSH_REQ_REFRESH must + be executed periodically. This can be automated with a + suitable wakeup timer setting in the master.cf configura- + tion file. + + Upon receipt of a request to deliver all mail for an @@ -137,7 +137,12 @@ FLUSH(8) FLUSH(8) FLUSH(8) FLUSH(8) - destinations. + eligible destination, this server requests delivery of all + messages that are listed in that destination's logfile, + regardless of the recipients of those messages. This is + not an issue for mail that is sent to a relay_domains des- + tination because such mail typically only has recipients + in one domain. FILES /var/spool/postfix/flush, location of "fast flush" logfiles. @@ -147,17 +152,17 @@ FLUSH(8) FLUSH(8) default values. Use the postfix reload command after a configuration change. - fast_flush_cache_policy + fast_flush_policy What destinations can have a "fast flush" logfile: all, relay (relay destinations) or none. - fast_flush_refresh_delay + fast_flush_refresh_time Refresh a non-empty "fast flush" logfile that was not read in this amount of time (default time unit: hours), by simulating a send request for the corre- sponding destination. - fast_flush_purge_delay + fast_flush_purge_time Remove an empty "fast flush" logfile that was not updated in this amount of time (default time unit: days). @@ -189,11 +194,6 @@ FLUSH(8) FLUSH(8) - - - - - 3 diff --git a/postfix/html/flushd.8.html b/postfix/html/flushd.8.html deleted file mode 100644 index 9da503d69..000000000 --- a/postfix/html/flushd.8.html +++ /dev/null @@ -1,134 +0,0 @@ -
-
-
-
-FLUSHD(8)                                               FLUSHD(8)
-
-
-NAME
-       flushd - Postfix fast flush daemon
-
-SYNOPSIS
-       flushd [generic Postfix daemon options]
-
-DESCRIPTION
-       The flush server maintains so-called "fast flush" logfiles
-       with information about what messages are queued for a spe-
-       cific  site.  This program expects to be run from the mas-
-       ter(8) process manager.
-
-       This server implements the following requests:
-
-       FLUSH_REQ_ADD sitename queue_id
-              Append queue_id to the fast flush log for the spec-
-              ified site.
-
-       FLUSH_REQ_SEND sitename
-              Arrange  for  the delivery of all messages that are
-              listed in the fast flush logfile for the  specified
-              site.   After the logfile is processed, the file is
-              truncated to length zero.
-
-       The response to the client is one of:
-
-       FLUSH_STAT_OK
-              The request completed normally.
-
-       FLUSH_STAT_BAD
-              The flush server rejected the request (bad  request
-              name, bad request parameter value).
-
-       FLUSH_STAT_UNKNOWN
-              The specified site has no fast flush log.
-
-       Fast  flush  logfiles  are  truncated  only  after a flush
-       request. In order to prevent fast flush logs from  growing
-       too  large, and to prevent them from accumulating too much
-       outdated information, the flush service generates  a  pro-
-       active   flush   request  once  every  every  1000  append
-       requests. This should not impact operation.
-
-SECURITY
-       The fast flush server is moderately security-sensitive. It
-       does  not  talk  to the network, but it does talk to local
-       unprivileged users, in order to emulate "sendmail -qRsite"
-       behavior.   For  this  reason all strings in a request are
-       truncated at line_length_limit, before they are  subjected
-       to further validation.
-
-       The fast flush server can run chrooted at fixed low privi-
-       lege.
-
-
-
-
-                                                                1
-
-
-
-
-
-FLUSHD(8)                                               FLUSHD(8)
-
-
-DIAGNOSTICS
-       Problems and transactions are logged to syslogd(8).
-
-BUGS
-       In reality, this server schedules  delivery  of  messages,
-       regardless of their destination. This limitation is due to
-       the fact that one queue runner has to handle mail for mul-
-       tiple destinations.
-
-CONFIGURATION PARAMETERS
-       The  following  main.cf parameters are especially relevant
-       to this program. See the Postfix main.cf file  for  syntax
-       details  and  for  default  values. Use the postfix reload
-       command after a configuration change.
-
-       line_length_limit
-              Maximal length of strings in a  fast  flush  client
-              request.
-
-SEE ALSO
-       smtpd(8) Postfix SMTP server
-       qmgr(8) Postfix queue manager
-       syslogd(8) system logging
-
-LICENSE
-       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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-                                                                2
-
-
-
diff --git a/postfix/makedefs b/postfix/makedefs index 3cdbecfe1..706418591 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -159,15 +159,24 @@ case "$SYSTEM.$RELEASE" in *) echo "Unknown AIX version: `uname -v`." 1>&2; exit 1;; esac;; Linux.2*) SYSTYPE=LINUX2 - for name in db nsl resolv + if [ -f /usr/lib/lib/db-3.1.a -a -f /usr/include/db3/db_185.h ] + then + CCARGS="$CCARGS -DPATH_DB_H=''" + SYSLIBS="$SYSLIBS -ldb-3.1" + else + if [ -f /usr/include/db_185.h ] + then + CCARGS="$CCARGS -DPATH_DB_H=''" + elif [ -f /usr/include/db/db.h ] + then + CCARGS="$CCARGS -DPATH_DB_H=''" + fi + test -f /usr/lib/libdb.a && SYSLIBS="$SYSLIBS -ldb" + fi + for name in nsl resolv do test -f /usr/lib/lib$name.a && SYSLIBS="$SYSLIBS -l$name" done - if [ -f /usr/include/db_185.h ]; then - CCARGS="$CCARGS -DPATH_DB_H=''" - elif [ -f /usr/include/db/db.h ]; then - CCARGS="$CCARGS -DPATH_DB_H=''" - fi ;; IRIX*.5.*) SYSTYPE=IRIX5 # Use the native compiler by default diff --git a/postfix/man/man8/flush.8 b/postfix/man/man8/flush.8 index ddf141ef5..b3b0cc22b 100644 --- a/postfix/man/man8/flush.8 +++ b/postfix/man/man8/flush.8 @@ -4,7 +4,7 @@ .SH NAME flush \- -Postfix fast flush cache manager +Postfix fast flush server .SH SYNOPSIS .na .nf @@ -28,7 +28,7 @@ an email address. Per-destination logfiles of deferred mail are maintained only for eligible destinations. The policy is specified with the -\fBfast_flush_cache_policy\fR configuration parameter: +\fBfast_flush_policy\fR configuration parameter: .IP \fBall\fR Maintain per-destination logfiles for all destinations. .IP "\fBrelay\fR (default policy)" @@ -40,16 +40,15 @@ Do not maintain per-destination logfiles. .PP This server implements the following requests: .IP "\fBFLUSH_REQ_ADD\fI sitename queue_id\fR" -Inform the cache manager that the specified message is queued for -\fIsitename\fR. Depending on caching policy, the cache manager +Inform the fast flush server that the specified message is queued for +\fIsitename\fR. Depending on logging policy, the fast flush server stores or ignores the information. .IP "\fBFLUSH_REQ_SEND\fI sitename\fR" Request delivery of mail that is queued for \fIsitename\fR. If the destination is eligible for a fast flush logfile, -this request triggers delivery of specific messages; the -per-destination logfile is truncated to zero length; if mail -is undeliverable, it will be logged to the per-destination -logfile. +this request triggers delivery of messages listed in that +destination's logfile, and the logfile is truncated to zero length; +if mail is undeliverable it will be added back to the logfile. .sp If the destination is not eligible for a fast flush logfile, this request triggers delivery of all queued mail. @@ -58,25 +57,20 @@ This wakeup request from the master is an alternative way to request \fBFLUSH_REQ_REFRESH\fR. .IP "\fBFLUSH_REQ_REFRESH\fR (completes in the background)" Refresh non-empty per-destination logfiles that were not read in -$\fBfast_flush_refresh_delay\fR hours, by simulating +$\fBfast_flush_refresh_time\fR hours, by simulating send requests (see above) for the corresponding destinations. .sp Delete empty per-destination logfiles that were not updated in -\fBfast_flush_purge_delay\fR days. +\fBfast_flush_purge_time\fR days. .IP "\fBFLUSH_REQ_PURGE\fR (completes in the background)" Refresh all non-empty per-destination logfiles, by simulating send requests (see above) for the corresponding destinations. -This can be incredibly expensive when caching is enabled for +This can be incredibly expensive when logging is enabled for all deferred mail, and is not recommended. .sp Delete empty per-destination logfiles that were not updated in -\fBfast_flush_purge_delay\fR days. +\fBfast_flush_purge_time\fR days. .PP -Fast flush logfiles are truncated only after a \fBFLUSH_REQ_SEND\fR -request, not when mail is actually delivered, and therefore can -accumulate outdated or redundant data. In order to maintain sanity, -\fBFLUSH_REQ_REFRESH\fR must be executed periodically. - The server response is one of: .IP \fBFLUSH_STAT_OK\fR The request completed normally. @@ -100,9 +94,19 @@ Problems and transactions are logged to \fBsyslogd\fR(8). .SH BUGS .ad .fi -In reality, this server schedules delivery of all recipients -of a deferred message. This limitation is due to the fact that -one queue runner has to handle mail for multiple destinations. +Fast flush logfiles are truncated only after a \fBFLUSH_REQ_SEND\fR +request, not when mail is actually delivered, and therefore can +accumulate outdated or redundant data. In order to maintain sanity, +\fBFLUSH_REQ_REFRESH\fR must be executed periodically. This can +be automated with a suitable wakeup timer setting in the +\fBmaster.cf\fR configuration file. + +Upon receipt of a request to deliver all mail for an eligible +destination, this server requests delivery of all messages that +are listed in that destination's logfile, regardless of the +recipients of those messages. This is not an issue for mail +that is sent to a \fBrelay_domains\fR destination because +such mail typically only has recipients in one domain. .SH FILES .na .nf @@ -115,14 +119,14 @@ one queue runner has to handle mail for multiple destinations. See the Postfix \fBmain.cf\fR file for syntax details and for default values. Use the \fBpostfix reload\fR command after a configuration change. -.IP \fBfast_flush_cache_policy\fR +.IP \fBfast_flush_policy\fR What destinations can have a "fast flush" logfile: \fBall\fR, \fBrelay\fR (relay destinations) or \fBnone\fR. -.IP \fBfast_flush_refresh_delay\fR +.IP \fBfast_flush_refresh_time\fR Refresh a non-empty "fast flush" logfile that was not read in this amount of time (default time unit: hours), by simulating a send request for the corresponding destination. -.IP \fBfast_flush_purge_delay\fR +.IP \fBfast_flush_purge_time\fR Remove an empty "fast flush" logfile that was not updated in this amount of time (default time unit: days). .SH SEE ALSO diff --git a/postfix/man/man8/flushd.8 b/postfix/man/man8/flushd.8 deleted file mode 100644 index 2f186738d..000000000 --- a/postfix/man/man8/flushd.8 +++ /dev/null @@ -1,94 +0,0 @@ -.TH FLUSHD 8 -.ad -.fi -.SH NAME -flushd -\- -Postfix fast flush daemon -.SH SYNOPSIS -.na -.nf -\fBflushd\fR [generic Postfix daemon options] -.SH DESCRIPTION -.ad -.fi -The flush server maintains so-called "fast flush" logfiles with -information about what messages are queued for a specific site. -This program expects to be run from the \fBmaster\fR(8) process -manager. - -This server implements the following requests: -.IP "\fBFLUSH_REQ_ADD\fI sitename queue_id\fR" -Append \fIqueue_id\fR to the fast flush log for the -specified site. -.IP "\fBFLUSH_REQ_SEND\fI sitename\fR" -Arrange for the delivery of all messages that are listed in the fast -flush logfile for the specified site. After the logfile is processed, -the file is truncated to length zero. -.PP -The response to the client is one of: -.IP \fBFLUSH_STAT_OK\fR -The request completed normally. -.IP \fBFLUSH_STAT_BAD\fR -The flush server rejected the request (bad request name, bad -request parameter value). -.IP \fBFLUSH_STAT_UNKNOWN\fR -The specified site has no fast flush log. -.PP -Fast flush logfiles are truncated only after a flush request. In -order to prevent fast flush logs from growing too large, and to -prevent them from accumulating too much outdated information, the -flush service generates a pro-active flush request once every -every 1000 append requests. This should not impact operation. -.SH SECURITY -.na -.nf -.ad -.fi -The fast flush server is moderately security-sensitive. It does not -talk to the network, but it does talk to local unprivileged users, in -order to emulate "sendmail -qRsite" behavior. For this reason all -strings in a request are truncated at \fIline_length_limit\fR, -before they are subjected to further validation. - -The fast flush server can run chrooted at fixed low privilege. -.SH DIAGNOSTICS -.ad -.fi -Problems and transactions are logged to \fBsyslogd\fR(8). -.SH BUGS -.ad -.fi -In reality, this server schedules delivery of messages, regardless -of their destination. This limitation is due to the fact that -one queue runner has to handle mail for multiple destinations. -.SH CONFIGURATION PARAMETERS -.na -.nf -.ad -.fi -The following \fBmain.cf\fR parameters are especially relevant to -this program. See the Postfix \fBmain.cf\fR file for syntax details -and for default values. Use the \fBpostfix reload\fR command after -a configuration change. -.IP \fBline_length_limit\fR -Maximal length of strings in a fast flush client request. -.SH SEE ALSO -.na -.nf -smtpd(8) Postfix SMTP server -qmgr(8) Postfix queue manager -syslogd(8) system logging -.SH LICENSE -.na -.nf -.ad -.fi -The Secure Mailer license must be distributed with this software. -.SH AUTHOR(S) -.na -.nf -Wietse Venema -IBM T.J. Watson Research -P.O. Box 704 -Yorktown Heights, NY 10598, USA diff --git a/postfix/src/flush/flush.c b/postfix/src/flush/flush.c index c1157b0ad..e763eb11c 100644 --- a/postfix/src/flush/flush.c +++ b/postfix/src/flush/flush.c @@ -2,7 +2,7 @@ /* NAME /* flush 8 /* SUMMARY -/* Postfix fast flush cache manager +/* Postfix fast flush server /* SYNOPSIS /* \fBflush\fR [generic Postfix daemon options] /* DESCRIPTION @@ -22,7 +22,7 @@ /* /* Per-destination logfiles of deferred mail are maintained only for /* eligible destinations. The policy is specified with the -/* \fBfast_flush_cache_policy\fR configuration parameter: +/* \fBfast_flush_policy\fR configuration parameter: /* .IP \fBall\fR /* Maintain per-destination logfiles for all destinations. /* .IP "\fBrelay\fR (default policy)" @@ -34,16 +34,15 @@ /* .PP /* This server implements the following requests: /* .IP "\fBFLUSH_REQ_ADD\fI sitename queue_id\fR" -/* Inform the cache manager that the specified message is queued for -/* \fIsitename\fR. Depending on caching policy, the cache manager +/* Inform the fast flush server that the specified message is queued for +/* \fIsitename\fR. Depending on logging policy, the fast flush server /* stores or ignores the information. /* .IP "\fBFLUSH_REQ_SEND\fI sitename\fR" /* Request delivery of mail that is queued for \fIsitename\fR. /* If the destination is eligible for a fast flush logfile, -/* this request triggers delivery of specific messages; the -/* per-destination logfile is truncated to zero length; if mail -/* is undeliverable, it will be logged to the per-destination -/* logfile. +/* this request triggers delivery of messages listed in that +/* destination's logfile, and the logfile is truncated to zero length; +/* if mail is undeliverable it will be added back to the logfile. /* .sp /* If the destination is not eligible for a fast flush logfile, /* this request triggers delivery of all queued mail. @@ -52,25 +51,20 @@ /* request \fBFLUSH_REQ_REFRESH\fR. /* .IP "\fBFLUSH_REQ_REFRESH\fR (completes in the background)" /* Refresh non-empty per-destination logfiles that were not read in -/* $\fBfast_flush_refresh_delay\fR hours, by simulating +/* $\fBfast_flush_refresh_time\fR hours, by simulating /* send requests (see above) for the corresponding destinations. /* .sp /* Delete empty per-destination logfiles that were not updated in -/* \fBfast_flush_purge_delay\fR days. +/* \fBfast_flush_purge_time\fR days. /* .IP "\fBFLUSH_REQ_PURGE\fR (completes in the background)" /* Refresh all non-empty per-destination logfiles, by simulating /* send requests (see above) for the corresponding destinations. -/* This can be incredibly expensive when caching is enabled for +/* This can be incredibly expensive when logging is enabled for /* all deferred mail, and is not recommended. /* .sp /* Delete empty per-destination logfiles that were not updated in -/* \fBfast_flush_purge_delay\fR days. +/* \fBfast_flush_purge_time\fR days. /* .PP -/* Fast flush logfiles are truncated only after a \fBFLUSH_REQ_SEND\fR -/* request, not when mail is actually delivered, and therefore can -/* accumulate outdated or redundant data. In order to maintain sanity, -/* \fBFLUSH_REQ_REFRESH\fR must be executed periodically. -/* /* The server response is one of: /* .IP \fBFLUSH_STAT_OK\fR /* The request completed normally. @@ -88,9 +82,19 @@ /* DIAGNOSTICS /* Problems and transactions are logged to \fBsyslogd\fR(8). /* BUGS -/* In reality, this server schedules delivery of all recipients -/* of a deferred message. This limitation is due to the fact that -/* one queue runner has to handle mail for multiple destinations. +/* Fast flush logfiles are truncated only after a \fBFLUSH_REQ_SEND\fR +/* request, not when mail is actually delivered, and therefore can +/* accumulate outdated or redundant data. In order to maintain sanity, +/* \fBFLUSH_REQ_REFRESH\fR must be executed periodically. This can +/* be automated with a suitable wakeup timer setting in the +/* \fBmaster.cf\fR configuration file. +/* +/* Upon receipt of a request to deliver all mail for an eligible +/* destination, this server requests delivery of all messages that +/* are listed in that destination's logfile, regardless of the +/* recipients of those messages. This is not an issue for mail +/* that is sent to a \fBrelay_domains\fR destination because +/* such mail typically only has recipients in one domain. /* FILES /* /var/spool/postfix/flush, location of "fast flush" logfiles. /* CONFIGURATION PARAMETERS @@ -99,14 +103,14 @@ /* See the Postfix \fBmain.cf\fR file for syntax details and for /* default values. Use the \fBpostfix reload\fR command after a /* configuration change. -/* .IP \fBfast_flush_cache_policy\fR +/* .IP \fBfast_flush_policy\fR /* What destinations can have a "fast flush" logfile: \fBall\fR, /* \fBrelay\fR (relay destinations) or \fBnone\fR. -/* .IP \fBfast_flush_refresh_delay\fR +/* .IP \fBfast_flush_refresh_time\fR /* Refresh a non-empty "fast flush" logfile that was not read in /* this amount of time (default time unit: hours), by simulating /* a send request for the corresponding destination. -/* .IP \fBfast_flush_purge_delay\fR +/* .IP \fBfast_flush_purge_time\fR /* Remove an empty "fast flush" logfile that was not updated in /* this amount of time (default time unit: days). /* SEE ALSO @@ -213,7 +217,7 @@ static int flush_policy_init(void) } } -/* flush_policy_ok - check caching policy */ +/* flush_policy_ok - check logging policy */ static int flush_policy_ok(const char *site) { @@ -243,7 +247,7 @@ static int flush_add_service(const char *site, const char *queue_id) msg_info("%s: site %s queue_id %s", myname, site, queue_id); /* - * If this site is not eligible for caching, just ignore the request. + * If this site is not eligible for logging, just ignore the request. */ if (flush_policy_ok(site) == 0) return (FLUSH_STAT_OK); @@ -304,7 +308,7 @@ static int flush_send_service(const char *site) msg_info("%s: site %s", myname, site); /* - * If this site is not eligible for caching, deliver all queued mail. + * If this site is not eligible for logging, deliver all queued mail. */ if (flush_policy_ok(site) == 0) return (mail_flush_deferred()); @@ -368,6 +372,12 @@ static int flush_send_service(const char *site) if (errno != ENOENT) msg_warn("%s: update %s time stamps: %m", myname, STR(queue_file)); + /* XXX Wart... */ + mail_queue_path(queue_file, MAIL_QUEUE_INCOMING, STR(queue_id)); + if (utime(STR(queue_file), &tbuf) < 0) + if (errno != ENOENT) + msg_warn("%s: update %s time stamps: %m", + myname, STR(queue_file)); } else if (mail_queue_rename(STR(queue_id), MAIL_QUEUE_DEFERRED, MAIL_QUEUE_INCOMING) < 0) { if (errno != ENOENT) diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 14ee16569..de7fbea98 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -1075,11 +1075,11 @@ extern char *var_fflush_policy; #define FFLUSH_POLICY_RELAY "relay" #define FFLUSH_POLICY_NONE "none" -#define VAR_FFLUSH_PURGE "fast_flush_purge_delay" +#define VAR_FFLUSH_PURGE "fast_flush_purge_time" #define DEF_FFLUSH_PURGE "7d" extern int var_fflush_purge; -#define VAR_FFLUSH_REFRESH "fast_flush_refresh_delay" +#define VAR_FFLUSH_REFRESH "fast_flush_refresh_time" #define DEF_FFLUSH_REFRESH "12h" extern int var_fflush_refresh; diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 8ced2ecfa..b5e97cb80 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Snapshot-20001004" +#define DEF_MAIL_VERSION "Snapshot-20001005" extern char *var_mail_version; /* LICENSE diff --git a/postfix/src/nqmgr/qmgr.c b/postfix/src/nqmgr/qmgr.c index 7c1d11a95..39705adbf 100644 --- a/postfix/src/nqmgr/qmgr.c +++ b/postfix/src/nqmgr/qmgr.c @@ -492,8 +492,7 @@ static void qmgr_post_init(char *unused_name, char **unused_argv) */ var_use_limit = 0; var_idle_limit = 0; - qmgr_move(MAIL_QUEUE_ACTIVE, MAIL_QUEUE_INCOMING, - event_time() + var_min_backoff_time); + qmgr_move(MAIL_QUEUE_ACTIVE, MAIL_QUEUE_INCOMING, event_time()); qmgr_incoming = qmgr_scan_create(MAIL_QUEUE_INCOMING); qmgr_deferred = qmgr_scan_create(MAIL_QUEUE_DEFERRED); qmgr_scan_request(qmgr_incoming, QMGR_SCAN_START); diff --git a/postfix/src/nqmgr/qmgr_active.c b/postfix/src/nqmgr/qmgr_active.c index 9ba5a7dab..89d44dada 100644 --- a/postfix/src/nqmgr/qmgr_active.c +++ b/postfix/src/nqmgr/qmgr_active.c @@ -128,7 +128,7 @@ static void qmgr_active_corrupt(const char *queue_id) /* qmgr_active_defer - defer queue file */ static void qmgr_active_defer(const char *queue_name, const char *queue_id, - int delay) + const char *dest_queue, int delay) { char *myname = "qmgr_active_defer"; const char *path; @@ -141,12 +141,12 @@ static void qmgr_active_defer(const char *queue_name, const char *queue_id, path = mail_queue_path((VSTRING *) 0, queue_name, queue_id); if (utime(path, &tbuf) < 0) msg_fatal("%s: update %s time stamps: %m", myname, path); - if (mail_queue_rename(queue_id, queue_name, MAIL_QUEUE_DEFERRED)) { + if (mail_queue_rename(queue_id, queue_name, dest_queue)) { if (errno != ENOENT) msg_fatal("%s: rename %s from %s to %s: %m", myname, - queue_id, queue_name, MAIL_QUEUE_DEFERRED); + queue_id, queue_name, dest_queue); msg_warn("%s: rename %s from %s to %s: %m", myname, - queue_id, queue_name, MAIL_QUEUE_DEFERRED); + queue_id, queue_name, dest_queue); } else if (msg_verbose) { msg_info("%s: defer %s", myname, queue_id); } @@ -217,7 +217,7 @@ void qmgr_active_feed(QMGR_SCAN *scan_info, const char *queue_id) scan_info->flags)) == 0) { qmgr_active_corrupt(queue_id); } else if (message == QMGR_MESSAGE_LOCKED) { - qmgr_active_defer(MAIL_QUEUE_ACTIVE, queue_id, var_min_backoff_time); + qmgr_active_defer(MAIL_QUEUE_ACTIVE, queue_id, MAIL_QUEUE_INCOMING, 60); } else { /* @@ -350,7 +350,8 @@ void qmgr_active_done(QMGR_MESSAGE *message) } else { delay = var_min_backoff_time; } - qmgr_active_defer(message->queue_name, message->queue_id, delay); + qmgr_active_defer(message->queue_name, message->queue_id, + MAIL_QUEUE_DEFERRED, delay); } /* diff --git a/postfix/src/qmgr/qmgr.c b/postfix/src/qmgr/qmgr.c index 374008e92..17f0473f3 100644 --- a/postfix/src/qmgr/qmgr.c +++ b/postfix/src/qmgr/qmgr.c @@ -455,8 +455,7 @@ static void qmgr_post_init(char *unused_name, char **unused_argv) */ var_use_limit = 0; var_idle_limit = 0; - qmgr_move(MAIL_QUEUE_ACTIVE, MAIL_QUEUE_INCOMING, - event_time() + var_min_backoff_time); + qmgr_move(MAIL_QUEUE_ACTIVE, MAIL_QUEUE_INCOMING, event_time()); qmgr_incoming = qmgr_scan_create(MAIL_QUEUE_INCOMING); qmgr_deferred = qmgr_scan_create(MAIL_QUEUE_DEFERRED); qmgr_scan_request(qmgr_incoming, QMGR_SCAN_START); diff --git a/postfix/src/qmgr/qmgr_active.c b/postfix/src/qmgr/qmgr_active.c index 9ba5a7dab..89d44dada 100644 --- a/postfix/src/qmgr/qmgr_active.c +++ b/postfix/src/qmgr/qmgr_active.c @@ -128,7 +128,7 @@ static void qmgr_active_corrupt(const char *queue_id) /* qmgr_active_defer - defer queue file */ static void qmgr_active_defer(const char *queue_name, const char *queue_id, - int delay) + const char *dest_queue, int delay) { char *myname = "qmgr_active_defer"; const char *path; @@ -141,12 +141,12 @@ static void qmgr_active_defer(const char *queue_name, const char *queue_id, path = mail_queue_path((VSTRING *) 0, queue_name, queue_id); if (utime(path, &tbuf) < 0) msg_fatal("%s: update %s time stamps: %m", myname, path); - if (mail_queue_rename(queue_id, queue_name, MAIL_QUEUE_DEFERRED)) { + if (mail_queue_rename(queue_id, queue_name, dest_queue)) { if (errno != ENOENT) msg_fatal("%s: rename %s from %s to %s: %m", myname, - queue_id, queue_name, MAIL_QUEUE_DEFERRED); + queue_id, queue_name, dest_queue); msg_warn("%s: rename %s from %s to %s: %m", myname, - queue_id, queue_name, MAIL_QUEUE_DEFERRED); + queue_id, queue_name, dest_queue); } else if (msg_verbose) { msg_info("%s: defer %s", myname, queue_id); } @@ -217,7 +217,7 @@ void qmgr_active_feed(QMGR_SCAN *scan_info, const char *queue_id) scan_info->flags)) == 0) { qmgr_active_corrupt(queue_id); } else if (message == QMGR_MESSAGE_LOCKED) { - qmgr_active_defer(MAIL_QUEUE_ACTIVE, queue_id, var_min_backoff_time); + qmgr_active_defer(MAIL_QUEUE_ACTIVE, queue_id, MAIL_QUEUE_INCOMING, 60); } else { /* @@ -350,7 +350,8 @@ void qmgr_active_done(QMGR_MESSAGE *message) } else { delay = var_min_backoff_time; } - qmgr_active_defer(message->queue_name, message->queue_id, delay); + qmgr_active_defer(message->queue_name, message->queue_id, + MAIL_QUEUE_DEFERRED, delay); } /* diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 62ba71dfa..201d4c249 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -1082,6 +1082,7 @@ static int etrn_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) * to perform the request. */ if (SMTPD_STAND_ALONE(state)) { + msg_warn("do not use ETRN in \"sendmail -bs\" mode"); smtpd_chat_reply(state, "458 Unable to queue messages"); return (-1); }