From: Wietse Venema
Append the domain names in $myorigin and $mydomain to incomplete message header addresses from these clients.
Specify a list of network addresses or network/netmask patterns, -separated by comma or whitespace. The list is matched left to right, -and the search stops on the first match. Specify !address or -!network/netmask to exclude an address or network block from the -list. A network mask specifies the number of bits in the network -part of a host address. Continue long lines by starting the next -line with whitespace.
+separated by comma or whitespace. Continue long lines by starting +the next line with whitespace. + +A network mask specifies the number of bits in the network part +of a host address. You can also specify "/file/name" or "type:table" +patterns. A "/file/name" pattern is replaced by its contents; a +"type:table" lookup table is matched when a client name or address +matches a lookup key (the lookup result is ignored).
+ +The list is matched left to right, and the search stops on the +first match. Specify "!pattern" to exclude an address or network +block from the list.
+ ++Examples: +
-You can also specify "/file/name" or "type:table" patterns. -A "/file/name" pattern is replaced by its contents; a "type:table" -lookup table is matched when a client name or address matches a -lookup key (the lookup result is ignored).
++local_header_rewrite_context_clients = $mynetworks +local_header_rewrite_context_clients = !192.168.0.1 $mynetworks +local_header_rewrite_context_clients = static:all +
-Specify a list of network/netmask patterns, separated by commas -and/or whitespace. The mask specifies the number of bits in the -network part of a host address. You can also specify "/file/name" -or "type:table" patterns. A "/file/name" pattern is replaced by -its contents; a "type:table" lookup table is matched when a table -entry matches a lookup string (the lookup result is ignored). -Continue long lines by starting the next line with whitespace. -
+Specify a list of network addresses or network/netmask patterns, +separated by commas and/or whitespace. Continue long lines by +starting the next line with whitespace.
--Examples: -
+The netmask specifies the number of bits in the network part +of a host address. You can also specify "/file/name" or "type:table" +patterns. A "/file/name" pattern is replaced by its contents; a +"type:table" lookup table is matched when a table entry matches a +lookup string (the lookup result is ignored).
+ +The list is matched left to right, and the search stops on the +first match. Specify "!pattern" to exclude an address or network +block from the list.
+ +Examples:
mynetworks = 168.100.189.0/28, 127.0.0.0/8 +mynetworks = !192.168.0.1, 192.168.0.0/28 mynetworks = $config_directory/mynetworks mynetworks = hash:/etc/postfix/network_tablediff --git a/postfix/html/smtpd.8.html b/postfix/html/smtpd.8.html index ebb5c37b4..a4aee5498 100644 --- a/postfix/html/smtpd.8.html +++ b/postfix/html/smtpd.8.html @@ -110,8 +110,7 @@ SMTPD(8) SMTPD(8) Available in Postfix version 2.2 and later: - local_header_rewrite_context_clients ($inet_interfaces - $mynetworks) + local_header_rewrite_context_clients ($mynetworks) Append the domain names in $myorigin and $mydomain to incomplete message header addresses from these clients. diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index 5537e4ad4..ed6453d35 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -1564,25 +1564,35 @@ the entry in the master.cf file. Setting this parameter to a value > 1 changes the meaning of local_destination_concurrency_limit from concurrency per recipient into concurrency per domain. -
-Specify a list of network/netmask patterns, separated by commas -and/or whitespace. The mask specifies the number of bits in the -network part of a host address. You can also specify "/file/name" -or "type:table" patterns. A "/file/name" pattern is replaced by -its contents; a "type:table" lookup table is matched when a table -entry matches a lookup string (the lookup result is ignored). -Continue long lines by starting the next line with whitespace. -
+Specify a list of network addresses or network/netmask patterns, +separated by commas and/or whitespace. Continue long lines by +starting the next line with whitespace.
--Examples: -
+The netmask specifies the number of bits in the network part +of a host address. You can also specify "/file/name" or "type:table" +patterns. A "/file/name" pattern is replaced by its contents; a +"type:table" lookup table is matched when a table entry matches a +lookup string (the lookup result is ignored).
-+The list is matched left to right, and the search stops on the +first match. Specify "!pattern" to exclude an address or network +block from the list.
+ +Examples:
+ +mynetworks = 168.100.189.0/28, 127.0.0.0/8 +mynetworks = !192.168.0.1, 192.168.0.0/28 mynetworks = $config_directory/mynetworks mynetworks = hash:/etc/postfix/network_table@@ -7215,24 +7218,35 @@ remote clients, when $remote_header_rewrite_context_name is set to "invalid". This is one way to avoid appending your own domain to addresses in spam from poorly written software. -%PARAM local_header_rewrite_context_clients $inet_interfaces -$mynetworks +%PARAM local_header_rewrite_context_clients $mynetworksAppend the domain names in $myorigin and $mydomain to incomplete message header addresses from these clients.
Specify a list of network addresses or network/netmask patterns, -separated by comma or whitespace. The list is matched left to right, -and the search stops on the first match. Specify !address or -!network/netmask to exclude an address or network block from the -list. A network mask specifies the number of bits in the network -part of a host address. Continue long lines by starting the next -line with whitespace.
- -You can also specify "/file/name" or "type:table" patterns. -A "/file/name" pattern is replaced by its contents; a "type:table" -lookup table is matched when a client name or address matches a -lookup key (the lookup result is ignored).
+separated by comma or whitespace. Continue long lines by starting +the next line with whitespace. + +A network mask specifies the number of bits in the network part +of a host address. You can also specify "/file/name" or "type:table" +patterns. A "/file/name" pattern is replaced by its contents; a +"type:table" lookup table is matched when a client name or address +matches a lookup key (the lookup result is ignored).
+ +The list is matched left to right, and the search stops on the +first match. Specify "!pattern" to exclude an address or network +block from the list.
+ + ++Examples: +
+ ++local_header_rewrite_context_clients = $mynetworks +local_header_rewrite_context_clients = !192.168.0.1 $mynetworks +local_header_rewrite_context_clients = static:all +%PARAM remote_header_rewrite_context_name local diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 1c59cc3be..cfc481674 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -2104,8 +2104,7 @@ extern char *var_remote_rwr_name; #define REWRITE_NONE "none" #define VAR_LOC_RWR_CLIENTS "local_header_rewrite_context_clients" -#define DEF_LOC_RWR_CLIENTS "$" VAR_INET_INTERFACES \ - " $" VAR_MYNETWORKS +#define DEF_LOC_RWR_CLIENTS "$" VAR_MYNETWORKS extern char *var_local_rwr_clients; /* LICENSE diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 98f0e7092..ac7e02019 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only. */ -#define MAIL_RELEASE_DATE "20041019" +#define MAIL_RELEASE_DATE "20041020" #define MAIL_VERSION_NUMBER "2.2" #define VAR_MAIL_VERSION "mail_version" diff --git a/postfix/src/global/rewrite_clnt.in b/postfix/src/global/rewrite_clnt.in index a66fc2064..87a679610 100644 --- a/postfix/src/global/rewrite_clnt.in +++ b/postfix/src/global/rewrite_clnt.in @@ -1,16 +1,16 @@ -canonical ! -canonical a! -canonical !b -canonical a!b -canonical % -canonical a% -canonical %b -canonical a%b -canonical @ -canonical a@ -canonical a@. -canonical a@b -canonical a@b. +local ! +local a! +local !b +local a!b +local % +local a% +local %b +local a%b +local @ +local a@ +local a@. +local a@b +local a@b. invalid ! invalid a! invalid !b diff --git a/postfix/src/global/rewrite_clnt.ref b/postfix/src/global/rewrite_clnt.ref index 328d0e1a1..d846a4dd7 100644 --- a/postfix/src/global/rewrite_clnt.ref +++ b/postfix/src/global/rewrite_clnt.ref @@ -1,52 +1,52 @@ -rule canonical +rule local address ! result ""@ -rule canonical +rule local address a! result ""@a.MYDOMAIN -rule canonical +rule local address !b result b@ -rule canonical +rule local address a!b result b@a.MYDOMAIN -rule canonical +rule local address % result ""@ -rule canonical +rule local address a% result a@ -rule canonical +rule local address %b result ""@b.MYDOMAIN -rule canonical +rule local address a%b result a@b.MYDOMAIN -rule canonical +rule local address @ result "" -rule canonical +rule local address a@ result a@ -rule canonical +rule local address a@. result a@. -rule canonical +rule local address a@b result a@b.MYDOMAIN -rule canonical +rule local address a@b. result a@b diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 041e65512..0f6d94535 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -94,7 +94,7 @@ /* filtering, or address mapping. /* .PP /* Available in Postfix version 2.2 and later: -/* .IP "\fBlocal_header_rewrite_context_clients ($inet_interfaces $mynetworks)\fR" +/* .IP "\fBlocal_header_rewrite_context_clients ($mynetworks)\fR" /* Append the domain names in $myorigin and $mydomain to incomplete /* message header addresses from these clients. /* .IP "\fBremote_header_rewrite_context_name (local)\fR" @@ -2372,6 +2372,8 @@ static int xforward_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv) * DOMAIN=local or remote. */ case SMTPD_STATE_XFORWARD_DOMAIN: + if (STREQ(attr_value, XFORWARD_UNAVAILABLE)) + attr_value = XFORWARD_DOM_LOCAL; context_name[1] = var_remote_rwr_name; if ((context_code = name_code(xforward_to_context, NAME_CODE_FLAG_NONE, @@ -2717,12 +2719,6 @@ static void smtpd_service(VSTREAM *stream, char *service, char **argv) state.xforward_allowed = namadr_list_match(xforward_hosts, state.name, state.addr); - /* - * Choose a default address rewriting context. This should be made more - * configurable. - */ - smtpd_check_rewrite(&state); - /* * See if we need to turn on verbose logging for this client. */ diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index bcd65f166..593d42cfc 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -3378,11 +3378,10 @@ void smtpd_check_rewrite(SMTPD_STATE *state) #define NOT_SASL_AUTHENTICATED 0 /* - * XXX We want to be able to use !pattern to make exceptions, but then we - * should not confuse matters by mixing names with addresses. + * XXX We accept same syntax as mynetwork. */ if (SMTPD_STAND_ALONE(state) - || namadr_list_match(local_rewrite_clients, " ", state->addr) + || namadr_list_match(local_rewrite_clients, state->name, state->addr) #ifdef USE_SASL_AUTH || permit_sasl_auth(state, SASL_AUTHENTICATED, NOT_SASL_AUTHENTICATED)