From 14313fe35c01108edec4580ac23e7a3a63d88e4d Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Fri, 23 Sep 2005 00:00:00 -0500 Subject: [PATCH] postfix-2.3-20050923 --- postfix/HISTORY | 26 +++++++- postfix/RELEASE_NOTES | 16 +++++ postfix/conf/aliases | 100 ++++++++++++++++------------ postfix/html/aliases.5.html | 96 +++++++++++++++----------- postfix/html/local.8.html | 39 ++++++++--- postfix/html/postconf.5.html | 42 ++++++++++-- postfix/html/qmqp-source.1.html | 10 ++- postfix/html/smtp-source.1.html | 30 ++++++--- postfix/man/man1/qmqp-source.1 | 6 ++ postfix/man/man1/smtp-source.1 | 10 ++- postfix/man/man5/aliases.5 | 17 ++++- postfix/man/man5/postconf.5 | 26 +++++++- postfix/man/man8/local.8 | 15 ++++- postfix/mantools/postlink | 3 + postfix/proto/aliases | 17 ++++- postfix/proto/postconf.proto | 34 ++++++++-- postfix/src/global/mail_params.h | 11 +++ postfix/src/global/mail_version.h | 2 +- postfix/src/lmtp/lmtp_sasl_glue.c | 65 +++++++++++++----- postfix/src/local/alias.c | 6 +- postfix/src/local/dotforward.c | 3 +- postfix/src/local/local.c | 19 +++++- postfix/src/local/mailbox.c | 3 +- postfix/src/local/maildir.c | 3 +- postfix/src/smtp/smtp_sasl_glue.c | 32 ++++++--- postfix/src/smtpd/smtpd_sasl_glue.c | 38 ++++++++--- postfix/src/smtpstone/Makefile.in | 4 ++ postfix/src/smtpstone/qmqp-source.c | 25 ++++++- postfix/src/smtpstone/smtp-source.c | 29 ++++++-- 29 files changed, 556 insertions(+), 171 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index d88540f36..7378cf24f 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -11133,7 +11133,31 @@ Apologies for any names omitted. Update: common code factored out into db_common.c, and adoption of Liviu Daia's connection aware MySQL quoting. - Files: dict_ldap.c, dict_mysql.c, dict_pgsql.c, db_common.c. + Patch by Victor Duchovni. Files: dict_ldap.c, dict_mysql.c, + dict_pgsql.c, db_common.c. + +20050923 + + Safety: don't update the local(8) delivery agent's idea of + the Delivered-To: address while expanding aliases or .forward + files. When an alias or .forward file changes the Delivered-To: + address, it ties up one queue file and one cleanup process + instance while mail is being forwarded. To get the old + behavior, specify "frozen_delivered_to = no". Problem + reported by Michael Tokarev, but found independently by + others. Files: local/local.c, local/aliases.c, local/dotforward.c, + local/mailbox.c, local/maildir.c. + + Cleanup: while expanding a local(8) alias that has an owner + alias, don't reset the owner-alias information when recursing + into an alias that has no owner alias. This produces better + error reports when delivering mail to nested aliases that + have an owner alias only at the top level. To get the old + behavior, specify "sticky_owner_alias = no". Problem + reported by Victor Duchovni. File: local/alias.c. + + Logging: additional SASL debug logging by Andreas Winkelmann. + Files: */*sasl_glue.c. Open problems: diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index e64f5dfe3..ce56ca140 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -17,6 +17,22 @@ Incompatibility with Postfix 2.1 and earlier If you upgrade from Postfix 2.1 or earlier, read RELEASE_NOTES-2.2 before proceeding. +Incompatibility with snapshot 20050923 +====================================== + +The Postfix local(8) delivery agent no longer updates its idea of +the Delivered-To: address while it expands aliases or .forward +files. With deeply nested aliases or .forward files, this can greatly +reduce the number of queue files and cleanup process instances. To +get the earlier behavior, specify "frozen_delivered_to = no". + +While expanding an alias that has an owner alias, the Postfix +local(8) delivery agent no longer resets the owner information when +it expands a subordinate alias that has no owner alias. This +produces better error reporting with nested aliases that have an +owner alias only at the top level. To get the earlier behavior, +specify "sticky_owner_alias = no". + Incompatibility with snapshot 20050828 ====================================== diff --git a/postfix/conf/aliases b/postfix/conf/aliases index 6738a155d..ef9cca165 100644 --- a/postfix/conf/aliases +++ b/postfix/conf/aliases @@ -36,7 +36,7 @@ abuse: postmaster # trap decode to catch security attacks decode: root -# ALIASES(5) ALIASES(5) +# ALIASES(5) ALIASES(5) # # NAME # aliases - Postfix local alias database format @@ -87,38 +87,39 @@ decode: root # # In addition, when an alias exists for owner-name, delivery # diagnostics are directed to that address, instead of to -# the originator. This is typically used to direct delivery -# errors to the owner of a mailing list, who is in a better -# position to deal with mailing list delivery problems than -# the originator of the undelivered mail. +# the originator of the message. This is typically used to +# direct delivery errors to the maintainer of a mailing +# list, who is in a better position to deal with mailing +# list delivery problems than the originator of the undeliv- +# ered mail. # # The value contains one or more of the following: # # address -# Mail is forwarded to address, which is compatible +# Mail is forwarded to address, which is compatible # with the RFC 822 standard. # # /file/name -# Mail is appended to /file/name. See local(8) for -# details of delivery to file. Delivery is not lim- -# ited to regular files. For example, to dispose of +# Mail is appended to /file/name. See local(8) for +# details of delivery to file. Delivery is not lim- +# ited to regular files. For example, to dispose of # unwanted mail, deflect it to /dev/null. # # |command -# Mail is piped into command. Commands that contain -# special characters, such as whitespace, should be -# enclosed between double quotes. See local(8) for +# Mail is piped into command. Commands that contain +# special characters, such as whitespace, should be +# enclosed between double quotes. See local(8) for # details of delivery to command. # # When the command fails, a limited amount of command -# output is mailed back to the sender. The file -# /usr/include/sysexits.h defines the expected exit -# status codes. For example, use |"exit 67" to simu- -# late a "user unknown" error, and |"exit 0" to +# output is mailed back to the sender. The file +# /usr/include/sysexits.h defines the expected exit +# status codes. For example, use |"exit 67" to simu- +# late a "user unknown" error, and |"exit 0" to # implement an expensive black hole. # # :include:/file/name -# Mail is sent to the destinations listed in the +# Mail is sent to the destinations listed in the # named file. Lines in :include: files have the same # syntax as the right-hand side of alias entries. # @@ -130,67 +131,82 @@ decode: root # # ADDRESS EXTENSION # When alias database search fails, and the recipient local- -# part contains the optional recipient delimiter (e.g., -# user+foo), the search is repeated for the unextended +# part contains the optional recipient delimiter (e.g., +# user+foo), the search is repeated for the unextended # address (e.g., user). # -# The propagate_unmatched_extensions parameter controls -# whether an unmatched address extension (+foo) is propa- +# The propagate_unmatched_extensions parameter controls +# whether an unmatched address extension (+foo) is propa- # gated to the result of table lookup. # # SECURITY -# The local(8) delivery agent disallows regular expression -# substitution of $1 etc. in alias_maps, because that would +# The local(8) delivery agent disallows regular expression +# substitution of $1 etc. in alias_maps, because that would # open a security hole. # -# The local(8) delivery agent will silently ignore requests -# to use the proxymap(8) server within alias_maps. Instead -# it will open the table directly. Before Postfix version -# 2.2, the local(8) delivery agent will terminate with a +# The local(8) delivery agent will silently ignore requests +# to use the proxymap(8) server within alias_maps. Instead +# it will open the table directly. Before Postfix version +# 2.2, the local(8) delivery agent will terminate with a # fatal error. # # CONFIGURATION PARAMETERS -# The following main.cf parameters are especially relevant. -# The text below provides only a parameter summary. See +# The following main.cf parameters are especially relevant. +# The text below provides only a parameter summary. See # postconf(5) for more details including examples. # # alias_database -# List of alias databases that are updated by the +# List of alias databases that are updated by the # newaliases(1) command. # # alias_maps -# List of alias databases queried by the local(8) +# List of alias databases queried by the local(8) # delivery agent. # # allow_mail_to_commands -# Restrict the usage of mail delivery to external +# Restrict the usage of mail delivery to external # command. # # allow_mail_to_files -# Restrict the usage of mail delivery to external +# Restrict the usage of mail delivery to external # file. # # expand_owner_alias # When delivering to an alias that has an owner- com- -# panion alias, set the envelope sender address to -# the right-hand side of the owner alias, instead +# panion alias, set the envelope sender address to +# the right-hand side of the owner alias, instead # using of the left-hand side address. # # propagate_unmatched_extensions -# A list of address rewriting or forwarding mecha- -# nisms that propagate an address extension from the -# original address to the result. Specify zero or -# more of canonical, virtual, alias, forward, +# A list of address rewriting or forwarding mecha- +# nisms that propagate an address extension from the +# original address to the result. Specify zero or +# more of canonical, virtual, alias, forward, # include, or generic. # # owner_request_special -# Give special treatment to owner-listname and list- +# Give special treatment to owner-listname and list- # name-request addresses. # # recipient_delimiter -# Delimiter that separates recipients from address +# Delimiter that separates recipients from address # extensions. # +# Available in Postfix version 2.3 and later: +# +# frozen_delivered_to +# Update the local(8) delivery agent's Delivered-To: +# address (see prepend_delivered_header) only once, +# at the start of a delivery; do not update the +# Delivered-To: address while expanding aliases or +# .forward files. +# +# sticky_owner_alias +# When expanding a local(8) alias that has an owner +# alias (see owner-name discussion above), use the +# owner information even when the expansion invokes a +# subordinate alias that has no owner alias. +# # STANDARDS # RFC 822 (ARPA Internet Text Messages) # @@ -215,4 +231,4 @@ decode: root # P.O. Box 704 # Yorktown Heights, NY 10598, USA # -# ALIASES(5) +# ALIASES(5) diff --git a/postfix/html/aliases.5.html b/postfix/html/aliases.5.html index bc8a0cd3f..ee57e794f 100644 --- a/postfix/html/aliases.5.html +++ b/postfix/html/aliases.5.html @@ -55,38 +55,39 @@ ALIASES(5) ALIASES(5) In addition, when an alias exists for owner-name, delivery diagnostics are directed to that address, instead of to - the originator. This is typically used to direct delivery - errors to the owner of a mailing list, who is in a better - position to deal with mailing list delivery problems than - the originator of the undelivered mail. + the originator of the message. This is typically used to + direct delivery errors to the maintainer of a mailing + list, who is in a better position to deal with mailing + list delivery problems than the originator of the undeliv- + ered mail. The value contains one or more of the following: address - Mail is forwarded to address, which is compatible + Mail is forwarded to address, which is compatible with the RFC 822 standard. /file/name - Mail is appended to /file/name. See local(8) for - details of delivery to file. Delivery is not lim- - ited to regular files. For example, to dispose of + Mail is appended to /file/name. See local(8) for + details of delivery to file. Delivery is not lim- + ited to regular files. For example, to dispose of unwanted mail, deflect it to /dev/null. |command - Mail is piped into command. Commands that contain - special characters, such as whitespace, should be - enclosed between double quotes. See local(8) for + Mail is piped into command. Commands that contain + special characters, such as whitespace, should be + enclosed between double quotes. See local(8) for details of delivery to command. When the command fails, a limited amount of command - output is mailed back to the sender. The file - /usr/include/sysexits.h defines the expected exit - status codes. For example, use |"exit 67" to simu- - late a "user unknown" error, and |"exit 0" to + output is mailed back to the sender. The file + /usr/include/sysexits.h defines the expected exit + status codes. For example, use |"exit 67" to simu- + late a "user unknown" error, and |"exit 0" to implement an expensive black hole. :include:/file/name - Mail is sent to the destinations listed in the + Mail is sent to the destinations listed in the named file. Lines in :include: files have the same syntax as the right-hand side of alias entries. @@ -98,67 +99,82 @@ ALIASES(5) ALIASES(5) ADDRESS EXTENSION When alias database search fails, and the recipient local- - part contains the optional recipient delimiter (e.g., - user+foo), the search is repeated for the unextended + part contains the optional recipient delimiter (e.g., + user+foo), the search is repeated for the unextended address (e.g., user). - The propagate_unmatched_extensions parameter controls - whether an unmatched address extension (+foo) is propa- + The propagate_unmatched_extensions parameter controls + whether an unmatched address extension (+foo) is propa- gated to the result of table lookup. SECURITY - The local(8) delivery agent disallows regular expression - substitution of $1 etc. in alias_maps, because that would + The local(8) delivery agent disallows regular expression + substitution of $1 etc. in alias_maps, because that would open a security hole. - The local(8) delivery agent will silently ignore requests - to use the proxymap(8) server within alias_maps. Instead - it will open the table directly. Before Postfix version - 2.2, the local(8) delivery agent will terminate with a + The local(8) delivery agent will silently ignore requests + to use the proxymap(8) server within alias_maps. Instead + it will open the table directly. Before Postfix version + 2.2, the local(8) delivery agent will terminate with a fatal error. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant. - The text below provides only a parameter summary. See + The following main.cf parameters are especially relevant. + The text below provides only a parameter summary. See postconf(5) for more details including examples. alias_database - List of alias databases that are updated by the + List of alias databases that are updated by the newaliases(1) command. alias_maps - List of alias databases queried by the local(8) + List of alias databases queried by the local(8) delivery agent. allow_mail_to_commands - Restrict the usage of mail delivery to external + Restrict the usage of mail delivery to external command. allow_mail_to_files - Restrict the usage of mail delivery to external + Restrict the usage of mail delivery to external file. expand_owner_alias When delivering to an alias that has an owner- com- - panion alias, set the envelope sender address to - the right-hand side of the owner alias, instead + panion alias, set the envelope sender address to + the right-hand side of the owner alias, instead using of the left-hand side address. propagate_unmatched_extensions - A list of address rewriting or forwarding mecha- - nisms that propagate an address extension from the - original address to the result. Specify zero or - more of canonical, virtual, alias, forward, + A list of address rewriting or forwarding mecha- + nisms that propagate an address extension from the + original address to the result. Specify zero or + more of canonical, virtual, alias, forward, include, or generic. owner_request_special - Give special treatment to owner-listname and list- + Give special treatment to owner-listname and list- name-request addresses. recipient_delimiter - Delimiter that separates recipients from address + Delimiter that separates recipients from address extensions. + Available in Postfix version 2.3 and later: + + frozen_delivered_to + Update the local(8) delivery agent's Delivered-To: + address (see prepend_delivered_header) only once, + at the start of a delivery; do not update the + Delivered-To: address while expanding aliases or + .forward files. + + sticky_owner_alias + When expanding a local(8) alias that has an owner + alias (see owner-name discussion above), use the + owner information even when the expansion invokes a + subordinate alias that has no owner alias. + STANDARDS RFC 822 (ARPA Internet Text Messages) diff --git a/postfix/html/local.8.html b/postfix/html/local.8.html index 35990ec06..5bb9b37a7 100644 --- a/postfix/html/local.8.html +++ b/postfix/html/local.8.html @@ -377,6 +377,22 @@ LOCAL(8) LOCAL(8) sun_mailtool_compatibility (no) Obsolete SUN mailtool compatibility feature. + Available in Postfix version 2.3 and later: + + frozen_delivered_to (yes) + Update the local(8) delivery agent's idea of the + Delivered-To: address (see prepend_deliv- + ered_header) only once, at the start of a delivery + attempt; do not update the Delivered-To: address + while expanding aliases or .forward files. + + sticky_owner_alias (yes) + When expanding a local(8) alias that has an owner + alias (see owner-name discussion in aliases(5)), + use the owner information even when the expansion + invokes a subordinate alias that has no owner + alias. + DELIVERY METHOD CONTROLS The precedence of local(8) delivery methods from high to low is: aliases, .forward files, mailbox_transport, mail- @@ -536,22 +552,23 @@ LOCAL(8) LOCAL(8) prepend_delivered_header (command, file, forward) The message delivery contexts where the Postfix local(8) delivery agent prepends a Delivered-To: - message header. + message header with the address that the mail was + delivered to. process_id (read-only) - The process ID of a Postfix command or daemon + The process ID of a Postfix command or daemon process. process_name (read-only) - The process name of a Postfix command or daemon + The process name of a Postfix command or daemon process. propagate_unmatched_extensions (canonical, virtual) - What address lookup tables copy an address exten- + What address lookup tables copy an address exten- sion from the lookup key to the lookup result. queue_directory (see 'postconf -d' output) - The location of the Postfix top-level queue direc- + The location of the Postfix top-level queue direc- tory. recipient_delimiter (empty) @@ -559,15 +576,15 @@ LOCAL(8) LOCAL(8) sions (user+foo). require_home_directory (no) - Whether or not a local(8) recipient's home direc- - tory must exist before mail delivery is attempted. + Whether or not a local(8) recipient's home direc- + tory must exist before mail delivery is attempted. syslog_facility (mail) The syslog facility of Postfix logging. syslog_name (postfix) - The mail system name that is prepended to the - process name in syslog records, so that "smtpd" + The mail system name that is prepended to the + process name in syslog records, so that "smtpd" becomes, for example, "postfix/smtpd". FILES @@ -587,14 +604,14 @@ LOCAL(8) LOCAL(8) syslogd(8), system logging LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. HISTORY The Delivered-To: message header appears in the qmail sys- tem by Daniel Bernstein. - The maildir structure appears in the qmail system by + The maildir structure appears in the qmail system by Daniel Bernstein. AUTHOR(S) diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index f3ed03826..bccd8ed65 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -2474,6 +2474,24 @@ Examples: + + +
frozen_delivered_to +(default: yes)
+ +

Update the local(8) delivery agent's idea of the Delivered-To: +address (see prepend_delivered_header) only once, at the start of +a delivery attempt; do not update the Delivered-To: address while +expanding aliases or .forward files.

+ +

This feature is available in Postfix 2.3 and later. With older +Postfix releases, the behavior is as if this parameter is set to +"no". The old setting can be expensive with deeply nested aliases +or .forward files. When an alias or .forward file changes the +Delivered-To: address, it ties up one queue file and one cleanup +process instance while mail is being forwarded.

+ +
hash_queue_depth @@ -4636,10 +4654,10 @@ This feature is available in Postfix 2.0 and later.
prepend_delivered_header (default: command, file, forward)
-

-The message delivery contexts where the Postfix local(8) delivery -agent prepends a Delivered-To: message header. -

+

The message delivery contexts where the Postfix local(8) delivery +agent prepends a Delivered-To: message header with the address +that the mail was delivered to. This information is used for mail +delivery loop detection.

By default, the Postfix local delivery agent prepends a Delivered-To: @@ -9131,6 +9149,22 @@ The default time unit is s (seconds).

+
+ +
sticky_owner_alias +(default: yes)
+ +

When expanding a local(8) alias that has an owner alias (see +owner-name discussion in aliases(5)), use the owner information +even when the expansion invokes a subordinate alias that has no +owner alias.

+ +

This feature is available in Postfix 2.3 and later. With older +Postfix releases, the behavior is as if this parameter is set to +"no". The old setting provides poorer error reporting with nested +aliases that only have an owner alias at the top level.

+ +
strict_7bit_headers diff --git a/postfix/html/qmqp-source.1.html b/postfix/html/qmqp-source.1.html index e92b801f9..27e8fa47b 100644 --- a/postfix/html/qmqp-source.1.html +++ b/postfix/html/qmqp-source.1.html @@ -51,6 +51,11 @@ QMQP-SOURCE(1) QMQP-SOURCE(1) -m message_count Send the specified number of messages (default: 1). + -M myhostname + Use the specified hostname or [address] in the + default sender and recipient addresses, instead of + the machine hostname. + -r recipient_count Send the specified number of recipients per trans- action (default: 1). Recipient names are generated @@ -68,6 +73,9 @@ QMQP-SOURCE(1) QMQP-SOURCE(1) between messages. Suspending one thread does not affect other delivery threads. + -v Make the program more verbose, for debugging pur- + poses. + -w interval Wait a fixed time between messages. Suspending one thread does not affect other delivery threads. @@ -76,7 +84,7 @@ QMQP-SOURCE(1) QMQP-SOURCE(1) qmqp-sink(1), QMQP message dump LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) diff --git a/postfix/html/smtp-source.1.html b/postfix/html/smtp-source.1.html index 80abf7ffe..19e882d66 100644 --- a/postfix/html/smtp-source.1.html +++ b/postfix/html/smtp-source.1.html @@ -48,11 +48,8 @@ SMTP-SOURCE(1) SMTP-SOURCE(1) Use the specified sender address (default: <foo@myhostname>). - -o Old mode: don't send HELO, and don't send message - headers. - -l length - Send length bytes as message payload. The length + Send length bytes as message payload. The length does not include message headers. -L Speak LMTP rather than SMTP. @@ -60,13 +57,21 @@ SMTP-SOURCE(1) SMTP-SOURCE(1) -m message_count Send the specified number of messages (default: 1). - -N Prepend a non-repeating sequence number to each - recipient address. This avoids the artificial 100% - hit rate in the resolve and rewrite client caches - and exercises the trivial-rewrite daemon, better - approximating Postfix performance under real-life + -M myhostname + Use the specified hostname or [address] in the HELO + command and in the default sender and recipient + addresses, instead of the machine hostname. + + -N Prepend a non-repeating sequence number to each + recipient address. This avoids the artificial 100% + hit rate in the resolve and rewrite client caches + and exercises the trivial-rewrite daemon, better + approximating Postfix performance under real-life work-loads. + -o Old mode: don't send HELO, and don't send message + headers. + -r recipient_count Send the specified number of recipients per trans- action (default: 1). Recipient names are generated @@ -88,12 +93,15 @@ SMTP-SOURCE(1) SMTP-SOURCE(1) between messages. Suspending one thread does not affect other delivery threads. + -v Make the program more verbose, for debugging pur- + poses. + -w interval Wait a fixed time between messages. Suspending one thread does not affect other delivery threads. [inet:]host[:port] - Connect via TCP to host host, port port. The + Connect via TCP to host host, port port. The default port is smtp. unix:pathname @@ -106,7 +114,7 @@ SMTP-SOURCE(1) SMTP-SOURCE(1) smtp-sink(1), SMTP/LMTP message dump LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) diff --git a/postfix/man/man1/qmqp-source.1 b/postfix/man/man1/qmqp-source.1 index 31455c45d..668c595a8 100644 --- a/postfix/man/man1/qmqp-source.1 +++ b/postfix/man/man1/qmqp-source.1 @@ -43,6 +43,10 @@ Send \fIlength\fR bytes as message payload. The length includes the message headers. .IP "\fB-m \fImessage_count\fR" Send the specified number of messages (default: 1). +.IP "\fB-M \fImyhostname\fR" +Use the specified hostname or [address] in the default +sender and recipient addresses, instead of the machine +hostname. .IP "\fB-r \fIrecipient_count\fR" Send the specified number of recipients per transaction (default: 1). Recipient names are generated by prepending a number to the @@ -54,6 +58,8 @@ Use the specified recipient address (default: ). .IP "\fB-R \fIinterval\fR" Wait for a random period of time 0 <= n <= interval between messages. Suspending one thread does not affect other delivery threads. +.IP \fB-v\fR +Make the program more verbose, for debugging purposes. .IP "\fB-w \fIinterval\fR" Wait a fixed time between messages. Suspending one thread does not affect other delivery threads. diff --git a/postfix/man/man1/smtp-source.1 b/postfix/man/man1/smtp-source.1 index 2b588bdd2..594363cf7 100644 --- a/postfix/man/man1/smtp-source.1 +++ b/postfix/man/man1/smtp-source.1 @@ -43,8 +43,6 @@ Don't disconnect after sending a message; send the next message over the same connection. .IP "\fB-f \fIfrom\fR" Use the specified sender address (default: ). -.IP \fB-o\fR -Old mode: don't send HELO, and don't send message headers. .IP "\fB-l \fIlength\fR" Send \fIlength\fR bytes as message payload. The length does not include message headers. @@ -52,12 +50,18 @@ include message headers. Speak LMTP rather than SMTP. .IP "\fB-m \fImessage_count\fR" Send the specified number of messages (default: 1). +.IP "\fB-M \fImyhostname\fR" +Use the specified hostname or [address] in the HELO command +and in the default sender and recipient addresses, instead +of the machine hostname. .IP "\fB-N\fR" Prepend a non-repeating sequence number to each recipient address. This avoids the artificial 100% hit rate in the resolve and rewrite client caches and exercises the trivial-rewrite daemon, better approximating Postfix performance under real-life work-loads. +.IP \fB-o\fR +Old mode: don't send HELO, and don't send message headers. .IP "\fB-r \fIrecipient_count\fR" Send the specified number of recipients per transaction (default: 1). Recipient names are generated by prepending a number to the @@ -71,6 +75,8 @@ Use the specified recipient address (default: ). .IP "\fB-R \fIinterval\fR" Wait for a random period of time 0 <= n <= interval between messages. Suspending one thread does not affect other delivery threads. +.IP \fB-v\fR +Make the program more verbose, for debugging purposes. .IP "\fB-w \fIinterval\fR" Wait a fixed time between messages. Suspending one thread does not affect other delivery threads. diff --git a/postfix/man/man5/aliases.5 b/postfix/man/man5/aliases.5 index bd70ee64b..547906875 100644 --- a/postfix/man/man5/aliases.5 +++ b/postfix/man/man5/aliases.5 @@ -52,8 +52,9 @@ such as whitespace, `#', `:', or `@'. The \fIname\fR is folded to lowercase, in order to make database lookups case insensitive. .PP In addition, when an alias exists for \fBowner-\fIname\fR, delivery -diagnostics are directed to that address, instead of to the originator. -This is typically used to direct delivery errors to the owner of +diagnostics are directed to that address, instead of to the originator +of the message. +This is typically used to direct delivery errors to the maintainer of a mailing list, who is in a better position to deal with mailing list delivery problems than the originator of the undelivered mail. .PP @@ -145,6 +146,18 @@ Give special treatment to \fBowner-\fIlistname\fR and addresses. .IP \fBrecipient_delimiter\fR Delimiter that separates recipients from address extensions. +.PP +Available in Postfix version 2.3 and later: +.IP \fBfrozen_delivered_to\fR +Update the local(8) delivery agent's Delivered-To: address +(see prepend_delivered_header) only once, at the start of +a delivery; do not update the Delivered-To: address while +expanding aliases or .forward files. +.IP \fBsticky_owner_alias\fR +When expanding a local(8) alias that has an owner alias +(see owner-\fIname\fR discussion above), use the owner +information even when the expansion invokes a subordinate +alias that has no owner alias. .SH "STANDARDS" .na .nf diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 7d08a8289..ef44cd526 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -1309,6 +1309,18 @@ forward_path = .fi .ad .ft R +.SH frozen_delivered_to (default: yes) +Update the \fBlocal\fR(8) delivery agent's idea of the Delivered-To: +address (see prepend_delivered_header) only once, at the start of +a delivery attempt; do not update the Delivered-To: address while +expanding aliases or .forward files. +.PP +This feature is available in Postfix 2.3 and later. With older +Postfix releases, the behavior is as if this parameter is set to +"no". The old setting can be expensive with deeply nested aliases +or .forward files. When an alias or .forward file changes the +Delivered-To: address, it ties up one queue file and one cleanup +process instance while mail is being forwarded. .SH hash_queue_depth (default: 1) The number of subdirectory levels for queue directories listed with the hash_queue_names parameter. @@ -2546,7 +2558,9 @@ submissions from the Postfix maildrop queue. This feature is available in Postfix 2.0 and later. .SH prepend_delivered_header (default: command, file, forward) The message delivery contexts where the Postfix \fBlocal\fR(8) delivery -agent prepends a Delivered-To: message header. +agent prepends a Delivered-To: message header with the address +that the mail was delivered to. This information is used for mail +delivery loop detection. .PP By default, the Postfix local delivery agent prepends a Delivered-To: header when forwarding mail and when delivering to file (mailbox) @@ -5335,6 +5349,16 @@ This is used for delivery to file or mailbox. .PP Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks). The default time unit is s (seconds). +.SH sticky_owner_alias (default: yes) +When expanding a \fBlocal\fR(8) alias that has an owner alias (see +owner-\fIname\fR discussion in \fBaliases\fR(5)), use the owner information +even when the expansion invokes a subordinate alias that has no +owner alias. +.PP +This feature is available in Postfix 2.3 and later. With older +Postfix releases, the behavior is as if this parameter is set to +"no". The old setting provides poorer error reporting with nested +aliases that only have an owner alias at the top level. .SH strict_7bit_headers (default: no) Reject mail with 8-bit text in message headers. This blocks mail from poorly written applications. diff --git a/postfix/man/man8/local.8 b/postfix/man/man8/local.8 index 3ff4dfc94..409f7f5d3 100644 --- a/postfix/man/man8/local.8 +++ b/postfix/man/man8/local.8 @@ -392,6 +392,18 @@ address localparts: don't split such addresses when the recipient_delimiter is set to "-". .IP "\fBsun_mailtool_compatibility (no)\fR" Obsolete SUN mailtool compatibility feature. +.PP +Available in Postfix version 2.3 and later: +.IP "\fBfrozen_delivered_to (yes)\fR" +Update the \fBlocal\fR(8) delivery agent's idea of the Delivered-To: +address (see prepend_delivered_header) only once, at the start of +a delivery attempt; do not update the Delivered-To: address while +expanding aliases or .forward files. +.IP "\fBsticky_owner_alias (yes)\fR" +When expanding a \fBlocal\fR(8) alias that has an owner alias (see +owner-\fIname\fR discussion in \fBaliases\fR(5)), use the owner information +even when the expansion invokes a subordinate alias that has no +owner alias. .SH "DELIVERY METHOD CONTROLS" .na .nf @@ -520,7 +532,8 @@ The maximal number of connection requests before a Postfix daemon process terminates. .IP "\fBprepend_delivered_header (command, file, forward)\fR" The message delivery contexts where the Postfix \fBlocal\fR(8) delivery -agent prepends a Delivered-To: message header. +agent prepends a Delivered-To: message header with the address +that the mail was delivered to. .IP "\fBprocess_id (read-only)\fR" The process ID of a Postfix command or daemon process. .IP "\fBprocess_name (read-only)\fR" diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index fbb88c4bf..06a3a1f3a 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -501,6 +501,9 @@ while (<>) { s;\btls_ran[-]*\n* *[]*dom_reseed_period\b;$&;g; s;\btls_ran[-]*\n* *[]*dom_source\b;$&;g; + s;\bfrozen_delivered_to\b;$&;g; + s;\bsticky_owner_alias\b;$&;g; + # Undo hyperlinks of manual pages with the same name as parameters. s/([^<]*)<\/a>\(/$1(/g; diff --git a/postfix/proto/aliases b/postfix/proto/aliases index 8a499a416..bce2d9d2f 100644 --- a/postfix/proto/aliases +++ b/postfix/proto/aliases @@ -46,8 +46,9 @@ # lowercase, in order to make database lookups case insensitive. # .PP # In addition, when an alias exists for \fBowner-\fIname\fR, delivery -# diagnostics are directed to that address, instead of to the originator. -# This is typically used to direct delivery errors to the owner of +# diagnostics are directed to that address, instead of to the originator +# of the message. +# This is typically used to direct delivery errors to the maintainer of # a mailing list, who is in a better position to deal with mailing # list delivery problems than the originator of the undelivered mail. # .PP @@ -133,6 +134,18 @@ # addresses. # .IP \fBrecipient_delimiter\fR # Delimiter that separates recipients from address extensions. +# .PP +# Available in Postfix version 2.3 and later: +# .IP \fBfrozen_delivered_to\fR +# Update the local(8) delivery agent's Delivered-To: address +# (see prepend_delivered_header) only once, at the start of +# a delivery; do not update the Delivered-To: address while +# expanding aliases or .forward files. +# .IP \fBsticky_owner_alias\fR +# When expanding a local(8) alias that has an owner alias +# (see owner-\fIname\fR discussion above), use the owner +# information even when the expansion invokes a subordinate +# alias that has no owner alias. # STANDARDS # RFC 822 (ARPA Internet Text Messages) # SEE ALSO diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 2a5d693f8..b37eadef6 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -6841,10 +6841,10 @@ This feature is available in Postfix 2.0 and later. %PARAM prepend_delivered_header command, file, forward -

-The message delivery contexts where the Postfix local(8) delivery -agent prepends a Delivered-To: message header. -

+

The message delivery contexts where the Postfix local(8) delivery +agent prepends a Delivered-To: message header with the address +that the mail was delivered to. This information is used for mail +delivery loop detection.

By default, the Postfix local delivery agent prepends a Delivered-To: @@ -8541,3 +8541,29 @@ message_strip_characters = \0

This feature is available in Postfix 2.3 and later.

+ +%PARAM sticky_owner_alias yes + +

When expanding a local(8) alias that has an owner alias (see +owner-name discussion in aliases(5)), use the owner information +even when the expansion invokes a subordinate alias that has no +owner alias.

+ +

This feature is available in Postfix 2.3 and later. With older +Postfix releases, the behavior is as if this parameter is set to +"no". The old setting provides poorer error reporting with nested +aliases that only have an owner alias at the top level.

+ +%PARAM frozen_delivered_to yes + +

Update the local(8) delivery agent's idea of the Delivered-To: +address (see prepend_delivered_header) only once, at the start of +a delivery attempt; do not update the Delivered-To: address while +expanding aliases or .forward files.

+ +

This feature is available in Postfix 2.3 and later. With older +Postfix releases, the behavior is as if this parameter is set to +"no". The old setting can be expensive with deeply nested aliases +or .forward files. When an alias or .forward file changes the +Delivered-To: address, it ties up one queue file and one cleanup +process instance while mail is being forwarded.

diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 1b9f03325..8a22a1c6d 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -2373,6 +2373,17 @@ extern char *var_msg_reject_chars; #define DEF_MSG_STRIP_CHARS "" extern char *var_msg_strip_chars; + /* + * Local forwarding complexity controls. + */ +#define VAR_FROZEN_DELIVERED "frozen_delivered_to" +#define DEF_FROZEN_DELIVERED 1 +extern bool var_frozen_delivered; + +#define VAR_STICKY_OWNER_ALIAS "sticky_owner_alias" +#define DEF_STICKY_OWNER_ALIAS 1 +extern bool var_sticky_owner_alias; + /* LICENSE /* .ad /* .fi diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 55236fe84..9e1b0d5af 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 "20050922" +#define MAIL_RELEASE_DATE "20050923" #define MAIL_VERSION_NUMBER "2.3" #ifdef SNAPSHOT diff --git a/postfix/src/lmtp/lmtp_sasl_glue.c b/postfix/src/lmtp/lmtp_sasl_glue.c index 371bfc6fe..3c0a6f8ed 100644 --- a/postfix/src/lmtp/lmtp_sasl_glue.c +++ b/postfix/src/lmtp/lmtp_sasl_glue.c @@ -145,8 +145,6 @@ static NAME_MASK lmtp_sasl_sec_mask[] = { #if SASL_VERSION_MAJOR < 2 /* SASL version 1.x */ -#define SASL_LOG_WARN SASL_LOG_WARNING -#define SASL_LOG_NOTE SASL_LOG_INFO #define SASL_CLIENT_NEW(srv, fqdn, lport, rport, prompt, secflags, pconn) \ sasl_client_new(srv, fqdn, prompt, secflags, pconn) #define SASL_CLIENT_START(conn, mechlst, secret, prompt, clout, cllen, mech) \ @@ -177,16 +175,53 @@ static int lmtp_sasl_log(void *unused_context, int priority, { switch (priority) { case SASL_LOG_ERR: /* unusual errors */ - case SASL_LOG_WARN: /* non-fatal warnings */ +#ifdef SASL_LOG_WARN /* non-fatal warnings (Cyrus-SASL v2) */ + case SASL_LOG_WARN: +#endif +#ifdef SASL_LOG_WARNING /* non-fatal warnings (Cyrus-SASL v1) */ + case SASL_LOG_WARNING: +#endif msg_warn("SASL authentication problem: %s", message); break; - case SASL_LOG_NOTE: /* other info */ +#ifdef SASL_LOG_INFO + case SASL_LOG_INFO: /* other info (Cyrus-SASL v1) */ if (msg_verbose) msg_info("SASL authentication info: %s", message); break; -#if SASL_VERSION_MAJOR >= 2 - case SASL_LOG_FAIL: /* authentication failures */ +#endif +#ifdef SASL_LOG_NOTE + case SASL_LOG_NOTE: /* other info (Cyrus-SASL v2) */ + if (msg_verbose) + msg_info("SASL authentication info: %s", message); + break; +#endif +#ifdef SASL_LOG_FAIL + case SASL_LOG_FAIL: /* authentication failures + * (Cyrus-SASL v2) */ msg_warn("SASL authentication failure: %s", message); + break; +#endif +#ifdef SASL_LOG_DEBUG + case SASL_LOG_DEBUG: /* more verbose than LOG_NOTE + * (Cyrus-SASL v2) */ + if (msg_verbose > 1) + msg_info("SASL authentication debug: %s", message); + break; +#endif +#ifdef SASL_LOG_TRACE + case SASL_LOG_TRACE: /* traces of internal + * protocols (Cyrus-SASL v2) */ + if (msg_verbose > 1) + msg_info("SASL authentication trace: %s", message); + break; +#endif +#ifdef SASL_LOG_PASS + case SASL_LOG_PASS: /* traces of internal + * protocols, including + * passwords (Cyrus-SASL v2) */ + if (msg_verbose > 1) + msg_info("SASL authentication pass: %s", message); + break; #endif } return (SASL_OK); @@ -315,7 +350,7 @@ void lmtp_sasl_initialize(void) #endif ) msg_fatal("incorrect SASL library version. " - "Postfix was built with include files from version %d.%d.%d, " + "Postfix was built with include files from version %d.%d.%d, " "but the run-time library version is %d.%d.%d", SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP, sasl_major, sasl_minor, sasl_step); @@ -447,7 +482,7 @@ int lmtp_sasl_authenticate(LMTP_STATE *state, DSN_BUF *why) if (msg_verbose) msg_info("%s: %s: SASL mechanisms %s", - myname, session->namaddr, state->sasl_mechanism_list); + myname, session->namaddr, state->sasl_mechanism_list); /* * Start the client side authentication protocol. @@ -458,12 +493,12 @@ int lmtp_sasl_authenticate(LMTP_STATE *state, DSN_BUF *why) &clientout, &clientoutlen, &mechanism); if (result != SASL_OK && result != SASL_CONTINUE) { dsb_update(why, "4.7.0", DSB_DEF_ACTION, DSB_SKIP_RMTA, DSB_DTYPE_SASL, - 421, sasl_errstring(result, NO_SASL_LANGLIST, - NO_SASL_OUTLANG), - "cannot SASL authenticate to server %s: %s", - session->namaddr, - sasl_errstring(result, NO_SASL_LANGLIST, - NO_SASL_OUTLANG)); + 421, sasl_errstring(result, NO_SASL_LANGLIST, + NO_SASL_OUTLANG), + "cannot SASL authenticate to server %s: %s", + session->namaddr, + sasl_errstring(result, NO_SASL_LANGLIST, + NO_SASL_OUTLANG)); return (-1); } @@ -510,7 +545,7 @@ int lmtp_sasl_authenticate(LMTP_STATE *state, DSN_BUF *why) if (SASL_DECODE64(line, serverinlen, STR(state->sasl_decoded), serverinlen, &enc_length) != SASL_OK) { lmtp_dsn_update(why, "5.7.0", DSN_BY_LOCAL_MTA, - 501, "501 malformed SASL challenge", + 501, "501 malformed SASL challenge", "malformed SASL challenge from server %s", session->namaddr); return (-1); diff --git a/postfix/src/local/alias.c b/postfix/src/local/alias.c index 0ec7b3279..5149f3ef6 100644 --- a/postfix/src/local/alias.c +++ b/postfix/src/local/alias.c @@ -263,7 +263,8 @@ int deliver_alias(LOCAL_STATE state, USER_ATTR usr_attr, SET_OWNER_ATTR(state.msg_attr, STR(canon_owner), state.level); } else { canon_owner = 0; - RESET_OWNER_ATTR(state.msg_attr, state.level); + if (var_sticky_owner_alias == 0) + RESET_OWNER_ATTR(state.msg_attr, state.level); } /* @@ -272,7 +273,8 @@ int deliver_alias(LOCAL_STATE state, USER_ATTR usr_attr, * Set the delivered message attribute to the recipient, so that * this message will list the correct forwarding address. */ - state.msg_attr.delivered = state.msg_attr.rcpt.address; + if (var_frozen_delivered == 0) + state.msg_attr.delivered = state.msg_attr.rcpt.address; /* * Deliver. diff --git a/postfix/src/local/dotforward.c b/postfix/src/local/dotforward.c index e1e78f26a..79f3d9876 100644 --- a/postfix/src/local/dotforward.c +++ b/postfix/src/local/dotforward.c @@ -139,7 +139,8 @@ int deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp) * Set the delivered message attribute to the recipient, so that this * message will list the correct forwarding address. */ - state.msg_attr.delivered = state.msg_attr.rcpt.address; + if (var_frozen_delivered == 0) + state.msg_attr.delivered = state.msg_attr.rcpt.address; /* * DELIVERY RIGHTS diff --git a/postfix/src/local/local.c b/postfix/src/local/local.c index 63a1f78be..f849c1da5 100644 --- a/postfix/src/local/local.c +++ b/postfix/src/local/local.c @@ -360,6 +360,18 @@ /* recipient_delimiter is set to "-". /* .IP "\fBsun_mailtool_compatibility (no)\fR" /* Obsolete SUN mailtool compatibility feature. +/* .PP +/* Available in Postfix version 2.3 and later: +/* .IP "\fBfrozen_delivered_to (yes)\fR" +/* Update the \fBlocal\fR(8) delivery agent's idea of the Delivered-To: +/* address (see prepend_delivered_header) only once, at the start of +/* a delivery attempt; do not update the Delivered-To: address while +/* expanding aliases or .forward files. +/* .IP "\fBsticky_owner_alias (yes)\fR" +/* When expanding a \fBlocal\fR(8) alias that has an owner alias (see +/* owner-\fIname\fR discussion in \fBaliases\fR(5)), use the owner information +/* even when the expansion invokes a subordinate alias that has no +/* owner alias. /* DELIVERY METHOD CONTROLS /* .ad /* .fi @@ -478,7 +490,8 @@ /* process terminates. /* .IP "\fBprepend_delivered_header (command, file, forward)\fR" /* The message delivery contexts where the Postfix \fBlocal\fR(8) delivery -/* agent prepends a Delivered-To: message header. +/* agent prepends a Delivered-To: message header with the address +/* that the mail was delivered to. /* .IP "\fBprocess_id (read-only)\fR" /* The process ID of a Postfix command or daemon process. /* .IP "\fBprocess_name (read-only)\fR" @@ -606,6 +619,8 @@ int var_stat_home_dir; int var_mailtool_compat; char *var_mailbox_lock; int var_mailbox_limit; +bool var_frozen_delivered; +bool var_sticky_owner_alias; int local_cmd_deliver_mask; int local_file_deliver_mask; @@ -845,6 +860,8 @@ int main(int argc, char **argv) VAR_EXP_OWN_ALIAS, DEF_EXP_OWN_ALIAS, &var_exp_own_alias, VAR_STAT_HOME_DIR, DEF_STAT_HOME_DIR, &var_stat_home_dir, VAR_MAILTOOL_COMPAT, DEF_MAILTOOL_COMPAT, &var_mailtool_compat, + VAR_FROZEN_DELIVERED, DEF_FROZEN_DELIVERED, &var_frozen_delivered, + VAR_STICKY_OWNER_ALIAS, DEF_STICKY_OWNER_ALIAS, &var_sticky_owner_alias, 0, }; diff --git a/postfix/src/local/mailbox.c b/postfix/src/local/mailbox.c index 82b210424..9b43950a3 100644 --- a/postfix/src/local/mailbox.c +++ b/postfix/src/local/mailbox.c @@ -124,7 +124,8 @@ static int deliver_mailbox_file(LOCAL_STATE state, USER_ATTR usr_attr) */ if (vstream_fseek(state.msg_attr.fp, state.msg_attr.offset, SEEK_SET) < 0) msg_fatal("seek message file %s: %m", VSTREAM_PATH(state.msg_attr.fp)); - state.msg_attr.delivered = state.msg_attr.rcpt.address; + if (var_frozen_delivered == 0) + state.msg_attr.delivered = state.msg_attr.rcpt.address; mail_copy_status = MAIL_COPY_STAT_WRITE; if (*var_home_mailbox) { spool_dir = 0; diff --git a/postfix/src/local/maildir.c b/postfix/src/local/maildir.c index 6b338a6fd..08a50b43f 100644 --- a/postfix/src/local/maildir.c +++ b/postfix/src/local/maildir.c @@ -114,7 +114,8 @@ int deliver_maildir(LOCAL_STATE state, USER_ATTR usr_attr, char *path) */ if (vstream_fseek(state.msg_attr.fp, state.msg_attr.offset, SEEK_SET) < 0) msg_fatal("seek message file %s: %m", VSTREAM_PATH(state.msg_attr.fp)); - state.msg_attr.delivered = state.msg_attr.rcpt.address; + if (var_frozen_delivered == 0) + state.msg_attr.delivered = state.msg_attr.rcpt.address; mail_copy_status = MAIL_COPY_STAT_WRITE; buf = vstring_alloc(100); diff --git a/postfix/src/smtp/smtp_sasl_glue.c b/postfix/src/smtp/smtp_sasl_glue.c index ef6c4cb6e..eb097a602 100644 --- a/postfix/src/smtp/smtp_sasl_glue.c +++ b/postfix/src/smtp/smtp_sasl_glue.c @@ -160,8 +160,6 @@ static NAME_MASK smtp_sasl_sec_mask[] = { #if SASL_VERSION_MAJOR < 2 /* SASL version 1.x */ -#define SASL_LOG_WARN SASL_LOG_WARNING -#define SASL_LOG_NOTE SASL_LOG_INFO #define SASL_CLIENT_NEW(srv, fqdn, lport, rport, prompt, secflags, pconn) \ sasl_client_new(srv, fqdn, prompt, secflags, pconn) #define SASL_CLIENT_START(conn, mechlst, secret, prompt, clout, cllen, mech) \ @@ -197,32 +195,50 @@ static int smtp_sasl_log(void *unused_context, int priority, { switch (priority) { case SASL_LOG_ERR: /* unusual errors */ - case SASL_LOG_WARN: /* non-fatal warnings */ +#ifdef SASL_LOG_WARN /* non-fatal warnings (Cyrus-SASL v2) */ + case SASL_LOG_WARN: +#endif +#ifdef SASL_LOG_WARNING /* non-fatal warnings (Cyrus-SASL v1) */ + case SASL_LOG_WARNING: +#endif msg_warn("SASL authentication problem: %s", message); break; - case SASL_LOG_NOTE: /* other info */ +#ifdef SASL_LOG_INFO + case SASL_LOG_INFO: /* other info (Cyrus-SASL v1) */ if (msg_verbose) msg_info("SASL authentication info: %s", message); break; +#endif +#ifdef SASL_LOG_NOTE + case SASL_LOG_NOTE: /* other info (Cyrus-SASL v2) */ + if (msg_verbose) + msg_info("SASL authentication info: %s", message); + break; +#endif #ifdef SASL_LOG_FAIL - case SASL_LOG_FAIL: /* authentication failures */ + case SASL_LOG_FAIL: /* authentication failures + * (Cyrus-SASL v2) */ msg_warn("SASL authentication failure: %s", message); break; #endif #ifdef SASL_LOG_DEBUG - case SASL_LOG_DEBUG: + case SASL_LOG_DEBUG: /* more verbose than LOG_NOTE + * (Cyrus-SASL v2) */ if (msg_verbose > 1) msg_info("SASL authentication debug: %s", message); break; #endif #ifdef SASL_LOG_TRACE - case SASL_LOG_TRACE: + case SASL_LOG_TRACE: /* traces of internal + * protocols (Cyrus-SASL v2) */ if (msg_verbose > 1) msg_info("SASL authentication trace: %s", message); break; #endif #ifdef SASL_LOG_PASS - case SASL_LOG_PASS: + case SASL_LOG_PASS: /* traces of internal + * protocols, including + * passwords (Cyrus-SASL v2) */ if (msg_verbose > 1) msg_info("SASL authentication pass: %s", message); break; diff --git a/postfix/src/smtpd/smtpd_sasl_glue.c b/postfix/src/smtpd/smtpd_sasl_glue.c index cd97b3177..10cfd3712 100644 --- a/postfix/src/smtpd/smtpd_sasl_glue.c +++ b/postfix/src/smtpd/smtpd_sasl_glue.c @@ -135,8 +135,6 @@ #if SASL_VERSION_MAJOR < 2 /* SASL version 1.x */ -#define SASL_LOG_WARN SASL_LOG_WARNING -#define SASL_LOG_NOTE SASL_LOG_INFO #define SASL_SERVER_NEW(srv, fqdn, rlm, lport, rport, cb, secflags, pconn) \ sasl_server_new(srv, fqdn, rlm, cb, secflags, pconn) #define SASL_SERVER_START(conn, mech, clin, clinlen, srvout, srvoutlen, err) \ @@ -165,39 +163,57 @@ static int smtpd_sasl_log(void *unused_context, int priority, const char *message) { switch (priority) { - case SASL_LOG_ERR: - case SASL_LOG_WARN: + case SASL_LOG_ERR: /* unusual errors */ +#ifdef SASL_LOG_WARN /* non-fatal warnings (Cyrus-SASL v2) */ + case SASL_LOG_WARN: +#endif +#ifdef SASL_LOG_WARNING /* non-fatal warnings (Cyrus-SASL v1) */ + case SASL_LOG_WARNING: +#endif msg_warn("SASL authentication problem: %s", message); break; - case SASL_LOG_NOTE: +#ifdef SASL_LOG_INFO + case SASL_LOG_INFO: /* other info (Cyrus-SASL v1) */ if (msg_verbose) msg_info("SASL authentication info: %s", message); break; +#endif +#ifdef SASL_LOG_NOTE + case SASL_LOG_NOTE: /* other info (Cyrus-SASL v2) */ + if (msg_verbose) + msg_info("SASL authentication info: %s", message); + break; +#endif #ifdef SASL_LOG_FAIL - case SASL_LOG_FAIL: + case SASL_LOG_FAIL: /* authentication failures + * (Cyrus-SASL v2) */ msg_warn("SASL authentication failure: %s", message); break; #endif #ifdef SASL_LOG_DEBUG - case SASL_LOG_DEBUG: + case SASL_LOG_DEBUG: /* more verbose than LOG_NOTE + * (Cyrus-SASL v2) */ if (msg_verbose > 1) msg_info("SASL authentication debug: %s", message); break; #endif #ifdef SASL_LOG_TRACE - case SASL_LOG_TRACE: + case SASL_LOG_TRACE: /* traces of internal + * protocols (Cyrus-SASL v2) */ if (msg_verbose > 1) msg_info("SASL authentication trace: %s", message); break; #endif #ifdef SASL_LOG_PASS - case SASL_LOG_PASS: + case SASL_LOG_PASS: /* traces of internal + * protocols, including + * passwords (Cyrus-SASL v2) */ if (msg_verbose > 1) msg_info("SASL authentication pass: %s", message); break; #endif } - return SASL_OK; + return (SASL_OK); } /* @@ -245,7 +261,7 @@ void smtpd_sasl_initialize(void) #endif ) msg_fatal("incorrect SASL library version. " - "Postfix was built with include files from version %d.%d.%d, " + "Postfix was built with include files from version %d.%d.%d, " "but the run-time library version is %d.%d.%d", SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP, sasl_major, sasl_minor, sasl_step); diff --git a/postfix/src/smtpstone/Makefile.in b/postfix/src/smtpstone/Makefile.in index f6b35abf5..0642a3bc9 100644 --- a/postfix/src/smtpstone/Makefile.in +++ b/postfix/src/smtpstone/Makefile.in @@ -106,6 +106,8 @@ qmqp-source.o: ../../include/qmqp_proto.h qmqp-source.o: ../../include/sane_connect.h qmqp-source.o: ../../include/split_at.h qmqp-source.o: ../../include/sys_defs.h +qmqp-source.o: ../../include/valid_hostname.h +qmqp-source.o: ../../include/valid_mailhost_addr.h qmqp-source.o: ../../include/vbuf.h qmqp-source.o: ../../include/vstream.h qmqp-source.o: ../../include/vstring.h @@ -142,6 +144,8 @@ smtp-source.o: ../../include/sane_connect.h smtp-source.o: ../../include/smtp_stream.h smtp-source.o: ../../include/split_at.h smtp-source.o: ../../include/sys_defs.h +smtp-source.o: ../../include/valid_hostname.h +smtp-source.o: ../../include/valid_mailhost_addr.h smtp-source.o: ../../include/vbuf.h smtp-source.o: ../../include/vstream.h smtp-source.o: ../../include/vstring.h diff --git a/postfix/src/smtpstone/qmqp-source.c b/postfix/src/smtpstone/qmqp-source.c index 7ff27bf83..d06054215 100644 --- a/postfix/src/smtpstone/qmqp-source.c +++ b/postfix/src/smtpstone/qmqp-source.c @@ -37,6 +37,10 @@ /* includes the message headers. /* .IP "\fB-m \fImessage_count\fR" /* Send the specified number of messages (default: 1). +/* .IP "\fB-M \fImyhostname\fR" +/* Use the specified hostname or [address] in the default +/* sender and recipient addresses, instead of the machine +/* hostname. /* .IP "\fB-r \fIrecipient_count\fR" /* Send the specified number of recipients per transaction (default: 1). /* Recipient names are generated by prepending a number to the @@ -48,6 +52,8 @@ /* .IP "\fB-R \fIinterval\fR" /* Wait for a random period of time 0 <= n <= interval between messages. /* Suspending one thread does not affect other delivery threads. +/* .IP \fB-v\fR +/* Make the program more verbose, for debugging purposes. /* .IP "\fB-w \fIinterval\fR" /* Wait a fixed time between messages. /* Suspending one thread does not affect other delivery threads. @@ -94,6 +100,8 @@ #include #include #include +#include +#include /* Global library. */ @@ -428,7 +436,7 @@ static void receive_reply(int unused_event, char *context) static void usage(char *myname) { - msg_fatal("usage: %s -s sess -l msglen -m msgs -c -C count -f from -t to -R delay -v -w delay host[:port]", myname); + msg_fatal("usage: %s -cv -s sess -l msglen -m msgs -C count -M myhostname -f from -t to -R delay -w delay host[:port]", myname); } /* main - parse JCL and start the machine */ @@ -458,7 +466,7 @@ int main(int argc, char **argv) /* * Parse JCL. */ - while ((ch = GETOPT(argc, argv, "46cC:f:l:m:r:R:s:t:vw:")) > 0) { + while ((ch = GETOPT(argc, argv, "46cC:f:l:m:M:r:R:s:t:vw:")) > 0) { switch (ch) { case '4': protocols = INET_PROTO_NAME_IPV4; @@ -484,6 +492,16 @@ int main(int argc, char **argv) if ((message_count = atoi(optarg)) <= 0) usage(argv[0]); break; + case 'M': + if (*optarg == '[') { + if (!valid_mailhost_literal(optarg, DO_GRIPE)) + msg_fatal("bad address literal: %s", optarg); + } else { + if (!valid_hostname(optarg, DO_GRIPE)) + msg_fatal("bad hostname: %s", optarg); + } + var_myhostname = optarg; + break; case 'r': if ((recipients = atoi(optarg)) <= 0) usage(argv[0]); @@ -562,7 +580,8 @@ int main(int argc, char **argv) /* * Make sure we have sender and recipient addresses. */ - var_myhostname = get_hostname(); + if (var_myhostname == 0) + var_myhostname = get_hostname(); if (sender == 0 || recipient == 0) { vstring_sprintf(buffer, "foo@%s", var_myhostname); defaddr = mystrdup(vstring_str(buffer)); diff --git a/postfix/src/smtpstone/smtp-source.c b/postfix/src/smtpstone/smtp-source.c index 2b665d363..f02f809ac 100644 --- a/postfix/src/smtpstone/smtp-source.c +++ b/postfix/src/smtpstone/smtp-source.c @@ -37,8 +37,6 @@ /* message over the same connection. /* .IP "\fB-f \fIfrom\fR" /* Use the specified sender address (default: ). -/* .IP \fB-o\fR -/* Old mode: don't send HELO, and don't send message headers. /* .IP "\fB-l \fIlength\fR" /* Send \fIlength\fR bytes as message payload. The length does not /* include message headers. @@ -46,12 +44,18 @@ /* Speak LMTP rather than SMTP. /* .IP "\fB-m \fImessage_count\fR" /* Send the specified number of messages (default: 1). +/* .IP "\fB-M \fImyhostname\fR" +/* Use the specified hostname or [address] in the HELO command +/* and in the default sender and recipient addresses, instead +/* of the machine hostname. /* .IP "\fB-N\fR" /* Prepend a non-repeating sequence number to each recipient /* address. This avoids the artificial 100% hit rate in the /* resolve and rewrite client caches and exercises the /* trivial-rewrite daemon, better approximating Postfix /* performance under real-life work-loads. +/* .IP \fB-o\fR +/* Old mode: don't send HELO, and don't send message headers. /* .IP "\fB-r \fIrecipient_count\fR" /* Send the specified number of recipients per transaction (default: 1). /* Recipient names are generated by prepending a number to the @@ -65,6 +69,8 @@ /* .IP "\fB-R \fIinterval\fR" /* Wait for a random period of time 0 <= n <= interval between messages. /* Suspending one thread does not affect other delivery threads. +/* .IP \fB-v\fR +/* Make the program more verbose, for debugging purposes. /* .IP "\fB-w \fIinterval\fR" /* Wait a fixed time between messages. /* Suspending one thread does not affect other delivery threads. @@ -121,6 +127,8 @@ #include #include #include +#include +#include /* Global library. */ @@ -784,7 +792,7 @@ static void quit_done(int unused_event, char *context) static void usage(char *myname) { - msg_fatal("usage: %s -cdLNov -s sess -l msglen -m msgs -C count -f from -t to -r rcptcount -R delay -w delay host[:port]", myname); + msg_fatal("usage: %s -cdLNov -s sess -l msglen -m msgs -C count -M myhostname -f from -t to -r rcptcount -R delay -w delay host[:port]", myname); } /* main - parse JCL and start the machine */ @@ -812,7 +820,7 @@ int main(int argc, char **argv) /* * Parse JCL. */ - while ((ch = GETOPT(argc, argv, "46cC:df:l:Lm:Nor:R:s:S:t:vw:")) > 0) { + while ((ch = GETOPT(argc, argv, "46cC:df:l:Lm:M:Nor:R:s:S:t:vw:")) > 0) { switch (ch) { case '4': protocols = INET_PROTO_NAME_IPV4; @@ -851,6 +859,16 @@ int main(int argc, char **argv) if ((message_count = atoi(optarg)) <= 0) msg_fatal("bad message count: %s", optarg); break; + case 'M': + if (*optarg == '[') { + if (!valid_mailhost_literal(optarg, DO_GRIPE)) + msg_fatal("bad address literal: %s", optarg); + } else { + if (!valid_hostname(optarg, DO_GRIPE)) + msg_fatal("bad hostname: %s", optarg); + } + var_myhostname = optarg; + break; case 'N': number_rcpts = 1; break; @@ -947,7 +965,8 @@ int main(int argc, char **argv) /* * Make sure we have sender and recipient addresses. */ - var_myhostname = get_hostname(); + if (var_myhostname == 0) + var_myhostname = get_hostname(); if (sender == 0 || recipient == 0) { vstring_sprintf(buffer, "foo@%s", var_myhostname); defaddr = mystrdup(vstring_str(buffer));