diff --git a/postfix/0README b/postfix/0README index 8538cebe2..0b13f9ca3 100644 --- a/postfix/0README +++ b/postfix/0README @@ -103,6 +103,7 @@ wietse@porcupine.org to avoid duplication of effort. Documentation: + README_FILES/ Instructions for specific Postfix features html/ HTML format man/ UNIX on-line manual page format @@ -127,6 +128,7 @@ Command-line utilities: src/postlock/ Postfix locking for shell scripts src/postlog/ Postfix logging for shell scripts src/postmap/ Postfix lookup table management + src/postqueue/ Postfix queue control program src/postsuper/ Postfix house keeping program src/sendmail/ Sendmail compatibility interface @@ -151,7 +153,7 @@ Postfix daemons: Test programs: src/fsstone/ Measure file system overhead - src/smtpstone/ SMTP server torture test + src/smtpstone/ SMTP and QMQP server torture test Miscellaneous: diff --git a/postfix/HISTORY b/postfix/HISTORY index f93a2518e..f28d7a204 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -5902,6 +5902,16 @@ Apologies for any names omitted. Security: additional run-time checks to discourage sharing of Postfix user/group ID values with other accounts. +20020104 + + Cleanup: SMTPD access maps now return DUNNO (undetermined) + instead of OK when a recipient address contains multiple + domains (user@dom1@dom2, etcetera). Victor Duchovny, Morgan + Stanley. File: smtpd/smtpd_check.c. + + Bugfix: SMTPD access maps did not handle address extensions. + File: smtpd/smtpd_check.c. + Open problems: Low: don't do user@domain and @domain lookups in @@ -5917,9 +5927,6 @@ Open problems: Medium: make address rewriting on/off configurable for envelopes and/or headers. - Medium: smtpd access maps don't understand the recipient - delimiter setting. - Low: generic showq protocol, to allow for more intelligent processing than just mailq. Maybe marry this with postsuper. diff --git a/postfix/Makefile.in b/postfix/Makefile.in index 04d4bdac7..f8470b37a 100644 --- a/postfix/Makefile.in +++ b/postfix/Makefile.in @@ -6,8 +6,8 @@ DIRS = src/util src/global src/dns src/master src/postfix src/smtpstone \ src/lmtp src/trivial-rewrite src/qmgr src/smtp src/bounce src/pipe \ src/showq src/postalias src/postcat src/postconf src/postdrop \ src/postkick src/postlock src/postlog src/postmap src/postqueue \ - src/postsuper src/nqmgr src/qmqpd src/spawn src/flush src/virtual \ - # proto man html + src/postsuper src/nqmgr src/qmqpd src/spawn src/flush src/virtual +MANDIRS = proto man html default: update @@ -23,6 +23,11 @@ update printfck: (set -e; echo "[$$i]"; cd $$i; $(MAKE) $(OPTS) $@ MAKELEVEL=) || exit 1; \ done +manpages: + set -e; for i in $(MANDIRS); do \ + (set -e; echo "[$$i]"; cd $$i; $(MAKE) -f Makefile.in $(OPTS) MAKELEVEL=) || exit 1; \ + done + printfck: update install: update diff --git a/postfix/DB_README b/postfix/README_FILES/DB_README similarity index 100% rename from postfix/DB_README rename to postfix/README_FILES/DB_README diff --git a/postfix/DEBUG_README b/postfix/README_FILES/DEBUG_README similarity index 100% rename from postfix/DEBUG_README rename to postfix/README_FILES/DEBUG_README diff --git a/postfix/ETRN_README b/postfix/README_FILES/ETRN_README similarity index 100% rename from postfix/ETRN_README rename to postfix/README_FILES/ETRN_README diff --git a/postfix/FILTER_README b/postfix/README_FILES/FILTER_README similarity index 72% rename from postfix/FILTER_README rename to postfix/README_FILES/FILTER_README index 99bf9b050..eb1f0b7fe 100644 --- a/postfix/FILTER_README +++ b/postfix/README_FILES/FILTER_README @@ -2,60 +2,33 @@ This is a very first implementation of Postfix content filtering. A Postfix content filter receives unfiltered mail from Postfix and either bounces the mail or re-injects filtered mail back into Postfix. -It involves an incompatible change to queue file formats. Older -Postfix versions will reject mail that needs to be content filtered, -and will move the queue file to the "corrupt" mail queue subdirectory. - This document describes two approaches to content filtering. Simple content filtering example ================================ -The first example is simpler to set up, but is also more resource -intensive. With the shell script as shown you will lose a factor -of four in Postfix performance for transit mail that arrives and -leaves via SMTP. You will lose another factor in transit performance -for each additional temporary file that is created and deleted in -the process of content filtering. The performance impact is less -for mail that is submitted or delivered locally, because such -deliveries are not as fast as SMTP transit mail. +The first example is simple to set up. It uses a shell script that +receives unfiltered mail from the Postfix pipe delivery agent, and +that feeds filtered mail back into the Postfix sendmail command. +Only mail arriving via SMTP will be content filtered. -The example assumes that only mail arriving via SMTP needs to be -content filtered. - - .................................. - : Postfix : - ----->smtpd \ /local----> - : -cleanup->queue- : - ---->pickup / \smtp-----> - ^ : | : - | : \pipe-----+ - | .................................. | - | | - | | - +------sendmail<-------filter<---------+ - -1 - Create a dedicated local user account called "filter". The - user will never log in, and can be given a "*" password and - non-existent shell and home directory. This user handles all - potentially dangerous mail content - that is why it should be - a separate account. - -2 - Create a directory /var/spool/filter that is accessible only - to the "filter" user. This is where the content filtering will - store its temporary files. - -3 - Define a content filtering entry in the Postfix master file: - - /etc/postfix/master.cf: - filter unix - n n - - pipe - flags=Rq user=filter argv=/somewhere/filter -f ${sender} -- ${recipient} + .................................. + : Postfix : +Unfiltered mail----->smtpd \ /local---->Filtered mail + : -cleanup->queue- : + ---->pickup / \smtp----->Filtered mail + ^ : | : + | : \pipe-----+ + | .................................. | + | | + | | + +-Postfix sendmail<----filter script<--+ The /some/where/filter program can be a simple shell script like this: #!/bin/sh - # Localize these + # Localize these. INSPECT_DIR=/var/spool/filter SENDMAIL="/usr/sbin/sendmail -i" @@ -88,21 +61,53 @@ exit status of the filter command is whatever exit status Postfix sendmail produces. I suggest that you play with this script for a while until you are -satisfied with the results. Run it as the filter user, with a real -message (headers+body) as input: +satisfied with the results. Run it with a real message (headers+body) +as input: % /some/where/filter -f sender recipient... instead. Incompatible changes with snapshot-20011210 =========================================== -Postfix SMTPD access maps no longer match non-local mail addresses -that contain multiple domains (user@dom1@dom2, user%dom1@dom2, -etcetera). This change prevents false or spurious matches. -Non-local multi-domain addresses are already prohibited from matching -permit_mx_backup and the relay_domains-based restrictions. - Stricter checking of Postfix chroot configurations. The Postfix startup procedure now warns if "system" directories (etc, bin, lib, usr) under the Postfix top-level queue directory are not owned by diff --git a/postfix/conf/access b/postfix/conf/access index 56a4bedcb..21a30fa37 100644 --- a/postfix/conf/access +++ b/postfix/conf/access @@ -9,9 +9,9 @@ # # DESCRIPTION # The optional access table directs the Postfix SMTP server -# to selectively reject or accept mail from or to specific -# hosts, domains, networks, host addresses or mail -# addresses. +# to selectively reject or accept mail. Access can be +# allowed or denied for specific host names, domain names, +# networks, host network addresses or mail addresses. # # Normally, the access table is specified as a text file # that serves as input to the postmap(1) command. The @@ -36,50 +36,78 @@ # When pattern matches a mail address, domain or host # address, perform the corresponding action. # +# blank lines and comments +# Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. +# # multi-line text -# A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # -# comments -# The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. -# -# PATTERNS +# EMAIL ADDRESS PATTERNS # With lookups from indexed files such as DB or DBM, or from -# networked tables such as NIS, LDAP or SQL, patterns are -# tried in the order as listed below: +# networked tables such as NIS, LDAP or SQL, the following +# lookup patterns are examined in the order as listed: # # user@domain # Matches the specified mail address. # # domain.name -# Matches the domain.name itself and any subdomain -# thereof, either in hostnames or in mail addresses. -# Top-level domains will never be matched. +# Matches domain.name as the domain part of an email +# address. # -# user@ Matches all mail addresses with the specified user +# The pattern domain.name also matches subdomains, +# but only when the string smtpd_access_maps is +# listed in the Postfix parent_domain_matches_subdo- +# mains configuration setting. Otherwise, specify +# .domain.name (note the initial dot) in order to +# match subdomains. +# +# user@ Matches all mail addresses with the specified user # part. # +# Note: lookup of the null sender address may not be possi- +# ble with all supported types of lookup table. A workaround +# is to specify smtpd_null_access_lookup_key = <> in the +# Postfix main.cf file, and to specify <> as the left-hand +# field in the access table. +# +# ADDRESS EXTENSION +# When a mail address localpart contains the optional recip- +# ient delimiter (e.g., user+foo@domain), the lookup order +# becomes: user+foo@domain, user@domain, domain, user+foo@, +# and user@. +# +# HOST NAME/ADDRESS PATTERNS +# With lookups from indexed files such as DB or DBM, or from +# networked tables such as NIS, LDAP or SQL, the following +# lookup patterns are examined in the order as listed: +# +# domain.name +# Matches domain.name. +# +# The pattern domain.name also matches subdomains, +# but only when the string smtpd_access_maps is +# listed in the Postfix parent_domain_matches_subdo- +# mains configuration setting. Otherwise, specify +# .domain.name (note the initial dot) in order to +# match subdomains. +# # net.work.addr.ess # # net.work.addr # # net.work # -# net Matches any host address in the specified network. -# A network address is a sequence of one or more +# net Matches any host address in the specified network. +# A network address is a sequence of one or more # octets separated by ".". # # ACTIONS # [45]NN text -# Reject the address etc. that matches the pattern, +# Reject the address etc. that matches the pattern, # and respond with the numerical code and text. # # REJECT Reject the address etc. that matches the pattern. A @@ -92,29 +120,30 @@ # reject_unauth_destination, and so on). # # REGULAR EXPRESSION TABLES -# This section describes how the table lookups change when +# This section describes how the table lookups change when # the table is given in the form of regular expressions. For -# a description of regular expression lookup table syntax, +# a description of regular expression lookup table syntax, # see regexp_table(5) or pcre_table(5). # -# Each pattern is a regular expression that is applied to +# Each pattern is a regular expression that is applied to # the entire string being looked up. Depending on the appli- -# cation, that string is an entire client hostname, an +# cation, that string is an entire client hostname, an # entire client IP address, or an entire mail address. Thus, -# no parent domain or parent network search is done, and -# user@domain mail addresses are not broken up into their -# user@ and domain constituent parts. +# no parent domain or parent network search is done, +# user@domain mail addresses are not broken up into their +# user@ and domain constituent parts, nor is user+foo broken +# up into user and foo. # # Patterns are applied in the order as specified in the # table, until a pattern is found that matches the search # string. # -# Actions are the same as with normal indexed file lookups, -# with the additional feature that parenthesized substrings -# from the pattern can be interpolated as $1, $2 and so on. +# Actions are the same as with indexed file lookups, with +# the additional feature that parenthesized substrings from +# the pattern can be interpolated as $1, $2 and so on. # # BUGS -# The table format does not understand quoting conventions. +# The table format does not understand quoting conventions. # # SEE ALSO # postmap(1) create mapping table @@ -123,7 +152,7 @@ # regexp_table(5) format of POSIX regular expression tables # # 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/conf/aliases b/postfix/conf/aliases index 59bcc60dd..854d83544 100644 --- a/postfix/conf/aliases +++ b/postfix/conf/aliases @@ -68,59 +68,54 @@ decode: root # # name: value1, value2, ... # -# o A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# o Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. # -# o The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. +# o A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # -# The name is a local address (no domain part). Use double -# quotes when the name contains any special characters such -# as whitespace, `#', `:', or `@'. The name is folded to +# The name is a local address (no domain part). Use double +# quotes when the name contains any special characters such +# as whitespace, `#', `:', or `@'. The name is folded to # lowercase, in order to make database lookups case insensi- # tive. # # In addition, when an alias exists for owner-name, delivery -# diagnostics are directed to that address, instead of to +# 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 +# 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 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. # @@ -132,31 +127,31 @@ 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). # # CONFIGURATION PARAMETERS -# The following main.cf parameters are especially relevant -# to this topic. See the Postfix main.cf file for syntax -# details and for default values. Use the postfix reload +# The following main.cf parameters are especially relevant +# to this topic. See the Postfix main.cf file for syntax +# details and for default values. Use the postfix reload # command after a configuration change. # # alias_maps # List of alias databases. # # 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. # # owner_request_special @@ -164,7 +159,7 @@ decode: root # addresses. # # recipient_delimiter -# Delimiter that separates recipients from address +# Delimiter that separates recipients from address # extensions. # # STANDARDS @@ -175,7 +170,7 @@ decode: root # postalias(1) alias database management # # 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/conf/canonical b/postfix/conf/canonical index 1646465ff..b7528ae7a 100644 --- a/postfix/conf/canonical +++ b/postfix/conf/canonical @@ -51,77 +51,70 @@ # When pattern matches a mail address, replace it by # the corresponding result. # -# multi-line text -# A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# blank lines and comments +# Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. # -# comments -# The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. +# multi-line text +# A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # # With lookups from indexed files such as DB or DBM, or from -# networked tables such as NIS, LDAP or SQL, patterns are +# networked tables such as NIS, LDAP or SQL, patterns are # tried in the order as listed below: # # user@domain address -# user@domain is replaced by address. This form has +# user@domain is replaced by address. This form has # the highest precedence. # -# This form useful to clean up addresses produced by -# legacy mail systems. It can also be used to pro- -# duce Firstname.Lastname style addresses, but see +# This form useful to clean up addresses produced by +# legacy mail systems. It can also be used to pro- +# duce Firstname.Lastname style addresses, but see # below for a simpler solution. # # user address # user@site is replaced by address when site is equal -# to $myorigin, when site is listed in $mydestina- +# to $myorigin, when site is listed in $mydestina- # tion, or when it is listed in $inet_interfaces. # -# This form is useful for replacing login names by +# This form is useful for replacing login names by # Firstname.Lastname. # # @domain address -# Every address in domain is replaced by address. +# Every address in domain is replaced by address. # This form has the lowest precedence. # -# In all the above forms, when address has the form @other- +# In all the above forms, when address has the form @other- # domain, the result is the same user in otherdomain. # # ADDRESS EXTENSION -# When table lookup fails, and the address localpart con- -# tains the optional recipient delimiter (e.g., -# user+foo@domain), the search is repeated for the unex- -# tended address (e.g. user@domain), and the unmatched -# extension is propagated to the result of table lookup. The -# matching order is: user+foo@domain, user@domain, user+foo, -# user, and @domain. +# When a mail address localpart contains the optional recip- +# ient delimiter (e.g., user+foo@domain), the lookup order +# becomes: user+foo@domain, user@domain, user+foo, user, and +# @domain. An unmatched address extension (+foo) is propa- +# gated to the result of table lookup. # # REGULAR EXPRESSION TABLES -# This section describes how the table lookups change when +# This section describes how the table lookups change when # the table is given in the form of regular expressions. For -# a description of regular expression lookup table syntax, +# a description of regular expression lookup table syntax, # see regexp_table(5) or pcre_table(5). # -# Each pattern is a regular expression that is applied to +# Each pattern is a regular expression that is applied to # the entire address being looked up. Thus, user@domain mail -# addresses are not broken up into their user and @domain +# addresses are not broken up into their user and @domain # constituent parts, nor is user+foo broken up into user and # foo. # -# Patterns are applied in the order as specified in the -# table, until a pattern is found that matches the search +# Patterns are applied in the order as specified in the +# table, until a pattern is found that matches the search # string. # -# Results are the same as with normal indexed file lookups, -# with the additional feature that parenthesized substrings -# from the pattern can be interpolated as $1, $2 and so on. +# Results are the same as with indexed file lookups, with +# the additional feature that parenthesized substrings from +# the pattern can be interpolated as $1, $2 and so on. # # BUGS # The table format does not understand quoting conventions. diff --git a/postfix/conf/pcre_table b/postfix/conf/pcre_table index 983de3398..ebedffe48 100644 --- a/postfix/conf/pcre_table +++ b/postfix/conf/pcre_table @@ -22,49 +22,44 @@ # When pattern matches a search string, use the cor- # responding result. # -# multi-line text -# A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# blank lines and comments +# Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. # -# comments -# The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. +# multi-line text +# A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # # Each pattern is a perl-like regular expression. The -# expression delimiter can be any character, except whites- -# pace or characters that have special meaning (tradition- -# ally the forward slash is used). The regular expression +# expression delimiter can be any character, except whites- +# pace or characters that have special meaning (tradition- +# ally the forward slash is used). The regular expression # can contain whitespace. # # By default, matching is case-insensitive, although follow- -# ing the second slash with an `i' flag will reverse this. -# Other flags are supported, but the only other useful one +# ing the second slash with an `i' flag will reverse this. +# Other flags are supported, but the only other useful one # is `U', which makes matching ungreedy (see PCRE documenta- # tion and source for more info). # -# Each pattern is applied to the entire lookup key string. -# Depending on the application, that string is an entire +# Each pattern is applied to the entire lookup key string. +# Depending on the application, that string is an entire # client hostname, an entire client IP address, or an entire -# mail address. Thus, no parent domain or parent network -# search is done, and user@domain mail addresses are not -# broken up into their user and domain constituent parts, +# mail address. Thus, no parent domain or parent network +# search is done, and user@domain mail addresses are not +# broken up into their user and domain constituent parts, # nor is user+foo broken up into user and foo. # -# Patterns are applied in the order as specified in the -# table, until a pattern is found that matches the search +# Patterns are applied in the order as specified in the +# table, until a pattern is found that matches the search # string. # -# Substitution of substrings from the matched expression -# into the result string is possible using the conventional -# perl syntax ($1, $2, etc.). The macros in the result -# string may need to be written as ${n} or $(n) if they +# Substitution of substrings from the matched expression +# into the result string is possible using the conventional +# perl syntax ($1, $2, etc.). The macros in the result +# string may need to be written as ${n} or $(n) if they # aren't followed by whitespace. # # EXAMPLE SMTPD ACCESS MAP diff --git a/postfix/conf/regexp_table b/postfix/conf/regexp_table index df06800bf..40acc1a0b 100644 --- a/postfix/conf/regexp_table +++ b/postfix/conf/regexp_table @@ -22,20 +22,15 @@ # When pattern matches a search string, use the cor- # responding result. # -# multi-line text -# A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# blank lines and comments +# Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. # -# comments -# The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. +# multi-line text +# A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # # pattern1!pattern2 result # Matches pattern1 but not pattern2. @@ -43,28 +38,28 @@ # Each pattern is a regular expression enclosed by a pair of # delimiters. The regular expression syntax is described in # re_format(7). The expression delimiter can be any charac- -# ter, except whitespace or characters that have special -# meaning (traditionally the forward slash is used). The +# ter, except whitespace or characters that have special +# meaning (traditionally the forward slash is used). The # regular expression can contain whitespace. # # By default, matching is case-insensitive, although follow- -# ing the second slash with an `i' flag will reverse this. -# Other flags are `x' (disable extended expression syntax), +# ing the second slash with an `i' flag will reverse this. +# Other flags are `x' (disable extended expression syntax), # and `m' (enable multi-line mode). # -# Each pattern is applied to the entire lookup key string. -# Depending on the application, that string is an entire +# Each pattern is applied to the entire lookup key string. +# Depending on the application, that string is an entire # client hostname, an entire client IP address, or an entire -# mail address. Thus, no parent domain or parent network -# search is done, and user@domain mail addresses are not -# broken up into their user and domain constituent parts, +# mail address. Thus, no parent domain or parent network +# search is done, and user@domain mail addresses are not +# broken up into their user and domain constituent parts, # nor is user+foo broken up into user and foo. # -# Patterns are applied in the order as specified in the -# table, until a pattern is found that matches the search +# Patterns are applied in the order as specified in the +# table, until a pattern is found that matches the search # string. # -# Substitution of substrings from the matched expression +# Substitution of substrings from the matched expression # into the result string is possible using $1, $2, etc.. The # macros in the result string may need to be written as ${n} # or $(n) if they aren't followed by whitespace. diff --git a/postfix/conf/relocated b/postfix/conf/relocated index 738480424..28ec6afa1 100644 --- a/postfix/conf/relocated +++ b/postfix/conf/relocated @@ -39,25 +39,20 @@ # such as an email address, or perhaps a street # address or telephone number. # -# o A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# o Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. # -# o The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. +# o A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # # With lookups from indexed files such as DB or DBM, or from -# networked tables such as NIS, LDAP or SQL, the key field +# networked tables such as NIS, LDAP or SQL, the key field # is one of the following: # # user@domain -# Matches user@domain. This form has precedence over +# Matches user@domain. This form has precedence over # all other forms. # # user Matches user@site when site is $myorigin, when site @@ -65,34 +60,34 @@ # in $inet_interfaces. # # @domain -# Matches every address in domain. This form has the +# Matches every address in domain. This form has the # lowest precedence. # # ADDRESS EXTENSION -# When the search fails, and the address localpart contains -# the optional recipient delimiter (e.g., user+foo@domain), -# the search is repeated for the unextended address (e.g. -# user@domain). +# When a mail address localpart contains the optional recip- +# ient delimiter (e.g., user+foo@domain), the lookup order +# becomes: user+foo@domain, user@domain, user+foo, user, and +# @domain. # # REGULAR EXPRESSION TABLES -# This section describes how the table lookups change when +# This section describes how the table lookups change when # the table is given in the form of regular expressions. For -# a description of regular expression lookup table syntax, +# a description of regular expression lookup table syntax, # see regexp_table(5) or pcre_table(5). # -# Each pattern is a regular expression that is applied to +# Each pattern is a regular expression that is applied to # the entire address being looked up. Thus, user@domain mail -# addresses are not broken up into their user and @domain +# addresses are not broken up into their user and @domain # constituent parts, nor is user+foo broken up into user and # foo. # -# Patterns are applied in the order as specified in the -# table, until a pattern is found that matches the search +# Patterns are applied in the order as specified in the +# table, until a pattern is found that matches the search # string. # -# Results are the same as with normal indexed file lookups, -# with the additional feature that parenthesized substrings -# from the pattern can be interpolated as $1, $2 and so on. +# Results are the same as with indexed file lookups, with +# the additional feature that parenthesized substrings from +# the pattern can be interpolated as $1, $2 and so on. # # BUGS # The table format does not understand quoting conventions. diff --git a/postfix/conf/transport b/postfix/conf/transport index 4c40ade17..4a21ac694 100644 --- a/postfix/conf/transport +++ b/postfix/conf/transport @@ -36,112 +36,111 @@ # When pattern matches the domain, use the corre- # sponding result. # -# multi-line text -# A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# blank lines and comments +# Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. # -# comments -# The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. +# multi-line text +# A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # # With lookups from indexed files such as DB or DBM, or from -# networked tables such as NIS, LDAP or SQL, patterns are +# networked tables such as NIS, LDAP or SQL, patterns are # tried in the order as listed below: # # domain transport:nexthop -# Mail for domain is delivered through transport to +# Mail for domain is delivered through transport to # nexthop. # # .domain transport:nexthop -# Mail for any subdomain of domain is delivered -# through transport to nexthop. +# Mail for any subdomain of domain is delivered +# through transport to nexthop. This applies only +# when the string transport_maps is not listed in the +# parent_domain_matches_subdomains configuration set- +# ting. Otherwise, a domain name matches itself and +# its subdomains. # -# Note: transport map entries take precedence over domains -# specified in the mydestination parameter. If you use the +# Note: transport map entries take precedence over domains +# specified in the mydestination parameter. If you use the # optional transport map, it may be safer to specify -# explicit entries for all domains specified in mydestina- +# explicit entries for all domains specified in mydestina- # tion, for example: # # hostname.my.domain local: # localhost.my.domain local: # -# The interpretation of the nexthop field is transport +# The interpretation of the nexthop field is transport # dependent. In the case of SMTP, specify host:service for a -# non-default server port, and use [host] or [host]:port in -# order to disable MX (mail exchanger) DNS lookups. The [] -# form can also be used with IP addresses instead of host- +# non-default server port, and use [host] or [host]:port in +# order to disable MX (mail exchanger) DNS lookups. The [] +# form can also be used with IP addresses instead of host- # names. # # EXAMPLES -# In order to send mail for foo.org and its subdomains via +# In order to send mail for foo.org and its subdomains via # the uucp transport to the UUCP host named foo: # # foo.org uucp:foo # .foo.org uucp:foo # -# When no nexthop host name is specified, the destination -# domain name is used instead. For example, the following -# directs mail for user@foo.org via the slow transport to a -# mail exchanger for foo.org. The slow transport could be -# something that runs at most one delivery process at a +# When no nexthop host name is specified, the destination +# domain name is used instead. For example, the following +# directs mail for user@foo.org via the slow transport to a +# mail exchanger for foo.org. The slow transport could be +# something that runs at most one delivery process at a # time: # # foo.org slow: # -# When no transport is specified, the default transport is +# When no transport is specified, the default transport is # used, as specified via the default_transport configuration -# parameter. The following sends all mail for foo.org and +# parameter. The following sends all mail for foo.org and # its subdomains to host gateway.foo.org: # # foo.org :[gateway.foo.org] # .foo.org :[gateway.foo.org] # -# In the above example, the [] are used to suppress MX -# lookups. The result would likely point to your local +# In the above example, the [] are used to suppress MX +# lookups. The result would likely point to your local # machine. # -# In the case of delivery via SMTP, one may specify host- +# In the case of delivery via SMTP, one may specify host- # name:service instead of just a host: # # foo.org smtp:bar.org:2025 # -# This directs mail for user@foo.org to host bar.org port -# 2025. Instead of a numerical port a symbolic name may be -# used. Specify [] around the hostname in order to disable +# This directs mail for user@foo.org to host bar.org port +# 2025. Instead of a numerical port a symbolic name may be +# used. Specify [] around the hostname in order to disable # MX lookups. # # The error mailer can be used to bounce mail: # -# .foo.org error:mail for *.foo.org is not deliv- +# .foo.org error:mail for *.foo.org is not deliv- # erable # -# This causes all mail for user@anything.foo.org to be +# This causes all mail for user@anything.foo.org to be # bounced. # # REGULAR EXPRESSION TABLES -# This section describes how the table lookups change when +# This section describes how the table lookups change when # the table is given in the form of regular expressions. For -# a description of regular expression lookup table syntax, +# a description of regular expression lookup table syntax, # see regexp_table(5) or pcre_table(5). # -# Each pattern is a regular expression that is applied to +# Each pattern is a regular expression that is applied to # the entire domain being looked up. Thus, some.domain.hier- # archy is not broken up into parent domains. # -# Patterns are applied in the order as specified in the -# table, until a pattern is found that matches the search +# Patterns are applied in the order as specified in the +# table, until a pattern is found that matches the search # string. # -# Results are the same as with normal indexed file lookups, -# with the additional feature that parenthesized substrings -# from the pattern can be interpolated as $1, $2 and so on. +# Results are the same as with indexed file lookups, with +# the additional feature that parenthesized substrings from +# the pattern can be interpolated as $1, $2 and so on. # # CONFIGURATION PARAMETERS # The following main.cf parameters are especially relevant diff --git a/postfix/conf/virtual b/postfix/conf/virtual index d2ba3db90..1a093feb3 100644 --- a/postfix/conf/virtual +++ b/postfix/conf/virtual @@ -107,75 +107,69 @@ # When pattern matches a mail address, replace it by # the corresponding result. # -# multi-line text -# A line that starts with whitespace (space or tab) -# is a continuation of the previous line. An empty -# line terminates the previous line, as does a line -# that starts with non-whitespace (text or comment). -# A comment line that starts with whitespace does not -# terminate multi-line text. +# blank lines and comments +# Empty lines and whitespace-only lines are ignored, +# as are lines whose first non-whitespace character +# is a `#'. # -# comments -# The # is recognized as the start of a comment, but -# only when it is the first non-whitespace character -# on a line. A comment terminates at the end of the -# line, even when the next line starts with whites- -# pace. +# multi-line text +# A logical line starts with non-whitespace text. A +# line that starts with whitespace continues a logi- +# cal line. # # With lookups from indexed files such as DB or DBM, or from -# networked tables such as NIS, LDAP or SQL, patterns are +# networked tables such as NIS, LDAP or SQL, patterns are # tried in the order as listed below: # # user@domain address, address, ... -# Mail for user@domain is redirected to address. +# Mail for user@domain is redirected to address. # This form has the highest precedence. # # user address, address, ... -# Mail for user@site is redirected to address when -# site is equal to $myorigin, when site is listed in +# Mail for user@site is redirected to address when +# site is equal to $myorigin, when site is listed in # $mydestination, or when it is listed in # $inet_interfaces. # -# This functionality overlaps with functionality of +# This functionality overlaps with functionality of # the local alias(5) database. The difference is that -# virtual mapping can be applied to non-local +# virtual mapping can be applied to non-local # addresses. # # @domain address, address, ... -# Mail for any user in domain is redirected to +# Mail for any user in domain is redirected to # address. This form has the lowest precedence. # -# In all the above forms, when address has the form @other- -# domain, the result is the same user in otherdomain. This +# In all the above forms, when address has the form @other- +# domain, the result is the same user in otherdomain. This # works for the first address in the expansion only. # # ADDRESS EXTENSION -# When the search fails, and the address localpart contains -# the optional recipient delimiter (e.g., user+foo@domain), -# the search is repeated for the unextended address (e.g. -# user@domain), and the unmatched address extension is prop- -# agated to the result of expansion. The matching order is: -# user+foo@domain, user@domain, user+foo, user, and @domain. +# When a mail address localpart contains the optional recip- +# ient delimiter (e.g., user+foo@domain), the lookup order +# becomes: user+foo@domain, user@domain, user+foo, user, and +# @domain. An unmatched address extension (+foo) is propa- +# gated to the result of table lookup. # # REGULAR EXPRESSION TABLES -# This section describes how the table lookups change when +# This section describes how the table lookups change when # the table is given in the form of regular expressions. For -# a description of regular expression lookup table syntax, +# a description of regular expression lookup table syntax, # see regexp_table(5) or pcre_table(5). # -# Each pattern is a regular expression that is applied to +# Each pattern is a regular expression that is applied to # the entire address being looked up. Thus, user@domain mail -# addresses are not broken up into their user and @domain +# addresses are not broken up into their user and @domain # constituent parts, nor is user+foo broken up into user and # foo. # -# Patterns are applied in the order as specified in the -# table, until a pattern is found that matches the search +# Patterns are applied in the order as specified in the +# table, until a pattern is found that matches the search # string. # -# Results are the same as with normal indexed file lookups, -# with the additional feature that parenthesized substrings -# from the pattern can be interpolated as $1, $2 and so on. +# Results are the same as with indexed file lookups, with +# the additional feature that parenthesized substrings from +# the pattern can be interpolated as $1, $2 and so on. # # BUGS # The table format does not understand quoting conventions. diff --git a/postfix/html/access.5.html b/postfix/html/access.5.html index beaba3ce9..ce041680b 100644 --- a/postfix/html/access.5.html +++ b/postfix/html/access.5.html @@ -10,9 +10,9 @@ ACCESS(5) ACCESS(5) DESCRIPTION The optional access table directs the Postfix SMTP server - to selectively reject or accept mail from or to specific - hosts, domains, networks, host addresses or mail - addresses. + to selectively reject or accept mail. Access can be + allowed or denied for specific host names, domain names, + networks, host network addresses or mail addresses. Normally, the access table is specified as a text file that serves as input to the postmap(1) command. The @@ -47,22 +47,55 @@ ACCESS(5) ACCESS(5) line that starts with whitespace continues a logi- cal line. -PATTERNS +EMAIL ADDRESS PATTERNS With lookups from indexed files such as DB or DBM, or from - networked tables such as NIS, LDAP or SQL, patterns are - tried in the order as listed below: + networked tables such as NIS, LDAP or SQL, the following + lookup patterns are examined in the order as listed: user@domain Matches the specified mail address. domain.name - Matches the domain.name itself and any subdomain - thereof, either in hostnames or in mail addresses. - Top-level domains will never be matched. + Matches domain.name as the domain part of an email + address. + + The pattern domain.name also matches subdomains, + but only when the string smtpd_access_maps is + listed in the Postfix parent_domain_matches_subdo- + mains configuration setting. Otherwise, specify + .domain.name (note the initial dot) in order to + match subdomains. user@ Matches all mail addresses with the specified user part. + Note: lookup of the null sender address may not be possi- + ble with all supported types of lookup table. A workaround + is to specify smtpd_null_access_lookup_key = <> in the + Postfix main.cf file, and to specify <> as the left-hand + field in the access table. + +ADDRESS EXTENSION + When a mail address localpart contains the optional recip- + ient delimiter (e.g., user+foo@domain), the lookup order + becomes: user+foo@domain, user@domain, domain, user+foo@, + and user@. + +HOST NAME/ADDRESS PATTERNS + With lookups from indexed files such as DB or DBM, or from + networked tables such as NIS, LDAP or SQL, the following + lookup patterns are examined in the order as listed: + + domain.name + Matches domain.name. + + The pattern domain.name also matches subdomains, + but only when the string smtpd_access_maps is + listed in the Postfix parent_domain_matches_subdo- + mains configuration setting. Otherwise, specify + .domain.name (note the initial dot) in order to + match subdomains. + net.work.addr.ess net.work.addr @@ -97,17 +130,18 @@ ACCESS(5) ACCESS(5) the entire string being looked up. Depending on the appli- cation, that string is an entire client hostname, an entire client IP address, or an entire mail address. Thus, - no parent domain or parent network search is done, and + no parent domain or parent network search is done, user@domain mail addresses are not broken up into their - user@ and domain constituent parts. + user@ and domain constituent parts, nor is user+foo broken + up into user and foo. - Patterns are applied in the order as specified in the - table, until a pattern is found that matches the search + Patterns are applied in the order as specified in the + table, until a pattern is found that matches the search string. - Actions are the same as with normal indexed file lookups, - with the additional feature that parenthesized substrings - from the pattern can be interpolated as $1, $2 and so on. + Actions are the same as with indexed file lookups, with + the additional feature that parenthesized substrings from + the pattern can be interpolated as $1, $2 and so on. BUGS The table format does not understand quoting conventions. diff --git a/postfix/html/canonical.5.html b/postfix/html/canonical.5.html index d473afd3e..2ec7403ca 100644 --- a/postfix/html/canonical.5.html +++ b/postfix/html/canonical.5.html @@ -91,13 +91,11 @@ CANONICAL(5) CANONICAL(5) domain, the result is the same user in otherdomain. ADDRESS EXTENSION - When table lookup fails, and the address localpart con- - tains the optional recipient delimiter (e.g., - user+foo@domain), the search is repeated for the unex- - tended address (e.g. user@domain), and the unmatched - extension is propagated to the result of table lookup. The - matching order is: user+foo@domain, user@domain, user+foo, - user, and @domain. + When a mail address localpart contains the optional recip- + ient delimiter (e.g., user+foo@domain), the lookup order + becomes: user+foo@domain, user@domain, user+foo, user, and + @domain. An unmatched address extension (+foo) is propa- + gated to the result of table lookup. REGULAR EXPRESSION TABLES This section describes how the table lookups change when @@ -115,17 +113,17 @@ CANONICAL(5) CANONICAL(5) table, until a pattern is found that matches the search string. - Results are the same as with normal indexed file lookups, - with the additional feature that parenthesized substrings - from the pattern can be interpolated as $1, $2 and so on. + Results are the same as with indexed file lookups, with + the additional feature that parenthesized substrings from + the pattern can be interpolated as $1, $2 and so on. BUGS - The table format does not understand quoting conventions. + The table format does not understand quoting conventions. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant - to this topic. See the Postfix main.cf file for syntax - details and for default values. Use the postfix reload + The following main.cf parameters are especially relevant + to this topic. See the Postfix main.cf file for syntax + details and for default values. Use the postfix reload command after a configuration change. canonical_maps @@ -142,24 +140,24 @@ CANONICAL(5) CANONICAL(5) Other parameters of interest: inet_interfaces - The network interface addresses that this system + The network interface addresses that this system receives mail on. masquerade_classes - List of address classes subject to masquerading: - zero or more of envelope_sender, envelope_recipi- + List of address classes subject to masquerading: + zero or more of envelope_sender, envelope_recipi- ent, header_sender, header_recipient. masquerade_domains - List of domains that hide their subdomain struc- + List of domains that hide their subdomain struc- ture. masquerade_exceptions - List of user names that are not subject to address + List of user names that are not subject to address masquerading. mydestination - List of domains that this mail system considers + List of domains that this mail system considers local. myorigin @@ -177,7 +175,7 @@ CANONICAL(5) CANONICAL(5) regexp_table(5) format of POSIX regular expression tables 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/relocated.5.html b/postfix/html/relocated.5.html index e2d970067..5ad6c76fc 100644 --- a/postfix/html/relocated.5.html +++ b/postfix/html/relocated.5.html @@ -65,10 +65,10 @@ RELOCATED(5) RELOCATED(5) lowest precedence. ADDRESS EXTENSION - When the search fails, and the address localpart contains - the optional recipient delimiter (e.g., user+foo@domain), - the search is repeated for the unextended address (e.g. - user@domain). + When a mail address localpart contains the optional recip- + ient delimiter (e.g., user+foo@domain), the lookup order + becomes: user+foo@domain, user@domain, user+foo, user, and + @domain. REGULAR EXPRESSION TABLES This section describes how the table lookups change when @@ -86,17 +86,17 @@ RELOCATED(5) RELOCATED(5) table, until a pattern is found that matches the search string. - Results are the same as with normal indexed file lookups, - with the additional feature that parenthesized substrings - from the pattern can be interpolated as $1, $2 and so on. + Results are the same as with indexed file lookups, with + the additional feature that parenthesized substrings from + the pattern can be interpolated as $1, $2 and so on. BUGS - The table format does not understand quoting conventions. + The table format does not understand quoting conventions. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant - to this topic. See the Postfix main.cf file for syntax - details and for default values. Use the postfix reload + The following main.cf parameters are especially relevant + to this topic. See the Postfix main.cf file for syntax + details and for default values. Use the postfix reload command after a configuration change. relocated_maps @@ -105,11 +105,11 @@ RELOCATED(5) RELOCATED(5) Other parameters of interest: inet_interfaces - The network interface addresses that this system + The network interface addresses that this system receives mail on. mydestination - List of domains that this mail system considers + List of domains that this mail system considers local. myorigin @@ -121,7 +121,7 @@ RELOCATED(5) RELOCATED(5) regexp_table(5) format of POSIX regular expression tables 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/transport.5.html b/postfix/html/transport.5.html index 4f8927497..48da226d5 100644 --- a/postfix/html/transport.5.html +++ b/postfix/html/transport.5.html @@ -57,7 +57,11 @@ TRANSPORT(5) TRANSPORT(5) .domain transport:nexthop Mail for any subdomain of domain is delivered - through transport to nexthop. + through transport to nexthop. This applies only + when the string transport_maps is not listed in the + parent_domain_matches_subdomains configuration set- + ting. Otherwise, a domain name matches itself and + its subdomains. Note: transport map entries take precedence over domains specified in the mydestination parameter. If you use the @@ -135,18 +139,18 @@ TRANSPORT(5) TRANSPORT(5) table, until a pattern is found that matches the search string. - Results are the same as with normal indexed file lookups, - with the additional feature that parenthesized substrings - from the pattern can be interpolated as $1, $2 and so on. + Results are the same as with indexed file lookups, with + the additional feature that parenthesized substrings from + the pattern can be interpolated as $1, $2 and so on. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant - to this topic. See the Postfix main.cf file for syntax - details and for default values. Use the postfix reload + The following main.cf parameters are especially relevant + to this topic. See the Postfix main.cf file for syntax + details and for default values. Use the postfix reload command after a configuration change. parent_domain_matches_subdomains (versions >= 20011119) - List of Postfix features that use domain.name pat- + List of Postfix features that use domain.name pat- terns to match sub.domain.name (as opposed to requiring .domain.name patterns). @@ -156,7 +160,7 @@ TRANSPORT(5) TRANSPORT(5) Other parameters of interest: default_transport - The transport to use when no transport is explic- + The transport to use when no transport is explic- itly specified. relayhost @@ -170,7 +174,7 @@ TRANSPORT(5) TRANSPORT(5) regexp_table(5) format of POSIX regular expression tables 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/virtual.5.html b/postfix/html/virtual.5.html index 660e196be..4e716c41e 100644 --- a/postfix/html/virtual.5.html +++ b/postfix/html/virtual.5.html @@ -146,12 +146,11 @@ VIRTUAL(5) VIRTUAL(5) works for the first address in the expansion only. ADDRESS EXTENSION - When the search fails, and the address localpart contains - the optional recipient delimiter (e.g., user+foo@domain), - the search is repeated for the unextended address (e.g. - user@domain), and the unmatched address extension is prop- - agated to the result of expansion. The matching order is: - user+foo@domain, user@domain, user+foo, user, and @domain. + When a mail address localpart contains the optional recip- + ient delimiter (e.g., user+foo@domain), the lookup order + becomes: user+foo@domain, user@domain, user+foo, user, and + @domain. An unmatched address extension (+foo) is propa- + gated to the result of table lookup. REGULAR EXPRESSION TABLES This section describes how the table lookups change when @@ -169,17 +168,17 @@ VIRTUAL(5) VIRTUAL(5) table, until a pattern is found that matches the search string. - Results are the same as with normal indexed file lookups, - with the additional feature that parenthesized substrings - from the pattern can be interpolated as $1, $2 and so on. + Results are the same as with indexed file lookups, with + the additional feature that parenthesized substrings from + the pattern can be interpolated as $1, $2 and so on. BUGS - The table format does not understand quoting conventions. + The table format does not understand quoting conventions. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant - to this topic. See the Postfix main.cf file for syntax - details and for default values. Use the postfix reload + The following main.cf parameters are especially relevant + to this topic. See the Postfix main.cf file for syntax + details and for default values. Use the postfix reload command after a configuration change. virtual_maps @@ -188,11 +187,11 @@ VIRTUAL(5) VIRTUAL(5) Other parameters of interest: inet_interfaces - The network interface addresses that this system + The network interface addresses that this system receives mail on. mydestination - List of domains that this mail system considers + List of domains that this mail system considers local. myorigin @@ -209,7 +208,7 @@ VIRTUAL(5) VIRTUAL(5) regexp_table(5) format of POSIX regular expression tables 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/man5/access.5 b/postfix/man/man5/access.5 index 58a02a996..60ee50d9b 100644 --- a/postfix/man/man5/access.5 +++ b/postfix/man/man5/access.5 @@ -13,8 +13,9 @@ format of Postfix access table .ad .fi The optional \fBaccess\fR table directs the Postfix SMTP server -to selectively reject or accept mail from or to specific hosts, -domains, networks, host addresses or mail addresses. +to selectively reject or accept mail. Access can be allowed or +denied for specific host names, domain names, networks, host +network addresses or mail addresses. Normally, the \fBaccess\fR table is specified as a text file that serves as input to the \fBpostmap\fR(1) command. @@ -44,22 +45,57 @@ are lines whose first non-whitespace character is a `#'. .IP "multi-line text" A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line. -.SH PATTERNS +.SH EMAIL ADDRESS PATTERNS .na .nf .ad .fi With lookups from indexed files such as DB or DBM, or from networked -tables such as NIS, LDAP or SQL, patterns are tried in the order as -listed below: +tables such as NIS, LDAP or SQL, the following lookup patterns are +examined in the order as listed: .IP \fIuser\fR@\fIdomain\fR Matches the specified mail address. .IP \fIdomain.name\fR -Matches the \fIdomain.name\fR itself and any subdomain thereof, -either in hostnames or in mail addresses. Top-level domains will -never be matched. +Matches \fIdomain.name\fR as the domain part of an email address. +.sp +The pattern \fIdomain.name\fR also matches subdomains, but only +when the string \fBsmtpd_access_maps\fR is listed in the Postfix +\fBparent_domain_matches_subdomains\fR configuration setting. +Otherwise, specify \fI.domain.name\fR (note the initial dot) in +order to match subdomains. .IP \fIuser\fR@ Matches all mail addresses with the specified user part. +.PP +Note: lookup of the null sender address may not be possible with +all supported types of lookup table. A workaround is to specify +\fBsmtpd_null_access_lookup_key = <>\fR in the Postfix \fBmain.cf\fR +file, and to specify \fB<>\fR as the left-hand field in the access +table. +.SH ADDRESS EXTENSION +.na +.nf +.fi +.ad +When a mail address localpart contains the optional recipient delimiter +(e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIdomain\fR, +\fIuser+foo\fR@, and \fIuser\fR@. +.SH HOST NAME/ADDRESS PATTERNS +.na +.nf +.ad +.fi +With lookups from indexed files such as DB or DBM, or from networked +tables such as NIS, LDAP or SQL, the following lookup patterns are +examined in the order as listed: +.IP \fIdomain.name\fR +Matches \fIdomain.name\fR. +.sp +The pattern \fIdomain.name\fR also matches subdomains, but only +when the string \fBsmtpd_access_maps\fR is listed in the Postfix +\fBparent_domain_matches_subdomains\fR configuration setting. +Otherwise, specify \fI.domain.name\fR (note the initial dot) in +order to match subdomains. .IP \fInet.work.addr.ess\fR .IP \fInet.work.addr\fR .IP \fInet.work\fR @@ -96,13 +132,14 @@ Each pattern is a regular expression that is applied to the entire string being looked up. Depending on the application, that string is an entire client hostname, an entire client IP address, or an entire mail address. Thus, no parent domain or parent network search -is done, and \fIuser@domain\fR mail addresses are not broken up into -their \fIuser@\fR and \fIdomain\fR constituent parts. +is done, \fIuser@domain\fR mail addresses are not broken up into +their \fIuser@\fR and \fIdomain\fR constituent parts, nor is +\fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string. -Actions are the same as with normal indexed file lookups, with +Actions are the same as with indexed file lookups, with the additional feature that parenthesized substrings from the pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. .SH BUGS diff --git a/postfix/man/man5/canonical.5 b/postfix/man/man5/canonical.5 index 80fe42c14..42cf79657 100644 --- a/postfix/man/man5/canonical.5 +++ b/postfix/man/man5/canonical.5 @@ -88,13 +88,11 @@ In all the above forms, when \fIaddress\fR has the form .nf .fi .ad -When table lookup fails, and the address localpart contains the -optional recipient delimiter (e.g., \fIuser+foo\fR@\fIdomain\fR), the -search is repeated for the unextended address (e.g. -\fIuser\fR@\fIdomain\fR), and the unmatched extension is propagated -to the result of table lookup. The matching order is: -\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, -\fIuser+foo\fR, \fIuser\fR, and @\fIdomain\fR. +When a mail address localpart contains the optional recipient delimiter +(e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +\fIuser\fR, and @\fIdomain\fR. An unmatched address extension +(\fI+foo\fR) is propagated to the result of table lookup. .SH REGULAR EXPRESSION TABLES .na .nf @@ -113,7 +111,7 @@ nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string. -Results are the same as with normal indexed file lookups, with +Results are the same as with indexed file lookups, with the additional feature that parenthesized substrings from the pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. .SH BUGS diff --git a/postfix/man/man5/relocated.5 b/postfix/man/man5/relocated.5 index 189bb167c..ddb318fc6 100644 --- a/postfix/man/man5/relocated.5 +++ b/postfix/man/man5/relocated.5 @@ -68,10 +68,10 @@ precedence. .nf .fi .ad -When the search fails, and the address localpart contains the -optional recipient delimiter (e.g., \fIuser+foo\fR@\fIdomain\fR), -the search is repeated for the unextended address (e.g. -\fIuser\fR@\fIdomain\fR). +When a mail address localpart contains the optional recipient delimiter +(e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +\fIuser\fR, and @\fIdomain\fR. .SH REGULAR EXPRESSION TABLES .na .nf @@ -90,7 +90,7 @@ nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string. -Results are the same as with normal indexed file lookups, with +Results are the same as with indexed file lookups, with the additional feature that parenthesized substrings from the pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. .SH BUGS diff --git a/postfix/man/man5/transport.5 b/postfix/man/man5/transport.5 index 674c8e3d7..eec9204c5 100644 --- a/postfix/man/man5/transport.5 +++ b/postfix/man/man5/transport.5 @@ -53,7 +53,10 @@ Mail for \fIdomain\fR is delivered through \fItransport\fR to \fInexthop\fR. .IP "\fI.domain transport\fR:\fInexthop\fR" Mail for any subdomain of \fIdomain\fR is delivered through -\fItransport\fR to \fInexthop\fR. +\fItransport\fR to \fInexthop\fR. This applies only when the +string \fBtransport_maps\fR is not listed in the +\fBparent_domain_matches_subdomains\fR configuration setting. +Otherwise, a domain name matches itself and its subdomains. .PP Note: transport map entries take precedence over domains specified in the \fBmydestination\fR parameter. If you use @@ -140,7 +143,7 @@ broken up into parent domains. Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string. -Results are the same as with normal indexed file lookups, with +Results are the same as with indexed file lookups, with the additional feature that parenthesized substrings from the pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. .SH CONFIGURATION PARAMETERS diff --git a/postfix/man/man5/virtual.5 b/postfix/man/man5/virtual.5 index ab3eb1ae9..4ddc5d42e 100644 --- a/postfix/man/man5/virtual.5 +++ b/postfix/man/man5/virtual.5 @@ -158,13 +158,11 @@ This works for the first address in the expansion only. .nf .fi .ad -When the search fails, and the address localpart contains the -optional recipient delimiter (e.g., \fIuser+foo\fR@\fIdomain\fR), -the search is repeated for the unextended address (e.g. -\fIuser\fR@\fIdomain\fR), and the unmatched address extension is -propagated to the result of expansion. The matching order is: -\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, -\fIuser+foo\fR, \fIuser\fR, and @\fIdomain\fR. +When a mail address localpart contains the optional recipient delimiter +(e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +\fIuser\fR, and @\fIdomain\fR. An unmatched address extension +(\fI+foo\fR) is propagated to the result of table lookup. .SH REGULAR EXPRESSION TABLES .na .nf @@ -183,7 +181,7 @@ nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string. -Results are the same as with normal indexed file lookups, with +Results are the same as with indexed file lookups, with the additional feature that parenthesized substrings from the pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. .SH BUGS diff --git a/postfix/proto/access b/postfix/proto/access index a9559901b..5536b41d5 100644 --- a/postfix/proto/access +++ b/postfix/proto/access @@ -7,8 +7,9 @@ # \fBpostmap /etc/postfix/access\fR # DESCRIPTION # The optional \fBaccess\fR table directs the Postfix SMTP server -# to selectively reject or accept mail from or to specific hosts, -# domains, networks, host addresses or mail addresses. +# to selectively reject or accept mail. Access can be allowed or +# denied for specific host names, domain names, networks, host +# network addresses or mail addresses. # # Normally, the \fBaccess\fR table is specified as a text file # that serves as input to the \fBpostmap\fR(1) command. @@ -36,20 +37,51 @@ # .IP "multi-line text" # A logical line starts with non-whitespace text. A line that # starts with whitespace continues a logical line. -# PATTERNS +# EMAIL ADDRESS PATTERNS # .ad # .fi # With lookups from indexed files such as DB or DBM, or from networked -# tables such as NIS, LDAP or SQL, patterns are tried in the order as -# listed below: +# tables such as NIS, LDAP or SQL, the following lookup patterns are +# examined in the order as listed: # .IP \fIuser\fR@\fIdomain\fR # Matches the specified mail address. # .IP \fIdomain.name\fR -# Matches the \fIdomain.name\fR itself and any subdomain thereof, -# either in hostnames or in mail addresses. Top-level domains will -# never be matched. +# Matches \fIdomain.name\fR as the domain part of an email address. +# .sp +# The pattern \fIdomain.name\fR also matches subdomains, but only +# when the string \fBsmtpd_access_maps\fR is listed in the Postfix +# \fBparent_domain_matches_subdomains\fR configuration setting. +# Otherwise, specify \fI.domain.name\fR (note the initial dot) in +# order to match subdomains. # .IP \fIuser\fR@ # Matches all mail addresses with the specified user part. +# .PP +# Note: lookup of the null sender address may not be possible with +# all supported types of lookup table. A workaround is to specify +# \fBsmtpd_null_access_lookup_key = <>\fR in the Postfix \fBmain.cf\fR +# file, and to specify \fB<>\fR as the left-hand field in the access +# table. +# ADDRESS EXTENSION +# .fi +# .ad +# When a mail address localpart contains the optional recipient delimiter +# (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIdomain\fR, +# \fIuser+foo\fR@, and \fIuser\fR@. +# HOST NAME/ADDRESS PATTERNS +# .ad +# .fi +# With lookups from indexed files such as DB or DBM, or from networked +# tables such as NIS, LDAP or SQL, the following lookup patterns are +# examined in the order as listed: +# .IP \fIdomain.name\fR +# Matches \fIdomain.name\fR. +# .sp +# The pattern \fIdomain.name\fR also matches subdomains, but only +# when the string \fBsmtpd_access_maps\fR is listed in the Postfix +# \fBparent_domain_matches_subdomains\fR configuration setting. +# Otherwise, specify \fI.domain.name\fR (note the initial dot) in +# order to match subdomains. # .IP \fInet.work.addr.ess\fR # .IP \fInet.work.addr\fR # .IP \fInet.work\fR @@ -82,13 +114,14 @@ # string being looked up. Depending on the application, that string # is an entire client hostname, an entire client IP address, or an # entire mail address. Thus, no parent domain or parent network search -# is done, and \fIuser@domain\fR mail addresses are not broken up into -# their \fIuser@\fR and \fIdomain\fR constituent parts. +# is done, \fIuser@domain\fR mail addresses are not broken up into +# their \fIuser@\fR and \fIdomain\fR constituent parts, nor is +# \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR. # # Patterns are applied in the order as specified in the table, until a # pattern is found that matches the search string. # -# Actions are the same as with normal indexed file lookups, with +# Actions are the same as with indexed file lookups, with # the additional feature that parenthesized substrings from the # pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. # BUGS diff --git a/postfix/proto/canonical b/postfix/proto/canonical index 60a760548..7cf0829a4 100644 --- a/postfix/proto/canonical +++ b/postfix/proto/canonical @@ -78,13 +78,11 @@ # ADDRESS EXTENSION # .fi # .ad -# When table lookup fails, and the address localpart contains the -# optional recipient delimiter (e.g., \fIuser+foo\fR@\fIdomain\fR), the -# search is repeated for the unextended address (e.g. -# \fIuser\fR@\fIdomain\fR), and the unmatched extension is propagated -# to the result of table lookup. The matching order is: -# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, -# \fIuser+foo\fR, \fIuser\fR, and @\fIdomain\fR. +# When a mail address localpart contains the optional recipient delimiter +# (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +# \fIuser\fR, and @\fIdomain\fR. An unmatched address extension +# (\fI+foo\fR) is propagated to the result of table lookup. # REGULAR EXPRESSION TABLES # .ad # .fi @@ -101,7 +99,7 @@ # Patterns are applied in the order as specified in the table, until a # pattern is found that matches the search string. # -# Results are the same as with normal indexed file lookups, with +# Results are the same as with indexed file lookups, with # the additional feature that parenthesized substrings from the # pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. # BUGS diff --git a/postfix/proto/relocated b/postfix/proto/relocated index 6f3336658..ba1b00726 100644 --- a/postfix/proto/relocated +++ b/postfix/proto/relocated @@ -58,10 +58,10 @@ # ADDRESS EXTENSION # .fi # .ad -# When the search fails, and the address localpart contains the -# optional recipient delimiter (e.g., \fIuser+foo\fR@\fIdomain\fR), -# the search is repeated for the unextended address (e.g. -# \fIuser\fR@\fIdomain\fR). +# When a mail address localpart contains the optional recipient delimiter +# (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +# \fIuser\fR, and @\fIdomain\fR. # REGULAR EXPRESSION TABLES # .ad # .fi @@ -78,7 +78,7 @@ # Patterns are applied in the order as specified in the table, until a # pattern is found that matches the search string. # -# Results are the same as with normal indexed file lookups, with +# Results are the same as with indexed file lookups, with # the additional feature that parenthesized substrings from the # pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. # BUGS diff --git a/postfix/proto/transport b/postfix/proto/transport index 16f910ff9..c630d44bc 100644 --- a/postfix/proto/transport +++ b/postfix/proto/transport @@ -45,7 +45,10 @@ # \fInexthop\fR. # .IP "\fI.domain transport\fR:\fInexthop\fR" # Mail for any subdomain of \fIdomain\fR is delivered through -# \fItransport\fR to \fInexthop\fR. +# \fItransport\fR to \fInexthop\fR. This applies only when the +# string \fBtransport_maps\fR is not listed in the +# \fBparent_domain_matches_subdomains\fR configuration setting. +# Otherwise, a domain name matches itself and its subdomains. # .PP # Note: transport map entries take precedence over domains # specified in the \fBmydestination\fR parameter. If you use @@ -128,7 +131,7 @@ # Patterns are applied in the order as specified in the table, until a # pattern is found that matches the search string. # -# Results are the same as with normal indexed file lookups, with +# Results are the same as with indexed file lookups, with # the additional feature that parenthesized substrings from the # pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. # CONFIGURATION PARAMETERS diff --git a/postfix/proto/virtual b/postfix/proto/virtual index 9f56d0d63..214eb8882 100644 --- a/postfix/proto/virtual +++ b/postfix/proto/virtual @@ -144,13 +144,11 @@ # ADDRESS EXTENSION # .fi # .ad -# When the search fails, and the address localpart contains the -# optional recipient delimiter (e.g., \fIuser+foo\fR@\fIdomain\fR), -# the search is repeated for the unextended address (e.g. -# \fIuser\fR@\fIdomain\fR), and the unmatched address extension is -# propagated to the result of expansion. The matching order is: -# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, -# \fIuser+foo\fR, \fIuser\fR, and @\fIdomain\fR. +# When a mail address localpart contains the optional recipient delimiter +# (e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes: +# \fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR, +# \fIuser\fR, and @\fIdomain\fR. An unmatched address extension +# (\fI+foo\fR) is propagated to the result of table lookup. # REGULAR EXPRESSION TABLES # .ad # .fi @@ -167,7 +165,7 @@ # Patterns are applied in the order as specified in the table, until a # pattern is found that matches the search string. # -# Results are the same as with normal indexed file lookups, with +# Results are the same as with indexed file lookups, with # the additional feature that parenthesized substrings from the # pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on. # BUGS diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 8e5a5a72e..cee1cc488 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Snapshot-20020104" +#define DEF_MAIL_VERSION "Snapshot-20020106" extern char *var_mail_version; /* LICENSE diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 2ff7e222d..968e1ee91 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -290,6 +290,7 @@ #include #include #include +#include /* Application-specific. */ @@ -736,6 +737,29 @@ static const char *check_mail_addr_find(SMTPD_STATE *state, return (result); } +/* resolve_final - do we do final delivery for the domain? */ + +static int resolve_final(SMTPD_STATE *state, const char *reply_name, +const char *domain) +{ + + /* If matches $mydestination or $inet_interfaces. */ + if (resolve_local(domain)) + return (1); + + /* If Postfix-style virtual domain. */ + if (*var_virtual_maps + && check_maps_find(state, reply_name, virtual_maps, domain, 0)) + return (1); + + /* If virtual mailbox domain. */ + if (*var_virt_mailbox_maps + && check_maps_find(state, reply_name, virt_mailbox_maps, domain, 0)) + return (1); + + return (0); +} + /* reject_unknown_client - fail if client hostname is unknown */ static int reject_unknown_client(SMTPD_STATE *state) @@ -997,14 +1021,10 @@ static int permit_auth_destination(SMTPD_STATE *state, char *recipient) domain += 1; /* - * Permit final delivery: the destination matches mydestination or - * virtual_maps. + * Permit final delivery: the destination matches mydestination, + * virtual_maps, or virtual_mailbox_maps. */ - if (resolve_local(domain) - || (*var_virtual_maps - && check_maps_find(state, recipient, virtual_maps, domain, 0)) - || (*var_virt_mailbox_maps - && check_maps_find(state, recipient, virt_mailbox_maps, domain, 0))) + if (resolve_final(state, recipient, domain)) return (SMTPD_CHECK_OK); /* @@ -1261,11 +1281,7 @@ static int permit_mx_backup(SMTPD_STATE *state, const char *recipient) if ((domain = strrchr(CONST_STR(reply->recipient), '@')) == 0) return (SMTPD_CHECK_OK); domain += 1; - if (resolve_local(domain) - || (*var_virtual_maps - && check_maps_find(state, recipient, virtual_maps, domain, 0)) - || (*var_virt_mailbox_maps - && check_maps_find(state, recipient, virt_mailbox_maps, domain, 0))) + if (resolve_final(state, recipient, domain)) return (SMTPD_CHECK_OK); if (msg_verbose) @@ -1397,11 +1413,7 @@ static int reject_unknown_address(SMTPD_STATE *state, const char *addr, if ((domain = strrchr(CONST_STR(reply->recipient), '@')) == 0) return (SMTPD_CHECK_DUNNO); domain += 1; - if (resolve_local(domain) - || (*var_virtual_maps - && check_maps_find(state, reply_name, virtual_maps, domain, 0)) - || (*var_virt_mailbox_maps - && check_maps_find(state, reply_name, virt_mailbox_maps, domain, 0))) + if (resolve_final(state, reply_name, domain)) return (SMTPD_CHECK_DUNNO); if (domain[0] == '#') return (SMTPD_CHECK_DUNNO); @@ -1693,9 +1705,12 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, { char *myname = "check_mail_access"; const RESOLVE_REPLY *reply; - const char *ratsign; + const char *domain; int status; char *local_at; + char *bare_addr; + char *bare_ext; + char *bare_at; if (msg_verbose) msg_info("%s: %s", myname, addr); @@ -1709,50 +1724,114 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, * Garbage in, garbage out. Every address from canon_addr_internal() and * from resolve_clnt_query() must be fully qualified. */ - if ((ratsign = strrchr(CONST_STR(reply->recipient), '@')) == 0) { - msg_warn("%s: no @domain in address: %s", myname, CONST_STR(reply->recipient)); + if ((domain = strrchr(CONST_STR(reply->recipient), '@')) == 0) { + msg_warn("%s: no @domain in address: %s", myname, + CONST_STR(reply->recipient)); return (0); } + domain += 1; /* - * Avoid surprise matches with source-routed, non-local addresses. + * In case of address extensions. */ - if (var_allow_untrust_route == 0 - && (reply->flags & RESOLVE_FLAG_ROUTED) - && !resolve_local(ratsign + 1)) - return (SMTPD_CHECK_DUNNO); + if (*var_rcpt_delim == 0) { + bare_addr = 0; + } else { + bare_addr = mystrdup(addr); + if ((bare_at = strrchr(bare_addr, '@')) != 0) + *bare_at = 0; + if ((bare_ext = split_addr(bare_addr, *var_rcpt_delim)) != 0) { + if (bare_at != 0) { + *bare_at = '@'; + memmove(bare_ext - 1, bare_at, strlen(bare_at) + 1); + bare_at = bare_ext - 1; + } + } else { + myfree(bare_addr); + bare_addr = 0; + } + } + +#define CHECK_MAIL_ACCESS_RETURN(x) \ + { if (bare_addr) myfree(bare_addr); return(x); } /* - * Look up the full address. + * Source-routed, non-local, recipient addresses are too suspicious for + * returning an "OK" result. The complicated expression below was brought + * to you by the keyboard of Victor Duchovny, Morgan Stanley and hacked + * up a bit by Wietse. + */ +#define SUSPICIOUS(domain, reply, state, reply_name, reply_class) \ + (var_allow_untrust_route == 0 \ + && (reply->flags & RESOLVE_FLAG_ROUTED) \ + && strcmp(reply_class, SMTPD_NAME_RECIPIENT) == 0 \ + && !resolve_final(state, reply_name, domain)) + + /* + * Look up user+foo@domain if the address has an extension, user@domain + * otherwise. */ if ((status = check_access(state, table, CONST_STR(reply->recipient), FULL, found, reply_name, reply_class, def_acl)) != 0 || *found) - return (status); + CHECK_MAIL_ACCESS_RETURN(status == SMTPD_CHECK_OK + && SUSPICIOUS(domain, reply, state, reply_name, reply_class) ? + SMTPD_CHECK_DUNNO : status); + + /* + * Try user@domain if the address has an extension. + */ + if (bare_addr) + if ((status = check_access(state, table, bare_addr, PARTIAL, + found, reply_name, reply_class, def_acl)) != 0 + || *found) + CHECK_MAIL_ACCESS_RETURN(status == SMTPD_CHECK_OK + && SUSPICIOUS(domain, reply, state, reply_name, reply_class) ? + SMTPD_CHECK_DUNNO : status); /* * Look up the domain name, or parent domains thereof. */ - if ((status = check_domain_access(state, table, ratsign + 1, PARTIAL, + if ((status = check_domain_access(state, table, domain, PARTIAL, found, reply_name, reply_class, def_acl)) != 0 || *found) - return (status); + CHECK_MAIL_ACCESS_RETURN(status == SMTPD_CHECK_OK + && SUSPICIOUS(domain, reply, state, reply_name, reply_class) ? + SMTPD_CHECK_DUNNO : status); /* - * Look up localpart@ + * Look up user+foo@ if the address has an extension, user@ otherwise. + * XXX This leaks a little memory if map lookup is aborted. */ local_at = mystrndup(CONST_STR(reply->recipient), - ratsign - CONST_STR(reply->recipient) + 1); + domain - CONST_STR(reply->recipient)); status = check_access(state, table, local_at, PARTIAL, found, reply_name, reply_class, def_acl); myfree(local_at); if (status != 0 || *found) - return (status); + CHECK_MAIL_ACCESS_RETURN(status == SMTPD_CHECK_OK + && SUSPICIOUS(domain, reply, state, reply_name, reply_class) ? + SMTPD_CHECK_DUNNO : status); + + /* + * Look up user@ if the address has an extension. XXX Same problem here. + */ + if (bare_addr) { + local_at = (bare_at ? mystrndup(bare_addr, bare_at + 1 - bare_addr) : + mystrdup(bare_addr)); + status = check_access(state, table, local_at, PARTIAL, found, + reply_name, reply_class, def_acl); + myfree(local_at); + if (status != 0 || *found) + CHECK_MAIL_ACCESS_RETURN(status == SMTPD_CHECK_OK + && SUSPICIOUS(domain, reply, state, reply_name, reply_class) ? + SMTPD_CHECK_DUNNO : status); + } /* * Undecided when no match found. */ - return (SMTPD_CHECK_DUNNO); + CHECK_MAIL_ACCESS_RETURN(SMTPD_CHECK_DUNNO); } /* reject_maps_rbl - reject if client address in real-time blackhole list */ diff --git a/postfix/src/util/readlline.c b/postfix/src/util/readlline.c index 8709eefed..9be31eab1 100644 --- a/postfix/src/util/readlline.c +++ b/postfix/src/util/readlline.c @@ -34,6 +34,9 @@ /* DIAGNOSTICS /* Warning: a continuation line that does not continue preceding text. /* The invalid input is ignored, to avoid complicating caller code. +/* SECURITY +/* readlline() imposes no logical line length limit therefore it +/* should be used for reading trusted information only. /* LICENSE /* .ad /* .fi