diff options
34 files changed, 329 insertions, 188 deletions
diff --git a/gnu/dist/postfix/README_FILES/INSTALL b/gnu/dist/postfix/README_FILES/INSTALL index b2361a48834..4544120cd65 100644 --- a/gnu/dist/postfix/README_FILES/INSTALL +++ b/gnu/dist/postfix/README_FILES/INSTALL @@ -144,15 +144,19 @@ configuration directory other than /etc/postfix, use: Be sure to get the quotes right. These details matter a lot. -Other parameters whose defaults can be specified in this way are: - - Macro name default value for - ------------------------------------- - DEF_COMMAND_DIR command_directory - DEF_DAEMON_DIR daemon_directory - DEF_SENDMAIL_PATH sendmail_path - DEF_MAILQ_PATH mailq_path - DEF_NEWALIAS_PATH newaliases_path +Parameters whose defaults can be specified in this way are: + + Macro name default value for typical default + ----------------------------------------------------------- + DEF_COMMAND_DIR command_directory /usr/sbin + DEF_CONFIG_DIR config_directory /etc/postfix + DEF_DAEMON_DIR daemon_directory /usr/libexec/postfix + DEF_MAILQ_PATH mailq_path /usr/bin/mailq + DEF_MANPAGE_DIR manpage_directory /usr/local/man + DEF_NEWALIAS_PATH newaliases_path /usr/bin/newaliases + DEF_README_DIR readme_directory no (do not install) + DEF_SAMPLE_DIR sample_directory /etc/postfix + DEF_SENDMAIL_PATH sendmail_path /usr/sbin/sendmail In order to build Postfix for very large applications, where you expect to run more than 1000 delivery processes, you may need to diff --git a/gnu/dist/postfix/README_FILES/RELEASE_NOTES b/gnu/dist/postfix/README_FILES/RELEASE_NOTES index 4977c0adadd..01a5064e618 100644 --- a/gnu/dist/postfix/README_FILES/RELEASE_NOTES +++ b/gnu/dist/postfix/README_FILES/RELEASE_NOTES @@ -24,6 +24,23 @@ snapshot release). Patches change the patchlevel and the release date. Snapshots change only the release date, unless they include the same bugfixes as a patch release. +Incompatible changes with Postfix version 2.0.8 (released 20030415) +=================================================================== + +Too many people mess up their net/mask patterns, causing open +mail relay problems. Postfix processes now abort when given a +net/mask pattern with a non-zero host portion (for example, +168.100.189.2/28), and suggest to specify the proper net/mask +pattern instead (for example, 168.100.189.0/28). + +Major changes with Postfix version 2.0.8 (released 20030415) +============================================================ + +Workaround for file system clock drift that caused Postfix to ignore +new mail (this could happen with file systems mounted from a server). +Postfix now logs a warning and proceeds with only slightly reduced +performance, instead of ignoring new mail. + Incompatible changes with Postfix version 2.0.6 (released 20030305) =================================================================== @@ -193,7 +210,10 @@ more flexible "reject_rbl_client" feature instead. [Obsolete 20021209] The "check_relay_domains" restriction is going away. The SMTP server logs a warning and suggests using the more -robust "reject_unauth_destination" instead. +robust "reject_unauth_destination" instead. This means that Postfix +by default no longer grants relay permissions on the basis of the +client hostname, and that relay clients must be authorized via +other means such as permit_mynetworks. [Obsolete 20020917] In regexp lookup tables, the form /pattern1/!/pattern2/ is going away. Use the cleaner and more flexible "if !/pattern2/..endif" @@ -313,7 +333,7 @@ mail relay traffic from outbound traffic. This eliminates a problem where inbound mail deliveries could become resource starved in the presence of a high volume of outbound mail. -[Feature 20021013] The body_checks_max_size parameter limits the +[Feature 20021013] The body_checks_size_limit parameter limits the amount of text per message body segment (or attachment, if you prefer to use that term) that is subjected to body_checks inspection. The default limit is 50 kbytes. This speeds up the processing of @@ -466,7 +486,8 @@ or html/uce.html for details. IP address blacklisting. Based on code by LaMont Jones. The old "reject_maps_rbl" is now implemented as a wrapper around the reject_rbl_client code, and logs a warning that "reject_maps_rbl" -is going away. +is going away. To upgrade, specify "reject_rbl_client domainname" +once for each domain name that is listed in maps_rbl_domains. [Feature 20020923] "reject_rhsbl_sender rbl.domain.tld" for sender domain blacklisting. Also: reject_rhsbl_client and reject_rhsbl_recipient @@ -724,7 +745,7 @@ mime_header_checks (for MIME headers), and nested_header_checks (for headers of attached email messages except MIME headers). By default, all headers are matched with header_checks. -[Feature 20021013] The body_checks_max_size parameter limits the +[Feature 20021013] The body_checks_size_limit parameter limits the amount of text per message body segment (or attachment, if you prefer to use that term) that is subjected to body_checks inspection. The default limit is 50 kbytes. This speeds up the processing of diff --git a/gnu/dist/postfix/conf/main.cf b/gnu/dist/postfix/conf/main.cf index cf5243c9c2d..6e4541cb14a 100644 --- a/gnu/dist/postfix/conf/main.cf +++ b/gnu/dist/postfix/conf/main.cf @@ -1,7 +1,7 @@ -# $NetBSD: main.cf,v 1.7 2004/03/27 00:07:48 dan Exp $ +# $NetBSD: main.cf,v 1.8 2004/03/27 16:31:19 heas Exp $ # # Global Postfix configuration file. This file lists only a subset -# of all 250+ parameters. See the sample-xxx.cf files for a full list. +# of all 300+ parameters. See the sample-xxx.cf files for a full list. # # The general format is lines with parameter = value pairs. Lines # that begin with whitespace continue the previous line. A value can @@ -153,6 +153,9 @@ mail_owner = postfix # a name matches a lookup key (the right-hand side is ignored). # Continue long lines by starting the next line with whitespace. # +# DO NOT LIST RELAY DESTINATIONS IN MYDESTINATION. +# SPECIFY RELAY DESTINATIONS IN RELAY_DOMAINS. +# # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS". # #mydestination = $myhostname, localhost.$mydomain @@ -333,8 +336,8 @@ unknown_local_recipient_reject_code = 450 # # A Postfix process will pause for $in_flow_delay seconds before # accepting a new message, when the message arrival rate exceeds the -# message delivery rate. With the default 50 SMTP server process -# limit, this limits the mail inflow to 50 messages a second more +# message delivery rate. With the default 100 SMTP server process +# limit, this limits the mail inflow to 100 messages a second more # than the number of messages delivered per second. # # Specify 0 to disable the feature. Valid delays are 0..10. @@ -565,7 +568,7 @@ unknown_local_recipient_reject_code = 450 # most delivery transports. For the local delivery agent the default is 2. #local_destination_concurrency_limit = 2 -#default_destination_concurrency_limit = 10 +#default_destination_concurrency_limit = 20 # DEBUGGING CONTROL # diff --git a/gnu/dist/postfix/conf/master.cf b/gnu/dist/postfix/conf/master.cf index ef1eda956b6..30bfff41adc 100644 --- a/gnu/dist/postfix/conf/master.cf +++ b/gnu/dist/postfix/conf/master.cf @@ -1,10 +1,16 @@ -# $NetBSD: master.cf,v 1.6 2004/03/27 00:03:16 dan Exp $ +# $NetBSD: master.cf,v 1.7 2004/03/27 16:31:19 heas Exp $ # # -# Postfix master process configuration file. Each line describes how -# a mailer component program should be run. The fields that make up -# each line are described below. A "-" field value requests that a -# default value be used for that field. +# Postfix master process configuration file. Each logical line +# describes how a Postfix daemon program should be run. +# +# A logical line starts with non-whitespace, non-comment text. +# Empty lines and whitespace-only lines are ignored, as are comment +# lines whose first non-whitespace character is a `#'. +# A line that starts with whitespace continues a logical line. +# +# The fields that make up each line are described below. A "-" field +# value requests that a default value be used for that field. # # Service: any name that is valid for the specified transport type # (the next field). With INET transports, a service is specified as @@ -61,12 +67,6 @@ # SPECIFY ONLY PROGRAMS THAT ARE WRITTEN TO RUN AS POSTFIX DAEMONS. # ALL DAEMONS SPECIFIED HERE MUST SPEAK A POSTFIX-INTERNAL PROTOCOL. # -# DO NOT CHANGE THE ZERO PROCESS LIMIT FOR CLEANUP/BOUNCE/DEFER OR -# POSTFIX WILL BECOME STUCK UP UNDER HEAVY LOAD -# -# DO NOT CHANGE THE ONE PROCESS LIMIT FOR PICKUP/QMGR OR POSTFIX WILL -# DELIVER MAIL MULTIPLE TIMES. -# # DO NOT SHARE THE POSTFIX QUEUE BETWEEN MULTIPLE POSTFIX INSTANCES. # # ========================================================================== diff --git a/gnu/dist/postfix/conf/sample-filter.cf b/gnu/dist/postfix/conf/sample-filter.cf index 5723fdac6bb..eef356d09de 100644 --- a/gnu/dist/postfix/conf/sample-filter.cf +++ b/gnu/dist/postfix/conf/sample-filter.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-filter.cf,v 1.2 2002/12/24 21:37:43 perry Exp $ +# $NetBSD: sample-filter.cf,v 1.3 2004/03/27 16:31:19 heas Exp $ # # DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF # HERE JUST SERVES AS AN EXAMPLE. @@ -20,10 +20,11 @@ # REJECT [optional text...] # Reject the entire message. The optional text is sent to the # originator and is logged to the maillog file. +# OK Skip all further header patterns for this header line. # IGNORE Silently discard the header line. # WARN [optional text...] # Log the message header and the optional text. This is useful -# for testing. When the pattern is OK, change the WARN into a +# for testing. When the pattern is good, change the WARN into a # REJECT or into a DISCARD. # HOLD [optional text...] # Place the message on the hold queue. Mail on hold can be @@ -64,10 +65,11 @@ header_checks = regexp:/etc/postfix/header_checks # REJECT [optional text...] # Reject the entire message. The optional text is sent to the # originator and is logged to the maillog file. +# OK Skip all further header patterns for this header line. # IGNORE Silently discard the body line # WARN [optional text...] # Log the body line and the optional text. This is useful -# for testing. When the pattern is OK, change the WARN into a +# for testing. When the pattern is good, change the WARN into a # REJECT or into a DISCARD. # HOLD [optional text...] # Place the message on the hold queue. Mail on hold can be @@ -101,11 +103,23 @@ mime_header_checks = $header_checks # When a pattern matches, what happens next depends on the associated # action that is specified in the right-hand side of the table: # -# REJECT the entire message is rejected. -# REJECT text.... The text is sent to the originator. -# IGNORE the header line is silently discarded. -# WARN the header is logged (not rejected) with a warning message. -# WARN text... as above, and the text is logged, too. +# REJECT [optional text...] +# Reject the entire message. The optional text is sent to the +# originator and is logged to the maillog file. +# OK Skip all further header patterns for this header line. +# IGNORE Silently discard the body line +# WARN [optional text...] +# Log the body line and the optional text. This is useful +# for testing. When the pattern is good, change the WARN into a +# REJECT or into a DISCARD. +# HOLD [optional text...] +# Place the message on the hold queue. Mail on hold can be +# inspected with the postcat command, and can be destroyed or +# taken off hold (i.e. delivered) with the postsuper command. +# The matched body line is logged with the optional text. +# DISCARD [optional text...] +# Claim successful delivery and silently discard the message. +# The matched body line is logged with the optional text. # FILTER transport:nexthop # after the message is queued, the message is sent through # a content filter. This requires different cleanup servers @@ -147,11 +161,11 @@ nested_header_checks = $header_checks # body_checks = regexp:/etc/postfix/body_checks -# The body_checks_max_size parameter controls how much text in a +# The body_checks_size_limit parameter controls how much text in a # message body segment (or attachment, if you prefer to use that # term) is subjected to body_checks inspection. # # By default, only the first 50 kbytes of a message body segment are # inspected with body_checks patterns. # -body_checks_max_size = 51200 +body_checks_size_limit = 51200 diff --git a/gnu/dist/postfix/conf/sample-mime.cf b/gnu/dist/postfix/conf/sample-mime.cf index 49bccbe1c17..a019e8a0300 100644 --- a/gnu/dist/postfix/conf/sample-mime.cf +++ b/gnu/dist/postfix/conf/sample-mime.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-mime.cf,v 1.2 2002/12/24 21:37:44 perry Exp $ +# $NetBSD: sample-mime.cf,v 1.3 2004/03/27 16:31:19 heas Exp $ # # DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF # HERE JUST SERVES AS AN EXAMPLE. @@ -68,4 +68,4 @@ strict_8bitmime = no # # This blocks mail from poorly written mail software. # -strict_mime_domain_encoding = no +strict_mime_encoding_domain = no diff --git a/gnu/dist/postfix/conf/sample-misc.cf b/gnu/dist/postfix/conf/sample-misc.cf index b08ca3e2aed..4cb550bed63 100644 --- a/gnu/dist/postfix/conf/sample-misc.cf +++ b/gnu/dist/postfix/conf/sample-misc.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-misc.cf,v 1.3 2003/03/08 19:43:58 perry Exp $ +# $NetBSD: sample-misc.cf,v 1.4 2004/03/27 16:31:19 heas Exp $ # # DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF # HERE JUST SERVES AS AN EXAMPLE. @@ -6,10 +6,20 @@ # This file contains example settings for miscellaneous Postfix # configuration parameters. +# The allow_min_user parameter specifies whether a recipient address +# can have a '-' as the first character. By default, this is not +# allowed, to avoid accidents with software that passes email addresses +# via the command line. +# +allow_min_user = no + # The always_bcc parameter specifies an optional address that # receives a copy of each message that enters the Postfix system, # not including bounces that are generated locally. # +# NOTE: if mail to the BCC address bounces it will be returned to +# the sender. +# always_bcc = # The daemon_timeout parameter specifies how much time a daemon may diff --git a/gnu/dist/postfix/conf/sample-pcre-access.cf b/gnu/dist/postfix/conf/sample-pcre-access.cf index 777213d53c1..72a58117ab0 100644 --- a/gnu/dist/postfix/conf/sample-pcre-access.cf +++ b/gnu/dist/postfix/conf/sample-pcre-access.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-pcre-access.cf,v 1.2 2002/12/24 21:37:45 perry Exp $ +# $NetBSD: sample-pcre-access.cf,v 1.3 2004/03/27 16:31:19 heas Exp $ # # # Sample pcre (PERL-compatible regular expression) map file for @@ -20,7 +20,7 @@ # A block of table entries may be "enclosed" by a line with # `if /pattern/flags' and a line with `endif'. This causes # the block of table entries to be examined only when the -# pattern produces a successful match. The `if..endif' may +# search string matches the pattern. The `if..endif' may # be nested. There currently is no `else' operator. # # The second field is the "replacement" string - the text @@ -47,7 +47,7 @@ # Protect your outgoing majordomo exploders # -/^(?!owner-)(.*)-outgoing@/ 550 Use ${1}@${2} instead +/^(?!owner-)(.*)-outgoing@(.*)/ 550 Use ${1}@${2} instead # Bounce friend@whatever, except when whatever is our domain (you would diff --git a/gnu/dist/postfix/conf/sample-pcre-body.cf b/gnu/dist/postfix/conf/sample-pcre-body.cf index 08c0d786c0c..aed9f32e1f7 100644 --- a/gnu/dist/postfix/conf/sample-pcre-body.cf +++ b/gnu/dist/postfix/conf/sample-pcre-body.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-pcre-body.cf,v 1.3 2003/03/08 19:43:58 perry Exp $ +# $NetBSD: sample-pcre-body.cf,v 1.4 2004/03/27 16:31:19 heas Exp $ # # # Sample pcre (PERL-compatible regular expression) map file for @@ -22,7 +22,7 @@ # A block of table entries may be "enclosed" by a line with # `if /pattern/flags' and a line with `endif'. This causes # the block of table entries to be examined only when the -# pattern produces a successful match. The `if..endif' may +# search string matches the pattern. The `if..endif' may # be nested. There currently is no `else' operator. # # The second field is the "replacement" string - the text @@ -31,10 +31,11 @@ # REJECT [optional text...] # Reject the entire message. The optional text is sent to # the originator and is logged to the maillog file. +# OK Skip all further body patterns for this body line. # IGNORE Silently discard the body line. # WARN [optional text...] # Log the body line and the optional text. This is -# useful for testing. When the pattern is OK, change the +# useful for testing. When the pattern is good, change the # WARN into a REJECT or into a DISCARD. # HOLD [optional text...] # Place the message on the hold queue. Mail on hold can diff --git a/gnu/dist/postfix/conf/sample-pcre-header.cf b/gnu/dist/postfix/conf/sample-pcre-header.cf index a45a02b4945..b090692c049 100644 --- a/gnu/dist/postfix/conf/sample-pcre-header.cf +++ b/gnu/dist/postfix/conf/sample-pcre-header.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-pcre-header.cf,v 1.3 2003/03/08 19:43:58 perry Exp $ +# $NetBSD: sample-pcre-header.cf,v 1.4 2004/03/27 16:31:19 heas Exp $ # # # Sample pcre (PERL-compatible regular expression) map file for @@ -23,7 +23,7 @@ # A block of table entries may be "enclosed" by a line with # `if /pattern/flags' and a line with `endif'. This causes # the block of table entries to be examined only when the -# pattern produces a successful match. The `if..endif' may +# search string matches the pattern. The `if..endif' may # be nested. There currently is no `else' operator. # # The second field is the "replacement" string - the text @@ -32,10 +32,11 @@ # REJECT [optional text...] # Reject the entire message. The optional text is sent to # the originator and is logged to the maillog file. +# OK Skip all further header patterns for this header line. # IGNORE Silently ignore the message header. # WARN [optional text...] # Log the message header and the optional text. This is -# useful for testing. When the pattern is OK, change the +# useful for testing. When the pattern is good, change the # WARN into a REJECT or into a DISCARD. # HOLD [optional text...] # Place the message on the hold queue. Mail on hold can diff --git a/gnu/dist/postfix/conf/sample-regexp-access.cf b/gnu/dist/postfix/conf/sample-regexp-access.cf index 2d472505140..0ef3116a90d 100644 --- a/gnu/dist/postfix/conf/sample-regexp-access.cf +++ b/gnu/dist/postfix/conf/sample-regexp-access.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-regexp-access.cf,v 1.2 2002/12/24 21:37:45 perry Exp $ +# $NetBSD: sample-regexp-access.cf,v 1.3 2004/03/27 16:31:19 heas Exp $ # # Sample regexp SMTPD access lookup "table". See regexp_table(5) # and access(5) for a description of the syntax. @@ -17,8 +17,8 @@ # # A block of table entries may be "enclosed" by a line with `if # /pattern/flags' or `if !/pattern/flags' and a line with `endif'. -# This causes the block of table entries to be examined only when -# the pattern produces a successful (non)match. The `if..endif' may +# This causes the block of table entries to be examined only when the +# search string produces a successful (non)match. The `if..endif' may # be nested. There currently is no `else' operator. # # The syntax of access table results is described in the Postfix @@ -32,4 +32,6 @@ /^postmaster@/ OK # Protect your outgoing majordomo exploders -/^(.*)-outgoing@(.*)$/!/^owner-.*/ 550 Use ${1}@${2} instead +if !/^owner-.*/ +/^(.*)-outgoing@(.*)$/ 550 Use ${1}@${2} instead +endif diff --git a/gnu/dist/postfix/conf/sample-regexp-body.cf b/gnu/dist/postfix/conf/sample-regexp-body.cf index 25761460523..3ad0d81689d 100644 --- a/gnu/dist/postfix/conf/sample-regexp-body.cf +++ b/gnu/dist/postfix/conf/sample-regexp-body.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-regexp-body.cf,v 1.3 2003/03/08 19:43:58 perry Exp $ +# $NetBSD: sample-regexp-body.cf,v 1.4 2004/03/27 16:31:19 heas Exp $ # # Sample regexp message body filter lookup "table". See regexp_table(5) # for a description of the syntax. @@ -20,15 +20,16 @@ # # A block of table entries may be "enclosed" by a line with `if # /pattern/flags' or `if !/pattern/flags' and a line with `endif'. -# This causes the block of table entries to be examined only when -# the pattern produces a successful (non)match. The `if..endif' may +# This causes the block of table entries to be examined only when the +# search string produces a successful (non)match. The `if..endif' may # be nested. There currently is no `else' operator. # # The result is one of the following: # REJECT [optional text...] # Reject the entire message. The optional text is sent to the # originator and is logged to the maillog file. -# IGNORE Silently ignore the body line. +# OK Skip all further body patterns for this body line. +# IGNORE Silently discard the body line. # WARN [optional text...] # Log the body line and the optional text. This is useful # for testing. When the pattern is OK, change the WARN into a diff --git a/gnu/dist/postfix/conf/sample-regexp-header.cf b/gnu/dist/postfix/conf/sample-regexp-header.cf index 073dec1d267..3b9461cb44a 100644 --- a/gnu/dist/postfix/conf/sample-regexp-header.cf +++ b/gnu/dist/postfix/conf/sample-regexp-header.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-regexp-header.cf,v 1.3 2003/03/08 19:43:58 perry Exp $ +# $NetBSD: sample-regexp-header.cf,v 1.4 2004/03/27 16:31:19 heas Exp $ # # Sample regexp message header filter lookup "table". See regexp_table(5) # for a description of the syntax. @@ -20,18 +20,19 @@ # # A block of table entries may be "enclosed" by a line with `if # /pattern/flags' or `if !/pattern/flags' and a line with `endif'. -# This causes the block of table entries to be examined only when -# the pattern produces a successful (non)match. The `if..endif' may +# This causes the block of table entries to be examined only when the +# search string produces a successful (non)match. The `if..endif' may # be nested. There currently is no `else' operator. # # The result is one of the following: # REJECT [optional text...] # Reject the entire message. The optional text is sent to the # originator and is logged to the maillog file. +# OK Skip all further header patterns for this header line. # IGNORE Silently discard the message header. # WARN [optional text...] # Log the message header and the optional text. This is useful -# for testing. When the pattern is OK, change the WARN into a +# for testing. When the pattern is good, change the WARN into a # REJECT or into a DISCARD. # HOLD [optional text...] # Place the message on the hold queue. Mail on hold can be diff --git a/gnu/dist/postfix/conf/sample-resource.cf b/gnu/dist/postfix/conf/sample-resource.cf index 4fcc214f845..9c8259a6a59 100644 --- a/gnu/dist/postfix/conf/sample-resource.cf +++ b/gnu/dist/postfix/conf/sample-resource.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-resource.cf,v 1.2 2002/12/24 21:37:46 perry Exp $ +# $NetBSD: sample-resource.cf,v 1.3 2004/03/27 16:31:19 heas Exp $ # # DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF # HERE JUST SERVES AS AN EXAMPLE. @@ -89,13 +89,13 @@ message_size_limit = 10240000 # The qmgr_message_active_limit parameter limits the number of # messages in the active queue. # -qmgr_message_active_limit = 1000 +qmgr_message_active_limit = 20000 # The qmgr_message_recipient_limit parameter limits the number of # in-memory recipients. This parameter also limits the size of the # short-term, in-memory destination status cache. # -qmgr_message_recipient_limit = 1000 +qmgr_message_recipient_limit = 20000 # The queue_minfree parameter specifies the minimal amount of free # space in bytes in the queue file system. This is currently used by diff --git a/gnu/dist/postfix/conf/sample-smtpd.cf b/gnu/dist/postfix/conf/sample-smtpd.cf index 23d2d8bfd80..2993cdca400 100644 --- a/gnu/dist/postfix/conf/sample-smtpd.cf +++ b/gnu/dist/postfix/conf/sample-smtpd.cf @@ -1,4 +1,4 @@ -# $NetBSD: sample-smtpd.cf,v 1.3 2003/03/08 19:43:58 perry Exp $ +# $NetBSD: sample-smtpd.cf,v 1.4 2004/03/27 16:31:19 heas Exp $ # # DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF # HERE JUST SERVES AS AN EXAMPLE. @@ -139,9 +139,7 @@ smtpd_banner = $myhostname ESMTP $mail_name # check_client_access maptype:mapname # look up client name, parent domains, client address, # or networks obtained by stripping octets. -# Skip this lookup table if the result is DUNNO. -# Reject the ETRN command if the result is REJECT text... or "[45]xx text" -# Permit the ETRN command if the result is OK or all numerical. +# see access(5) for possible lookup results. # reject_rbl_client domain.tld: reject if the reverse client network # address is listed in an A record under domain.tld. # reject_rhsbl_client domain.tld: reject if the client hostname is listed @@ -273,13 +271,7 @@ mynetworks_style = subnet # check_client_access maptype:mapname # look up client name, parent domains, client address, # or networks obtained by stripping octets. -# Skip this lookup table if the result is DUNNO. -# Reject the SMTP client if the result is REJECT text... or "[45]xx text" -# Discard the message if the result is DISCARD text... -# Hold the message in the queue if the result is HOLD text... -# Release mail "on hold" with the postsuper(1) command. -# Filter the message if the result is FILTER transport:nexthop. -# Permit the SMTP client if the result is OK or all numerical. +# see access(5) for possible lookup results. # reject_rbl_client domain.tld: reject if the reversed client IP address # is listed in an A record under domain.tld. # reject_rhsbl_client domain.tld: reject if the client hostname is listed @@ -320,13 +312,7 @@ smtpd_helo_required = no # reject_non_fqdn_hostname: reject HELO hostname that is not in FQDN form # check_helo_access maptype:mapname # look up HELO hostname or parent domains. -# Skip this lookup table if the result is DUNNO. -# Reject the HELO command if the result is REJECT text... or "[45]xx text" -# Discard the message if the result is DISCARD text... -# Hold the message in the queue if the result is HOLD text... -# Release mail "on hold" with the postsuper(1) command. -# Filter the message if the result is FILTER transport:nexthop. -# Permit the HELO command if the result is OK or all numerical. +# see access(5) for possible lookup results. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. # warn_if_reject: next restriction logs a warning instead of rejecting. @@ -358,13 +344,7 @@ smtpd_helo_restrictions = # in an A record under domain.tld. # check_sender_access maptype:mapname # look up sender address, parent domain, or localpart@. -# Skip this lookup table if the result is DUNNO. -# Reject the sender if the result is REJECT text... or "[45]xx text" -# Discard the message if the result is DISCARD text... -# Hold the message in the queue if the result is HOLD text... -# Release mail "on hold" with the postsuper(1) command. -# Filter the message if the result is FILTER transport:nexthop. -# Permit the sender if the result is OK or all numerical. +# see access(5) for possible lookup results. # reject_sender_login_mismatch: reject if $smtpd_sender_login_maps specifies # a MAIL FROM address owner, but the client is not (SASL) logged in as # that MAIL FROM address owner; or if the client is (SASL) logged in, but @@ -418,7 +398,7 @@ smtpd_sender_restrictions = # $virtual_alias_domains, or $virtual_mailbox_domains. # - to destinations matching $relay_domains or subdomain thereof, # except for addresses with sender-specified routing. -# reject_unauth_destination: reject mail unless it is sent +# *reject_unauth_destination: reject mail unless it is sent # - to destinations matching $inet_interfaces, $mydestination, # $virtual_alias_domains, or $virtual_mailbox_domains. # - to destinations matching $relay_domains or subdomain thereof, @@ -430,13 +410,7 @@ smtpd_sender_restrictions = # reject_unknown_recipient_domain: reject domains without A or MX record. # check_recipient_access maptype:mapname # look up recipient address, parent domain, or localpart@. -# Skip this lookup table if the result is DUNNO. -# Reject the recipient if the result is REJECT text... or "[45]xx text" -# Discard the message if the result is DISCARD text... -# Hold the message in the queue if the result is HOLD text... -# Release mail "on hold" with the postsuper(1) command. -# Filter the message if the result is FILTER transport:nexthop. -# Permit the recipient if the result is OK or all numerical. +# see access(5) for possible lookup results. # reject_non_fqdn_recipient: reject recipient address that is not in FQDN form # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. diff --git a/gnu/dist/postfix/makedefs b/gnu/dist/postfix/makedefs index 0531121f613..0827f00e3c2 100644 --- a/gnu/dist/postfix/makedefs +++ b/gnu/dist/postfix/makedefs @@ -251,14 +251,18 @@ ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543 SYSLIBS="-lresolv -lsocket -lnsl" ;; Rhapsody.5*|Darwin.*) - SYSTYPE=RHAPSODY5 + SYSTYPE=MACOSX # Use the native compiler by default : ${CC=cc} - AWK=gawk case $RELEASE in - 1.[0-3]) ;; + 1.[0-3]) AWK=gawk + ;; + [2-6].*) AWK=awk + SYSLIBS=-flat_namespace + ;; *) AWK=awk SYSLIBS=-flat_namespace + CCARGS="$CCARGS -DBIND_8_COMPAT -DNO_NETINFO" ;; esac ;; diff --git a/gnu/dist/postfix/man/man5/canonical.5 b/gnu/dist/postfix/man/man5/canonical.5 index 3b963cbef0d..37f6d320612 100644 --- a/gnu/dist/postfix/man/man5/canonical.5 +++ b/gnu/dist/postfix/man/man5/canonical.5 @@ -53,7 +53,7 @@ Use the \fBaliases\fR(5) map for that purpose. .nf .ad .fi -The format of the \fBcanonical\fR table is as follows: +The input format for the \fBpostmap\fR(1) command is as follows: .IP "\fIpattern result\fR" When \fIpattern\fR matches a mail address, replace it by the corresponding \fIresult\fR. diff --git a/gnu/dist/postfix/man/man5/virtual.5 b/gnu/dist/postfix/man/man5/virtual.5 index 98a64d047f8..c314bc59cfe 100644 --- a/gnu/dist/postfix/man/man5/virtual.5 +++ b/gnu/dist/postfix/man/man5/virtual.5 @@ -55,8 +55,7 @@ the lookups are done in a slightly different way as described below. .nf .ad .fi -The format of the virtual table is as follows, mappings being -tried in the order as listed in this manual page: +The input format for the \fBpostmap\fR(1) command is as follows: .IP "\fIpattern result\fR" When \fIpattern\fR matches a mail address, replace it by the corresponding \fIresult\fR. @@ -141,9 +140,9 @@ See the output from \fBpostconf -m\fR for available database types. .fi .sp The \fIvirtual-alias.domain anything\fR entry is required for a -virtual alias domain. Without this entry, mail is rejected +virtual alias domain. \fBWithout this entry, mail is rejected with "relay access denied", or bounces with -"mail loops back to myself". +"mail loops back to myself".\fR Do not specify virtual alias domain names in the \fBmain.cf mydestination\fR or \fBrelay_domains\fR configuration parameters. diff --git a/gnu/dist/postfix/man/man8/cleanup.8 b/gnu/dist/postfix/man/man8/cleanup.8 index 237b75c4436..30ae10f1c12 100644 --- a/gnu/dist/postfix/man/man8/cleanup.8 +++ b/gnu/dist/postfix/man/man8/cleanup.8 @@ -121,7 +121,7 @@ this also breaks majordomo approval requests when the included request contains valid 8-bit MIME mail, and it breaks bounces from mailers that do not properly encapsulate 8-bit content (for example, bounces from qmail or from old versions of Postfix). -.IP \fBstrict_mime_domain_encoding\fR +.IP \fBstrict_mime_encoding_domain\fR Reject mail with invalid \fBContent-Transfer-Encoding:\fR information for message/* or multipart/*. This blocks mail from poorly written software. @@ -173,7 +173,7 @@ Limits the number of envelope recipients that are remembered. .IP \fBheader_address_token_limit\fR Limits the number of address tokens used to process a message header. .IP \fBheader_size_limit\fR -Limits the amount of memory in bytes used to process a message header. +Limits the amount of memory in bytes used to store a message header. .IP \fBin_flow_delay\fR Amount of time to pause before accepting a message, when the message arrival rate exceeds the message delivery rate. diff --git a/gnu/dist/postfix/src/cleanup/cleanup.c b/gnu/dist/postfix/src/cleanup/cleanup.c index f6cbd8d9115..2a73ea97bd7 100644 --- a/gnu/dist/postfix/src/cleanup/cleanup.c +++ b/gnu/dist/postfix/src/cleanup/cleanup.c @@ -107,7 +107,7 @@ /* request contains valid 8-bit MIME mail, and it breaks bounces from /* mailers that do not properly encapsulate 8-bit content (for example, /* bounces from qmail or from old versions of Postfix). -/* .IP \fBstrict_mime_domain_encoding\fR +/* .IP \fBstrict_mime_encoding_domain\fR /* Reject mail with invalid \fBContent-Transfer-Encoding:\fR /* information for message/* or multipart/*. This blocks mail /* from poorly written software. @@ -159,7 +159,7 @@ /* .IP \fBheader_address_token_limit\fR /* Limits the number of address tokens used to process a message header. /* .IP \fBheader_size_limit\fR -/* Limits the amount of memory in bytes used to process a message header. +/* Limits the amount of memory in bytes used to store a message header. /* .IP \fBin_flow_delay\fR /* Amount of time to pause before accepting a message, when the /* message arrival rate exceeds the message delivery rate. diff --git a/gnu/dist/postfix/src/cleanup/cleanup_envelope.c b/gnu/dist/postfix/src/cleanup/cleanup_envelope.c index 3ef96b0e8e7..5be545bb5ac 100644 --- a/gnu/dist/postfix/src/cleanup/cleanup_envelope.c +++ b/gnu/dist/postfix/src/cleanup/cleanup_envelope.c @@ -153,10 +153,12 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type, char *buf, } } if (type == REC_TYPE_TIME) { - state->time = atol(buf); + if (state->time == 0) + state->time = atol(buf); cleanup_out(state, type, buf, len); } else if (type == REC_TYPE_FULL) { - state->fullname = mystrdup(buf); + if (state->fullname == 0) + state->fullname = mystrdup(buf); } else if (type == REC_TYPE_FROM) { VSTRING *clean_addr = vstring_alloc(100); @@ -211,6 +213,8 @@ static void cleanup_envelope_process(CLEANUP_STATE *state, int type, char *buf, vstring_free(clean_addr); myfree(state->orig_rcpt); state->orig_rcpt = 0; + } else if (type == REC_TYPE_DONE) { + /* void */ ; } else if (type == REC_TYPE_WARN) { if ((state->warn_time = atol(buf)) < 0) { state->errs |= CLEANUP_STAT_BAD; diff --git a/gnu/dist/postfix/src/dns/dns_lookup.c b/gnu/dist/postfix/src/dns/dns_lookup.c index 4ff4fe2bd50..81a1dda734b 100644 --- a/gnu/dist/postfix/src/dns/dns_lookup.c +++ b/gnu/dist/postfix/src/dns/dns_lookup.c @@ -141,6 +141,7 @@ static int dns_query(const char *name, int type, int flags, { HEADER *reply_header; int len; + unsigned long saved_options = _res.options; /* * Initialize the name service. @@ -167,6 +168,7 @@ static int dns_query(const char *name, int type, int flags, * only if the name server told us so. */ len = res_search((char *) name, C_IN, type, reply->buf, sizeof(reply->buf)); + _res.options = saved_options; if (len < 0) { if (why) vstring_sprintf(why, "Name service error for name=%s type=%s: %s", diff --git a/gnu/dist/postfix/src/global/Makefile.in b/gnu/dist/postfix/src/global/Makefile.in index a981d06f978..8f48d059fd8 100644 --- a/gnu/dist/postfix/src/global/Makefile.in +++ b/gnu/dist/postfix/src/global/Makefile.in @@ -1210,6 +1210,7 @@ tok822_parse.o: ../../include/sys_defs.h tok822_parse.o: ../../include/vstring.h tok822_parse.o: ../../include/vbuf.h tok822_parse.o: ../../include/msg.h +tok822_parse.o: ../../include/stringops.h tok822_parse.o: lex_822.h tok822_parse.o: quote_822_local.h tok822_parse.o: quote_flags.h diff --git a/gnu/dist/postfix/src/global/tok822_parse.c b/gnu/dist/postfix/src/global/tok822_parse.c index fe554bf7ae2..4866ac5ad3d 100644 --- a/gnu/dist/postfix/src/global/tok822_parse.c +++ b/gnu/dist/postfix/src/global/tok822_parse.c @@ -126,6 +126,7 @@ #include <vstring.h> #include <msg.h> +#include <stringops.h> /* Global library. */ @@ -250,7 +251,7 @@ static void strip_address(VSTRING *vp, int start, TOK822 *addr) * Emit plain <address>. Discard any comments or phrases. */ msg_warn("stripping too many comments from address: %.100s...", - vstring_str(vp) + start); + printable(vstring_str(vp) + start, '?')); vstring_truncate(vp, start); VSTRING_ADDCH(vp, '<'); if (addr) { @@ -263,7 +264,6 @@ static void strip_address(VSTRING *vp, int start, TOK822 *addr) VSTRING_ADDCH(vp, '>'); } - /* tok822_externalize - token tree to string, external form */ VSTRING *tok822_externalize(VSTRING *vp, TOK822 *tree, int flags) diff --git a/gnu/dist/postfix/src/master/master_ent.c b/gnu/dist/postfix/src/master/master_ent.c index cccaa8ea156..8c22bb91c95 100644 --- a/gnu/dist/postfix/src/master/master_ent.c +++ b/gnu/dist/postfix/src/master/master_ent.c @@ -234,11 +234,27 @@ MASTER_SERV *get_master_ent() int n; char *bufp; char *atmp; + static char *saved_interfaces = 0; if (master_fp == 0) msg_panic("get_master_ent: config file not open"); /* + * XXX We cannot change the inet_interfaces setting for a running master + * process. Listening sockets are inherited by child processes so that + * closing and reopening those sockets in the master does not work. + * + * Another problem is that library routines still cache results that are + * based on the old inet_interfaces setting. It is too much trouble to + * recompute everything. + * + * In order to keep our data structures consistent we ignore changes in + * inet_interfaces settings, and issue a warning instead. + */ + if (saved_interfaces == 0) + saved_interfaces = mystrdup(var_inet_interfaces); + + /* * Skip blank lines and comment lines. */ do { @@ -274,6 +290,12 @@ MASTER_SERV *get_master_ent() transport = get_str_ent(&bufp, "transport type", (char *) 0); if (STR_SAME(transport, MASTER_XPORT_NAME_INET)) { + if (!STR_SAME(saved_interfaces, var_inet_interfaces)) { + msg_warn("service %s: ignoring %s change", + name, VAR_INET_INTERFACES); + msg_warn("to change %s, stop and start Postfix", + VAR_INET_INTERFACES); + } serv->type = MASTER_SERV_TYPE_INET; atmp = inet_parse(name, &host, &port); if (*host) { @@ -281,10 +303,12 @@ MASTER_SERV *get_master_ent() MASTER_INET_ADDRLIST(serv) = (INET_ADDR_LIST *) mymalloc(sizeof(*MASTER_INET_ADDRLIST(serv))); inet_addr_list_init(MASTER_INET_ADDRLIST(serv)); - inet_addr_host(MASTER_INET_ADDRLIST(serv), host); + if (inet_addr_host(MASTER_INET_ADDRLIST(serv), host) == 0) + msg_fatal("%s: line %d: bad hostname or network address: %s", + VSTREAM_PATH(master_fp), master_line, host); inet_addr_list_uniq(MASTER_INET_ADDRLIST(serv)); serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used; - } else if (strcasecmp(var_inet_interfaces, DEF_INET_INTERFACES) == 0) { + } else if (strcasecmp(saved_interfaces, DEF_INET_INTERFACES) == 0) { MASTER_INET_ADDRLIST(serv) = 0; /* wild-card */ serv->listen_fd_count = 1; } else { diff --git a/gnu/dist/postfix/src/qmgr/qmgr_message.c b/gnu/dist/postfix/src/qmgr/qmgr_message.c index 233477cd850..9afac7ff9c2 100644 --- a/gnu/dist/postfix/src/qmgr/qmgr_message.c +++ b/gnu/dist/postfix/src/qmgr/qmgr_message.c @@ -273,6 +273,7 @@ static int qmgr_message_read(QMGR_MESSAGE *message) "queue %s", message->queue_name); } } else if (rec_type == REC_TYPE_RCPT) { + /* See also below for code setting orig_rcpt. */ #define FUDGE(x) ((x) * (var_qmgr_fudge / 100.0)) if (message->rcpt_list.len < FUDGE(var_qmgr_rcpt_limit)) { qmgr_rcpt_list_add(&message->rcpt_list, curr_offset, @@ -347,7 +348,9 @@ static int qmgr_message_read(QMGR_MESSAGE *message) orig_rcpt = 0; } if (rec_type == REC_TYPE_ORCP) - orig_rcpt = mystrdup(start); + /* See also above for code clearing orig_rcpt. */ + if (message->rcpt_offset == 0) + orig_rcpt = mystrdup(start); } while (rec_type > 0 && rec_type != REC_TYPE_END); /* diff --git a/gnu/dist/postfix/src/smtp/smtp_connect.c b/gnu/dist/postfix/src/smtp/smtp_connect.c index 173ec7461de..2fe78eec1a1 100644 --- a/gnu/dist/postfix/src/smtp/smtp_connect.c +++ b/gnu/dist/postfix/src/smtp/smtp_connect.c @@ -112,6 +112,7 @@ #include <timed_connect.h> #include <stringops.h> #include <host_port.h> +#include <sane_connect.h> /* Global library. */ @@ -208,7 +209,7 @@ static SMTP_SESSION *smtp_connect_addr(DNS_RR *addr, unsigned port, non_blocking(sock, BLOCKING); errno = saved_errno; } else { - conn_stat = connect(sock, (struct sockaddr *) & sin, sizeof(sin)); + conn_stat = sane_connect(sock, (struct sockaddr *) & sin, sizeof(sin)); } if (conn_stat < 0) { vstring_sprintf(why, "connect to %s[%s]: %m", @@ -345,7 +346,7 @@ static char *smtp_parse_destination(char *destination, char *def_service, /* * Convert service to port number, network byte order. */ - if ((port = atoi(service)) != 0) { + if (alldig(service) && (port = atoi(service)) != 0) { *portp = htons(port); } else { if ((sp = getservbyname(service, protocol)) == 0) diff --git a/gnu/dist/postfix/src/smtpd/smtpd.c b/gnu/dist/postfix/src/smtpd/smtpd.c index 185ddd22777..4fd11947101 100644 --- a/gnu/dist/postfix/src/smtpd/smtpd.c +++ b/gnu/dist/postfix/src/smtpd/smtpd.c @@ -59,7 +59,7 @@ /* Disallow non-RFC 821 style addresses in SMTP commands. For example, /* the RFC822-style address forms with comments that Sendmail allows. /* .IP \fBbroken_sasl_auth_clients\fR -/* Support older Microsoft clients that mis-implement the AUTH +/* Support Microsoft clients that implement an older version of the AUTH /* protocol, and that expect an EHLO response of "250 AUTH=list" /* instead of "250 AUTH list". /* .IP \fBsmtpd_noop_commands\fR @@ -73,7 +73,7 @@ /* This parameter uses the same syntax as the right-hand side of /* a Postfix transport table. /* .SH "Authentication controls" -/* .IP \fBenable_sasl_authentication\fR +/* .IP \fBsmtpd_sasl_auth_enable\fR /* Enable per-session authentication as per RFC 2554 (SASL). /* This functionality is available only when explicitly selected /* at program build time and explicitly enabled at runtime. @@ -629,7 +629,9 @@ static char *extract_addr(SMTPD_STATE *state, SMTPD_TOKEN *arg, int naddr; int non_addr; char *err = 0; - char *junk; + char *junk = 0; + char *text; + char *colon; /* * Special case. @@ -653,11 +655,19 @@ static char *extract_addr(SMTPD_STATE *state, SMTPD_TOKEN *arg, msg_info("%s: input: %s", myname, STR(arg->vstrval)); if (STR(arg->vstrval)[0] == '<' && STR(arg->vstrval)[LEN(arg->vstrval) - 1] == '>') { - junk = mystrndup(STR(arg->vstrval) + 1, LEN(arg->vstrval) - 2); - tree = tok822_parse(junk); - myfree(junk); + junk = text = mystrndup(STR(arg->vstrval) + 1, LEN(arg->vstrval) - 2); } else - tree = tok822_parse(STR(arg->vstrval)); + text = STR(arg->vstrval); + + /* + * Truncate deprecated route address form. + */ + if (*text == '@' && (colon = strchr(text, ':')) != 0) + text = colon + 1; + tree = tok822_parse(text); + + if (junk) + myfree(junk); /* * Find trouble. @@ -796,7 +806,7 @@ static int mail_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) verp_delims = arg + VERP_CMD_LEN + 1; if (verp_delims_verify(verp_delims) != 0) { state->error_mask |= MAIL_ERROR_PROTOCOL; - smtpd_chat_reply(state, "501 %s needs two characters from %s", + smtpd_chat_reply(state, "501 Error: %s needs two characters from %s", VERP_CMD, var_verp_filter); return (-1); } @@ -808,7 +818,8 @@ static int mail_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) } } if (verp_delims && argv[2].strval[0] == 0) { - smtpd_chat_reply(state, "503 Error: XVERP requires non-null sender"); + smtpd_chat_reply(state, "503 Error: %s requires non-null sender", + VERP_CMD); return (-1); } state->time = time((time_t *) 0); @@ -837,10 +848,12 @@ static int mail_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) /* * Record the time of arrival and the sender envelope address. */ - rec_fprintf(state->cleanup, REC_TYPE_TIME, "%ld", - (long) time((time_t *) 0)); - if (*var_filter_xport) - rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s", var_filter_xport); + if (SMTPD_STAND_ALONE(state) == 0) { + rec_fprintf(state->cleanup, REC_TYPE_TIME, "%ld", + (long) time((time_t *) 0)); + if (*var_filter_xport) + rec_fprintf(state->cleanup, REC_TYPE_FILT, "%s", var_filter_xport); + } rec_fputs(state->cleanup, REC_TYPE_FROM, argv[2].strval); if (encoding != 0) rec_fprintf(state->cleanup, REC_TYPE_ATTR, "%s=%s", @@ -893,6 +906,7 @@ static void mail_reset(SMTPD_STATE *state) if (var_smtpd_sasl_enable) smtpd_sasl_mail_reset(state); #endif + state->discard = 0; } /* rcpt_cmd - process RCPT TO command */ @@ -951,10 +965,6 @@ static int rcpt_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) smtpd_chat_reply(state, "%s", err); return (-1); } - if ((err = smtpd_check_rcptmap(state, argv[2].strval)) != 0) { - smtpd_chat_reply(state, "%s", err); - return (-1); - } } /* @@ -1259,7 +1269,7 @@ static int vrfy_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) return (-1); } if (SMTPD_STAND_ALONE(state) == 0 - && (err = smtpd_check_rcptmap(state, argv[1].strval)) != 0) { + && (err = smtpd_check_rcpt(state, argv[1].strval)) != 0) { smtpd_chat_reply(state, "%s", err); return (-1); } @@ -1463,7 +1473,8 @@ static void smtpd_proto(SMTPD_STATE *state) break; case 0: - if (var_smtpd_delay_reject == 0 + if (SMTPD_STAND_ALONE(state) == 0 + && var_smtpd_delay_reject == 0 && (state->access_denied = smtpd_check_client(state)) != 0) { smtpd_chat_reply(state, "%s", state->access_denied); } else { diff --git a/gnu/dist/postfix/src/smtpd/smtpd_check.c b/gnu/dist/postfix/src/smtpd/smtpd_check.c index 678a86f0b04..755e551a7ae 100644 --- a/gnu/dist/postfix/src/smtpd/smtpd_check.c +++ b/gnu/dist/postfix/src/smtpd/smtpd_check.c @@ -24,10 +24,6 @@ /* SMTPD_STATE *state; /* char *recipient; /* -/* char *smtpd_check_rcptmap(state, recipient) -/* SMTPD_STATE *state; -/* char *recipient; -/* /* char *smtpd_check_etrn(state, destination) /* SMTPD_STATE *state; /* char *destination; @@ -192,11 +188,7 @@ /* .IP smtpd_recipient_restrictions /* Restrictions on the recipient address that is sent with the RCPT /* TO command. -/* .PP -/* smtpd_check_rcptmap() validates the recipient address provided -/* with an RCPT TO request and sets the rcptmap_checked flag. -/* Relevant configuration parameters: -/* .IP local_recipients_map +/* .IP local_recipient_maps /* Tables of user names (not addresses) that exist in $mydestination. /* Mail for local users not in these tables is rejected. /* .PP @@ -795,6 +787,13 @@ static int smtpd_check_reject(SMTPD_STATE *state, int error_class, va_end(ap); /* + * Ensure RFC compliance. We could do this inside smtpd_chat_reply() and + * switch to multi-line for long replies. + */ + vstring_truncate(error_text, 510); + VSTRING_TERMINATE(error_text); + + /* * Validate the response, that is, the response must begin with a * three-digit status code, and the first digit must be 4 or 5. If the * response is bad, log a warning and send a generic response instead. @@ -1622,6 +1621,31 @@ static int reject_unknown_address(SMTPD_STATE *state, const char *addr, return (reject_unknown_mailhost(state, domain, reply_name, reply_class)); } +/* warn_skip_access_action - FILTER etc. action in unsupported context */ + +static void warn_skip_access_action(const char *table, const char *action, + const char *reply_class) +{ + + /* + * Warn only about FILTER/HOLD/etc. access table actions that appear in + * restrictions where they will always be ignored. + */ + if (strcmp(reply_class, SMTPD_NAME_CLIENT) == 0 + || strcmp(reply_class, SMTPD_NAME_HELO) == 0 + || strcmp(reply_class, SMTPD_NAME_SENDER) == 0) { + if (var_smtpd_delay_reject == 0) + msg_warn("access table %s: with %s=%s, " + "action %s is always skipped in %s restrictions", + table, VAR_SMTPD_DELAY_REJECT, CONFIG_BOOL_NO, + action, reply_class); + } else { + msg_warn("access table %s: action %s is always " + "skipped in %s restrictions", + table, action, reply_class); + } +} + /* check_table_result - translate table lookup result into pass/reject */ static int check_table_result(SMTPD_STATE *state, const char *table, @@ -1673,6 +1697,12 @@ static int check_table_result(SMTPD_STATE *state, const char *table, * mind, and reject/discard the message for other reasons. */ if (STREQUAL(value, "FILTER", cmd_len)) { +#ifndef TEST + if (state->dest == 0) { + warn_skip_access_action(table, "FILTER", reply_class); + return (SMTPD_CHECK_DUNNO); + } +#endif if (*cmd_text == 0) { msg_warn("access map %s entry \"%s\" has FILTER entry without value", table, datum); @@ -1697,6 +1727,12 @@ static int check_table_result(SMTPD_STATE *state, const char *table, * reject/discard the message for other reasons. */ if (STREQUAL(value, "HOLD", cmd_len)) { +#ifndef TEST + if (state->dest == 0) { + warn_skip_access_action(table, "HOLD", reply_class); + return (SMTPD_CHECK_DUNNO); + } +#endif vstring_sprintf(error_text, "<%s>: %s %s", reply_name, reply_class, *cmd_text ? cmd_text : "triggers HOLD action"); log_whatsup(state, "hold", STR(error_text)); @@ -1709,17 +1745,21 @@ static int check_table_result(SMTPD_STATE *state, const char *table, /* * DISCARD means silently discard and claim successful delivery. - * - * XXX Set some global flag that disables all further restrictions. - * Triggering a "reject" or "hold" action after "discard" is silly. */ if (STREQUAL(value, "DISCARD", cmd_len)) { +#ifndef TEST + if (state->dest == 0) { + warn_skip_access_action(table, "DISCARD", reply_class); + return (SMTPD_CHECK_DUNNO); + } +#endif vstring_sprintf(error_text, "<%s>: %s %s", reply_name, reply_class, *cmd_text ? cmd_text : "triggers DISCARD action"); log_whatsup(state, "discard", STR(error_text)); #ifndef TEST rec_fprintf(state->dest->stream, REC_TYPE_FLGS, "%d", CLEANUP_FLAG_DISCARD); + state->discard = 1; #endif return (SMTPD_CHECK_OK); } @@ -2548,6 +2588,9 @@ static int generic_checks(SMTPD_STATE *state, ARGV *restrictions, for (cpp = restrictions->argv; (name = *cpp) != 0; cpp++) { + if (state->discard != 0) + break; + if (msg_verbose) msg_info("%s: name=%s", myname, name); @@ -2998,10 +3041,7 @@ char *smtpd_check_rcpt(SMTPD_STATE *state, char *recipient) /* * The "check_recipient_maps" restriction is relevant only when - * responding to RCPT TO. It's effectively disabled with DATA (recipient - * context is explicitly turned off) and not applicable with undelayed - * client/helo/sender restrictions (no recipient info) or with ETRN - * (command not allowed in the middle of an ongoing MAIL transaction). + * responding to RCPT TO or VRFY. */ state->rcptmap_checked = 0; @@ -3027,7 +3067,7 @@ char *smtpd_check_rcpt(SMTPD_STATE *state, char *recipient) SMTPD_CHECK_RESET(); status = setjmp(smtpd_check_buf); if (status == 0 && rcpt_restrctions->argc) - status = generic_checks(state, rcpt_restrctions, + status = generic_checks(state, rcpt_restrctions, recipient, SMTPD_NAME_RECIPIENT, CHECK_RECIP_ACL); /* @@ -3038,6 +3078,14 @@ char *smtpd_check_rcpt(SMTPD_STATE *state, char *recipient) status = smtpd_check_reject(state, state->defer_if_permit.class, "%s", STR(state->defer_if_permit.reason)); + /* + * If the "check_recipient_maps" restriction was not applied, and if mail + * is not being rejected or discarded, validate the recipient here. + */ + if (status != SMTPD_CHECK_REJECT && state->rcptmap_checked == 0 + && state->discard == 0) + status = check_rcpt_maps(state, recipient); + SMTPD_CHECK_RCPT_RETURN(status == SMTPD_CHECK_REJECT ? STR(error_text) : 0); } @@ -3102,25 +3150,6 @@ char *smtpd_check_etrn(SMTPD_STATE *state, char *domain) SMTPD_CHECK_ETRN_RETURN(status == SMTPD_CHECK_REJECT ? STR(error_text) : 0); } -/* smtpd_check_rcptmap - permit if recipient address matches lookup table */ - -char *smtpd_check_rcptmap(SMTPD_STATE *state, char *recipient) -{ - char *myname = "smtpd_check_rcptmap"; - int status; - - if (msg_verbose) - msg_info("%s: %s", myname, recipient); - - /* - * Return here in case of serious trouble. - */ - if ((status = setjmp(smtpd_check_buf)) == 0) - status = check_rcpt_maps(state, recipient); - - return (status == SMTPD_CHECK_REJECT ? STR(error_text) : 0); -} - /* check_rcpt_maps - generic_checks() interface for recipient table check */ static int check_rcpt_maps(SMTPD_STATE *state, const char *recipient) @@ -3198,13 +3227,13 @@ static int check_rcpt_maps(SMTPD_STATE *state, const char *recipient) if ((reply->flags & RESOLVE_CLASS_LOCAL) && *var_local_rcpt_maps - /* Generated by bounce, absorbed by qmgr. */ + /* Generated by bounce, absorbed by qmgr. */ && !MATCH_LEFT(var_double_bounce_sender, CONST_STR(reply->recipient), strlen(var_double_bounce_sender)) - /* Absorbed by qmgr. */ + /* Absorbed by qmgr. */ && !MATCH_LEFT(MAIL_ADDR_POSTMASTER, CONST_STR(reply->recipient), strlen(MAIL_ADDR_POSTMASTER)) - /* Generated by bounce. */ + /* Generated by bounce. */ && !MATCH_LEFT(MAIL_ADDR_MAIL_DAEMON, CONST_STR(reply->recipient), strlen(MAIL_ADDR_MAIL_DAEMON)) && NOMATCH(local_rcpt_maps, CONST_STR(reply->recipient))) @@ -3486,6 +3515,7 @@ int var_local_rcpt_code; int var_relay_rcpt_code; int var_virt_mailbox_code; int var_virt_alias_code; +int var_show_unk_rcpt_table; static INT_TABLE int_table[] = { "msg_verbose", 0, &msg_verbose, @@ -3505,6 +3535,7 @@ static INT_TABLE int_table[] = { VAR_RELAY_RCPT_CODE, DEF_RELAY_RCPT_CODE, &var_relay_rcpt_code, VAR_VIRT_ALIAS_CODE, DEF_VIRT_ALIAS_CODE, &var_virt_alias_code, VAR_VIRT_MAILBOX_CODE, DEF_VIRT_MAILBOX_CODE, &var_virt_mailbox_code, + VAR_SHOW_UNK_RCPT_TABLE, DEF_SHOW_UNK_RCPT_TABLE, &var_show_unk_rcpt_table, 0, }; @@ -3883,8 +3914,7 @@ int main(int argc, char **argv) } else if (strcasecmp(args->argv[0], "rcpt") == 0) { state.where = "RCPT"; TRIM_ADDR(args->argv[1], addr); - (resp = smtpd_check_rcpt(&state, addr)) - || (resp = smtpd_check_rcptmap(&state, addr)); + resp = smtpd_check_rcpt(&state, addr); } break; diff --git a/gnu/dist/postfix/src/util/Makefile.in b/gnu/dist/postfix/src/util/Makefile.in index 4167dfff018..d1d841bb545 100644 --- a/gnu/dist/postfix/src/util/Makefile.in +++ b/gnu/dist/postfix/src/util/Makefile.in @@ -26,7 +26,7 @@ SRCS = alldig.c argv.c argv_split.c attr_print0.c attr_print64.c \ unix_connect.c unix_listen.c unix_trigger.c unsafe.c username.c \ valid_hostname.c vbuf.c vbuf_print.c vstream.c vstream_popen.c \ vstring.c vstring_vstream.c watchdog.c writable.c write_buf.c \ - write_wait.c strcasecmp.c nvtable.c host_port.c + write_wait.c strcasecmp.c nvtable.c host_port.c sane_connect.c OBJS = alldig.o argv.o argv_split.o attr_print0.o attr_print64.o \ attr_scan0.o attr_scan64.o base64_code.o basename.o binhash.o \ chroot_uid.o clean_env.o close_on_exec.o concatenate.o ctable.o \ @@ -54,7 +54,7 @@ OBJS = alldig.o argv.o argv_split.o attr_print0.o attr_print64.o \ unix_connect.o unix_listen.o unix_trigger.o unsafe.o username.o \ valid_hostname.o vbuf.o vbuf_print.o vstream.o vstream_popen.o \ vstring.o vstring_vstream.o watchdog.o writable.o write_buf.o \ - write_wait.o nvtable.o $(STRCASE) host_port.o + write_wait.o nvtable.o host_port.o sane_connect.o $(STRCASE) HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \ connect.h ctable.h dict.h dict_db.h dict_dbm.h dict_env.h \ dict_ht.h dict_ldap.h dict_mysql.h dict_ni.h dict_nis.h \ @@ -72,7 +72,7 @@ HDRS = argv.h attr.h base64_code.h binhash.h chroot_uid.h clean_env.h \ split_at.h stat_as.h stringops.h sys_defs.h timed_connect.h \ timed_wait.h trigger.h username.h valid_hostname.h vbuf.h \ vbuf_print.h vstream.h vstring.h vstring_vstream.h watchdog.h \ - nvtable.h host_port.h + nvtable.h host_port.h sane_connect.h TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \ stream_test.c dup2_pass_on_exec.c WARN = -W -Wformat -Wimplicit -Wmissing-prototypes \ @@ -739,6 +739,9 @@ file_limit.o: iostuff.h find_inet.o: find_inet.c find_inet.o: sys_defs.h find_inet.o: msg.h +find_inet.o: stringops.h +find_inet.o: vstring.h +find_inet.o: vbuf.h find_inet.o: find_inet.h fsspace.o: fsspace.c fsspace.o: sys_defs.h @@ -805,6 +808,7 @@ inet_connect.o: msg.h inet_connect.o: find_inet.h inet_connect.o: inet_util.h inet_connect.o: iostuff.h +inet_connect.o: sane_connect.h inet_connect.o: connect.h inet_connect.o: timed_connect.h inet_listen.o: inet_listen.c @@ -916,6 +920,7 @@ msg_syslog.o: stringops.h msg_syslog.o: msg.h msg_syslog.o: msg_output.h msg_syslog.o: msg_syslog.h +msg_syslog.o: safe.h msg_vstream.o: msg_vstream.c msg_vstream.o: sys_defs.h msg_vstream.o: vstream.h @@ -1036,6 +1041,10 @@ sane_accept.o: sane_accept.c sane_accept.o: sys_defs.h sane_accept.o: msg.h sane_accept.o: sane_accept.h +sane_connect.o: sane_connect.c +sane_connect.o: sys_defs.h +sane_connect.o: msg.h +sane_connect.o: sane_connect.h sane_link.o: sane_link.c sane_link.o: sys_defs.h sane_link.o: msg.h @@ -1143,9 +1152,11 @@ timed_connect.o: timed_connect.c timed_connect.o: sys_defs.h timed_connect.o: msg.h timed_connect.o: iostuff.h +timed_connect.o: sane_connect.h timed_connect.o: timed_connect.h timed_read.o: timed_read.c timed_read.o: sys_defs.h +timed_read.o: msg.h timed_read.o: iostuff.h timed_wait.o: timed_wait.c timed_wait.o: sys_defs.h @@ -1154,6 +1165,7 @@ timed_wait.o: posix_signals.h timed_wait.o: timed_wait.h timed_write.o: timed_write.c timed_write.o: sys_defs.h +timed_write.o: msg.h timed_write.o: iostuff.h translit.o: translit.c translit.o: sys_defs.h @@ -1174,6 +1186,7 @@ unix_connect.o: unix_connect.c unix_connect.o: sys_defs.h unix_connect.o: msg.h unix_connect.o: iostuff.h +unix_connect.o: sane_connect.h unix_connect.o: connect.h unix_connect.o: timed_connect.h unix_listen.o: unix_listen.c diff --git a/gnu/dist/postfix/src/util/inet_connect.c b/gnu/dist/postfix/src/util/inet_connect.c index 152e498461e..3c76734cdda 100644 --- a/gnu/dist/postfix/src/util/inet_connect.c +++ b/gnu/dist/postfix/src/util/inet_connect.c @@ -63,6 +63,7 @@ #include "find_inet.h" #include "inet_util.h" #include "iostuff.h" +#include "sane_connect.h" #include "connect.h" #include "timed_connect.h" @@ -114,7 +115,7 @@ int inet_connect(const char *addr, int block_mode, int timeout) */ else { non_blocking(sock, block_mode); - if (connect(sock, (struct sockaddr *) & sin, sizeof(sin)) < 0 + if (sane_connect(sock, (struct sockaddr *) & sin, sizeof(sin)) < 0 && errno != EINPROGRESS) { close(sock); return (-1); diff --git a/gnu/dist/postfix/src/util/inet_listen.c b/gnu/dist/postfix/src/util/inet_listen.c index 91347c95ab4..2a846b39b8d 100644 --- a/gnu/dist/postfix/src/util/inet_listen.c +++ b/gnu/dist/postfix/src/util/inet_listen.c @@ -116,5 +116,8 @@ int inet_listen(const char *addr, int backlog, int block_mode) int inet_accept(int fd) { - return (sane_accept(fd, (struct sockaddr *) 0, (SOCKADDR_SIZE *) 0)); + struct sockaddr_in sin; + SOCKADDR_SIZE len = sizeof(sin); + + return (sane_accept(fd, (struct sockaddr *) & sin, &len)); } diff --git a/gnu/dist/postfix/src/util/match_ops.c b/gnu/dist/postfix/src/util/match_ops.c index 1bde84abdfa..ea615d7c557 100644 --- a/gnu/dist/postfix/src/util/match_ops.c +++ b/gnu/dist/postfix/src/util/match_ops.c @@ -69,7 +69,7 @@ #endif #ifndef INADDR_NONE -#define INADDR_NONE 0xffffff +#define INADDR_NONE 0xffffffff #endif /* Utility library. */ @@ -139,7 +139,7 @@ int match_hostname(int flags, const char *name, const char *pattern) if (strchr(pattern, ':') != 0) { temp = lowercase(mystrdup(name)); match = 0; - for (entry = temp; /* void */ ; entry = next) { + for (entry = temp; *entry != 0; entry = next) { if ((match = (dict_lookup(pattern, entry) != 0)) != 0) break; if (dict_errno != 0) @@ -207,6 +207,7 @@ int match_hostaddr(int unused_flags, const char *addr, const char *pattern) unsigned long mask_bits; unsigned long net_bits; unsigned long addr_bits; + struct in_addr net_addr; if (msg_verbose) msg_info("%s: %s ~? %s", myname, addr, pattern); @@ -242,7 +243,14 @@ int match_hostaddr(int unused_flags, const char *addr, const char *pattern) if (addr_bits == INADDR_NONE) msg_fatal("%s: bad address argument: %s", myname, addr); mask_bits = htonl((0xffffffff) << (BITS_PER_ADDR - mask_shift)); - return ((addr_bits & mask_bits) == (net_bits & mask_bits)); + if ((addr_bits & mask_bits) == net_bits) + return (1); + if (net_bits & ~mask_bits) { + net_addr.s_addr = (net_bits & mask_bits); + msg_fatal("net/mask pattern %s has a non-null host portion; " + "specify %s/%d if this is really what you want", + pattern, inet_ntoa(net_addr), mask_shift); + } } return (0); } diff --git a/gnu/dist/postfix/src/util/sys_defs.h b/gnu/dist/postfix/src/util/sys_defs.h index d1735d9f8fa..1e3b4ee4250 100644 --- a/gnu/dist/postfix/src/util/sys_defs.h +++ b/gnu/dist/postfix/src/util/sys_defs.h @@ -98,7 +98,9 @@ #define NORETURN void #define PRINTFLIKE(x,y) #define SCANFLIKE(x,y) +#ifndef NO_NETINFO #define HAS_NETINFO +#endif #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail" #define NATIVE_MAILQ_PATH "/usr/bin/mailq" #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases" @@ -185,6 +187,7 @@ extern int opterr; /* XXX use <getopt.h> */ #define USE_STATFS #define STATFS_IN_SYS_MOUNT_H #define HAS_POSIX_REGEXP +#define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE #endif /* @@ -260,6 +263,7 @@ extern int opterr; #define LOCAL_CONNECT stream_connect #define LOCAL_TRIGGER stream_trigger #define HAS_VOLATILE_LOCKS +#define BROKEN_READ_SELECT_ON_TCP_SOCKET /* * Allow build environment to override paths. */ @@ -463,6 +467,7 @@ extern int initgroups(const char *, int); #define DBM_NO_TRAILING_NULL /* XXX check */ #define USE_STATVFS #define STATVFS_IN_SYS_STATVFS_H +#define BROKEN_WRITE_SELECT_ON_NON_BLOCKING_PIPE #endif #if defined(IRIX5) |
