2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-29 13:18:12 +00:00

postfix-1.1.8-20020505

This commit is contained in:
Wietse Venema 2002-05-05 00:00:00 -05:00 committed by Viktor Dukhovni
parent 44b8cf6ec1
commit 8cae9ae6db
25 changed files with 481 additions and 255 deletions

View File

@ -6294,8 +6294,10 @@ Apologies for any names omitted.
developed with Lamont Jones, HP.
Feature: more efficient use of cache memory when a process
opens multiple Berkeley DB tables. Files: util/dict_db.c,
global/mkmap_db.c. Victor Duchovni, Morgan Stanley.
opens multiple Berkeley DB tables; and faster performance
creating large tables by using more buffer memory. Files:
util/dict_db.[hc], global/mkmap_db.c. Victor Duchovni,
Morgan Stanley.
20020503
@ -6320,9 +6322,28 @@ Apologies for any names omitted.
permissions from the source file when it creates a new
table for the first time. File: postalias/postalias.c.
20020504
Portability: run-time test to avoid GDBM trouble. File:
util/dict_dbm.c.
20020505
Cleanup: revised and simplified the transport map semantics.
Null transport or nexhop fields now mean: "do not change":
use what would be used if the transport map did not exist.
This change eliminated a lot of code. The incompatibility
is that a null transport field no longer defaults to
$default_transport, but to $local_transport or $default_transport
depending on the destination, and that a transport map only
overrides relayhost when the table specifies explicit
nexthop information. Files: trivial-rewrite/transport.c,
trivial-rewrite/resolve.c.
Cleanup: revised the user interface for controlling the
Berkeley DB create and read buffer size controls. Files:
util/dict_db.[hc], global/mail_params.[hc], global/mkmap_db.c.
Open problems:
Low: sendmail does not store null command-line recipients.

View File

@ -1,9 +1,13 @@
Purpose of this document
========================
This document describes how to build Postfix with third-party
Berkeley DB from www.sleepycat.com, or how to choose a specific
Berkeley DB version when your system provides multiple implementations.
This document describes
1 - How to build Postfix with third-party Berkeley DB from
www.sleepycat.com, or how to choose a specific Berkeley DB version
when your system provides multiple implementations.
2 - How to tweak performance.
Building Postfix with Sleepycat Berkeley DB
===========================================
@ -84,3 +88,20 @@ DB 1.85 compatibility mode. Doing so would break fcntl file locking.
Warning: if you use PERL to manipulate Postfix .db files, then you
need to use the same Berkeley DB version in PERL as in Postfix.
Tweaking performance
====================
Postfix provides two configuration parameters that control how much
buffering memory Berkeley DB will use.
- berkeley_db_create_buffer_size (default: 16 MBytes). This setting
is used by the postalias and postmap commands. For "hash" files
performance degrades rapidly unless the memory pool is O(file size).
For "btree" files peformance is good with sorted input even for
small memory pools, but with random input degrades rapidly unless
the memory pool is O(file size).
- berkeley_db_read_buffer_size (default: 256 kBytes). This setting
is used by all other Postfix programs. The buffer size is adequate
for reading.

View File

@ -12,6 +12,60 @@ snapshot release). Patches change the patchlevel and the release
date. Snapshots change only the release date, unless they include
the same bugfixes as a patch release.
Incompatible changes with Postfix snapshot 1.1.8-20020505
=========================================================
In the Postfix transport table, the meaning of null delivery
transport and nexhop information fields has changed. As of now, a
null delivery transport or nexthop information field means "do not
modify": use the delivery transport or nexthop information that
would be used if no transport table did not exist. This change
results in the following incompatible changes in behavior:
- A null delivery transport field no longer defaults to
$default_transport. It now defaults to $local_transport or
$default_transport depending on the destination.
- A null nexthop information field no longer overrides the main.cf
relayhost setting. To override the relayhost, specify explicit
nexthop information in the Postfix transport table.
The postalias command now copies the source file read permissions
to the result file when creating a table for the first time. Until
now, the result file was created with default read permissions.
This change makes postalias more similar to postmap.
The postalias and postmap commands now drop super-user privileges
when processing a non-root source file. The file is now processed
as the source file owner, and the owner must therefore have permission
to update the result file. Specify the "-o" flag to get the old
behavior (process non-root files with root privileges).
The read buffer size for Berkeley DB lookup tables was decreased
from 1MByte to 256kByte. Specify "berkeley_db_read_buffer_size =
1048576" to get the old read buffer size.
Major changes with Postfix snapshot 1.1.8-20020505
==================================================
Friendlier behavior of Postfix transport tables. There is a new
"*" wildcard pattern that matches any domain. The meaning of a null
delivery transport or nexhop information field has changed to "do
not modify": use the information that would be used if the transport
table did not exist. This change makes it easier to route internal
mail (everything under my.domain) directly: you no longer need to
specify explicit "local" transport table entries for the local
machine. For more information, including examples, see the updated
transport(5) manual page.
Finer control over Berkeley DB memory usage, and more efficient
usage of memory in applications that open lots of tables. The
parameter "berkeley_db_create_buffer_size" (default: 16 MBytes)
specifies the buffer size for the postmap and postalias commands.
The parameter "berkeley_db_read_buffer_size" (default: 256 kBytes)
speficies the buffer size for all other applications. For more
information, see the last paragraphs of the DB_README file.
Major changes with Postfix snapshot 1.1.7-20020331
==================================================

View File

@ -267,7 +267,7 @@ myorigin = $myhostname
# policy: Send the postmaster a transcript of the entire SMTP session
# when a client request was rejected because of (UCE) policy.
# protocol: Send the postmaster a transcript of the entire SMTP
# session in case of client or server protocol errors.
# session in case of client or server protocol errors.
# resource: Inform the postmaster of mail not delivered due to
# resource problems.
# software: Inform the postmaster of mail not delivered due to

View File

@ -1,4 +1,3 @@
#
# TRANSPORT(5) TRANSPORT(5)
#
# NAME
@ -34,8 +33,7 @@
#
# pattern result
# When pattern matches the domain, use the corre-
# sponding result. A pattern of `*' matches all
# entries.
# sponding result.
#
# blank lines and comments
# Empty lines and whitespace-only lines are ignored,
@ -47,6 +45,22 @@
# line that starts with whitespace continues a logi-
# cal line.
#
# In an indexed file, a pattern of `*' matches everything.
#
# The result is of the form transport:nexthop. The trans-
# port field specifies a mail delivery transport such as
# smtp or local. The nexthop field specifies where and how
# to deliver mail. A null transport or nexthop field means
# "do not change": use the delivery transport and nexthop
# information that would be used if no match were found.
#
# 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-
# names.
#
# 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:
@ -62,53 +76,40 @@
# parent_domain_matches_subdomains configuration set-
# ting. Otherwise, a domain name matches itself and
# its subdomains.
#
# An empty result (`:' - default transport, default nexthop)
# behaves as though the transport map did not exist. When
# combined with a wildcard (`*') entry, this can be used to
# route internal mail directly, while using a relay for all
# outbound traffic. (Note that you should _NOT_ set
# relayhost in this case.)
#
# * smtp:outbound-relay.my.domain
# .my.domain :
#
# 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-
# tion, for example:
#
# hostname.my.domain local:
# localhost.my.domain local:
#
# 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-
# names.
#
# EXAMPLES
# In order to send mail for foo.org and its subdomains via
# In order to deliver internal mail directly, while using a
# mail relay for all other mail, specify a null entry for
# internal destinations (do not change the delivery trans-
# port or the nexthop information) and specify a wildcard
# for all other destinations. Note that for this trick to
# work you should not specify a relayhost in the main.cf
# file.
#
# my.domain :
# .my.domain :
# * smtp:outbound-relay.my.domain
#
# 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
# used, as specified via the default_transport configuration
# parameter. The following sends all mail for foo.org and
# its subdomains to host gateway.foo.org:
# When no transport is specified, Postfix uses either
# $local_transport or $default_transport, depending on
# whether the destination matches $mydestination. The fol-
# lowing sends all mail for foo.org and its subdomains to
# host gateway.foo.org:
#
# foo.org :[gateway.foo.org]
# .foo.org :[gateway.foo.org]
@ -169,13 +170,23 @@
#
# Other parameters of interest:
#
# local_transport
# The mail delivery transport to use when no trans-
# port is explicitly specified, and the destination
# matches $mydestination.
#
# default_transport
# The transport to use when no transport is explic-
# itly specified.
# The mail delivery transport to use when no trans-
# port is explicitly specified, and the destination
# does not match $mydestination.
#
# mydestination
# The destinations that are given to $local_transport
# by default.
#
# relayhost
# The default host to send to when no transport table
# entry matches.
# The default host for destinations that do not match
# $mydestination.
#
# SEE ALSO
# postmap(1) create mapping table
@ -193,5 +204,4 @@
# P.O. Box 704
# Yorktown Heights, NY 10598, USA
#
# 1
#
# TRANSPORT(5)

View File

@ -584,24 +584,23 @@ DNS lookups as well:
<p>
<li>In addition to the above you can configure Postfix to deliver
<li>Instead of the above you can configure Postfix to deliver
intranet mail directly instead of sending it via the intranet
mail gateway.
mail gateway. In this case, do not specify a relayhost!!
<p>
Specify routing information for the internal domain in the <a
href="transport.5.html">transport</a> table, and enable <a
Specify default routing information for the internal domain in the
<a href="transport.5.html">transport</a> table, and enable <a
href="transport.5.html">transport</a> table lookups.
<p>
<pre>
/etc/postfix/transport:
my.domain smtp:
.my.domain smtp:
thishost.my.domain local: !!!important!!!
localhost.my.domain local: !!!important!!!
my.domain :
.my.domain :
* smtp:gateway.my.domain
/etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport
@ -609,8 +608,8 @@ href="transport.5.html">transport</a> table lookups.
<p>
Important: do not omit the entries that deliver mail locally, or
else mail will bounce with a "mail loops to myself" condition.
Important: do not specify a relayhost entry, or else mail for
internal destinations will still be given to the relayhost.
<p>

View File

@ -136,6 +136,14 @@ POSTALIAS(1) POSTALIAS(1)
Default alias database type. On many UNIX systems,
the default type is either <b>dbm</b> or <b>hash</b>.
<b>berkeley</b><i>_</i><b>db</b><i>_</i><b>create</b><i>_</i><b>buffer</b><i>_</i><b>size</b>
Amount of buffer memory to be used when creating a
Berkeley DB <b>hash</b> or <b>btree</b> lookup table.
<b>berkeley</b><i>_</i><b>db</b><i>_</i><b>read</b><i>_</i><b>buffer</b><i>_</i><b>size</b>
Amount of buffer memory to be used when reading a
Berkeley DB <b>hash</b> or <b>btree</b> lookup table.
<b>STANDARDS</b>
<a href="http://www.faqs.org/rfcs/rfc822.html">RFC 822</a> (ARPA Internet Text Messages)

View File

@ -153,6 +153,14 @@ POSTMAP(1) POSTMAP(1)
tems, the default database type is either <b>hash</b> or
<b>dbm</b>.
<b>berkeley</b><i>_</i><b>db</b><i>_</i><b>create</b><i>_</i><b>buffer</b><i>_</i><b>size</b>
Amount of buffer memory to be used when creating a
Berkeley DB <b>hash</b> or <b>btree</b> lookup table.
<b>berkeley</b><i>_</i><b>db</b><i>_</i><b>read</b><i>_</i><b>buffer</b><i>_</i><b>size</b>
Amount of buffer memory to be used when reading a
Berkeley DB <b>hash</b> or <b>btree</b> lookup table.
<b>LICENSE</b>
The Secure Mailer license must be distributed with this
software.

View File

@ -1,5 +1,4 @@
<html> <head> </head> <body> <pre>
TRANSPORT(5) TRANSPORT(5)
<b>NAME</b>
@ -47,6 +46,22 @@ TRANSPORT(5) TRANSPORT(5)
line that starts with whitespace continues a logi-
cal line.
In an indexed file, a pattern of `<b>*</b>' matches everything.
The <i>result</i> is of the form <i>transport</i><b>:</b><i>nexthop</i>. The <i>trans-</i>
<i>port</i> field specifies a mail delivery transport such as
<b>smtp</b> or <b>local</b>. The <i>nexthop</i> field specifies where and how
to deliver mail. A null <i>transport</i> or <i>nexthop</i> field means
"do not change": use the delivery transport and nexthop
information that would be used if no match were found.
The interpretation of the <i>nexthop</i> field is transport
dependent. In the case of SMTP, specify <i>host</i>:<i>service</i> for a
non-default server port, and use [<i>host</i>] or [<i>host</i>]:<i>port</i> in
order to disable MX (mail exchanger) DNS lookups. The []
form can also be used with IP addresses instead of host-
names.
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:
@ -63,42 +78,39 @@ TRANSPORT(5) TRANSPORT(5)
ting. Otherwise, a domain name matches itself and
its subdomains.
Note: transport map entries take precedence over domains
specified in the <b>mydestination</b> parameter. If you use the
optional transport map, it may be safer to specify
explicit entries for all domains specified in <b>mydestina-</b>
<b>tion</b>, for example:
<b>hostname.my.domain</b> <b>local:</b>
<b>localhost.my.domain</b> <b>local:</b>
The interpretation of the <i>nexthop</i> field is transport
dependent. In the case of SMTP, specify <i>host</i>:<i>service</i> for a
non-default server port, and use [<i>host</i>] or [<i>host</i>]:<i>port</i> in
order to disable MX (mail exchanger) DNS lookups. The []
form can also be used with IP addresses instead of host-
names.
<b>EXAMPLES</b>
In order to send mail for <b>foo.org</b> and its subdomains via
In order to deliver internal mail directly, while using a
mail relay for all other mail, specify a null entry for
internal destinations (do not change the delivery trans-
port or the nexthop information) and specify a wildcard
for all other destinations. Note that for this trick to
work you should not specify a <b>relayhost</b> in the <b>main.cf</b>
file.
<b>my.domain</b> <b>:</b>
<b>.my.domain</b> <b>:</b>
<b>*</b> <b>smtp:outbound-relay.my.domain</b>
In order to send mail for <b>foo.org</b> and its subdomains via
the <b>uucp</b> transport to the UUCP host named <b>foo</b>:
<b>foo.org</b> <b>uucp:foo</b>
<b>.foo.org</b> <b>uucp:foo</b>
When no <i>nexthop</i> host name is specified, the destination
domain name is used instead. For example, the following
directs mail for <i>user</i>@<b>foo.org</b> via the <b>slow</b> transport to a
mail exchanger for <b>foo.org</b>. The <b>slow</b> transport could be
something that runs at most one delivery process at a
When no <i>nexthop</i> host name is specified, the destination
domain name is used instead. For example, the following
directs mail for <i>user</i>@<b>foo.org</b> via the <b>slow</b> transport to a
mail exchanger for <b>foo.org</b>. The <b>slow</b> transport could be
something that runs at most one delivery process at a
time:
<b>foo.org</b> <b>slow:</b>
When no <i>transport</i> is specified, the default transport is
used, as specified via the <b>default</b><i>_</i><b>transport</b> configuration
parameter. The following sends all mail for <b>foo.org</b> and
its subdomains to host <b>gateway.foo.org</b>:
When no <i>transport</i> is specified, Postfix uses either
<b>$local</b><i>_</i><b>transport</b> or <b>$default</b><i>_</i><b>transport</b>, depending on
whether the destination matches <b>$mydestination</b>. The fol-
lowing sends all mail for <b>foo.org</b> and its subdomains to
host <b>gateway.foo.org</b>:
<b>foo.org</b> <b>:[gateway.foo.org]</b>
<b>.foo.org</b> <b>:[gateway.foo.org]</b>
@ -159,13 +171,23 @@ TRANSPORT(5) TRANSPORT(5)
Other parameters of interest:
<b>local</b><i>_</i><b>transport</b>
The mail delivery transport to use when no trans-
port is explicitly specified, and the destination
matches <b>$mydestination</b>.
<b>default</b><i>_</i><b>transport</b>
The transport to use when no transport is explic-
itly specified.
The mail delivery transport to use when no trans-
port is explicitly specified, and the destination
does not match <b>$mydestination</b>.
<b>mydestination</b>
The destinations that are given to <b>$local</b><i>_</i><b>transport</b>
by default.
<b>relayhost</b>
The default host to send to when no transport table
entry matches.
The default host for destinations that do not match
<b>$mydestination</b>.
<b>SEE</b> <b>ALSO</b>
<a href="postmap.1.html">postmap(1)</a> create mapping table
@ -183,6 +205,5 @@ TRANSPORT(5) TRANSPORT(5)
P.O. Box 704
Yorktown Heights, NY 10598, USA
1
TRANSPORT(5)
</pre> </body> </html>

View File

@ -128,6 +128,12 @@ and for default values.
.IP \fBdatabase_type\fR
Default alias database type. On many UNIX systems, the default type
is either \fBdbm\fR or \fBhash\fR.
.IP \fBberkeley_db_create_buffer_size\fR
Amount of buffer memory to be used when creating a Berkeley DB
\fBhash\fR or \fBbtree\fR lookup table.
.IP \fBberkeley_db_read_buffer_size\fR
Amount of buffer memory to be used when reading a Berkeley DB
\fBhash\fR or \fBbtree\fR lookup table.
.SH STANDARDS
.na
.nf

View File

@ -146,6 +146,12 @@ Enable verbose logging for debugging purposes.
Default output database type.
On many UNIX systems, the default database type is either \fBhash\fR
or \fBdbm\fR.
.IP \fBberkeley_db_create_buffer_size\fR
Amount of buffer memory to be used when creating a Berkeley DB
\fBhash\fR or \fBbtree\fR lookup table.
.IP \fBberkeley_db_read_buffer_size\fR
Amount of buffer memory to be used when reading a Berkeley DB
\fBhash\fR or \fBbtree\fR lookup table.
.SH LICENSE
.na
.nf

View File

@ -45,6 +45,22 @@ are lines whose first non-whitespace character is a `#'.
A logical line starts with non-whitespace text. A line that
starts with whitespace continues a logical line.
.PP
In an indexed file, a pattern of `\fB*\fR' matches everything.
.PP
The \fIresult\fR is of the form \fItransport\fB:\fInexthop\fR.
The \fItransport\fR field specifies a mail delivery transport
such as \fBsmtp\fR or \fBlocal\fR. The \fInexthop\fR field
specifies where and how to deliver mail. A null \fItransport\fR
or \fInexthop\fR field means "do not change": use the delivery
transport and nexthop information that would be used if no
match were found.
.PP
The interpretation of the \fInexthop\fR field is transport
dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a
non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR
in order to disable MX (mail exchanger) DNS lookups. The [] form
can also be used with IP addresses instead of hostnames.
.PP
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:
@ -57,28 +73,25 @@ Mail for any subdomain of \fIdomain\fR is delivered through
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
the optional transport map, it may be safer to specify explicit
entries for all domains specified in \fBmydestination\fR,
for example:
.ti +5
\fBhostname.my.domain local:\fR
.ti +5
\fBlocalhost.my.domain local:\fR
The interpretation of the \fInexthop\fR field is transport
dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a
non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR
in order to disable MX (mail exchanger) DNS lookups. The [] form
can also be used with IP addresses instead of hostnames.
.SH EXAMPLES
.na
.nf
.ad
.fi
In order to deliver internal mail directly, while using a
mail relay for all other mail, specify a null entry for
internal destinations (do not change the delivery transport or
the nexthop information) and specify a wildcard for all other
destinations. Note that for this trick to work you should
not specify a \fBrelayhost\fR in the \fBmain.cf\fR file.
.ti +5
\fB\&my.domain :\fR
.ti +5
\fB\&.my.domain :\fR
.ti +5
\fB* smtp:outbound-relay.my.domain\fR
In order to send mail for \fBfoo.org\fR and its subdomains
via the \fBuucp\fR transport to the UUCP host named \fBfoo\fR:
@ -96,9 +109,10 @@ something that runs at most one delivery process at a time:
.ti +5
\fBfoo.org slow:\fR
When no \fItransport\fR is specified, the default transport is
used, as specified via the \fBdefault_transport\fR configuration
parameter. The following sends all mail for \fBfoo.org\fR and its
When no \fItransport\fR is specified, Postfix uses either
\fB$local_transport\fR or \fB$default_transport\fR, depending
on whether the destination matches \fB$mydestination\fR.
The following sends all mail for \fBfoo.org\fR and its
subdomains to host \fBgateway.foo.org\fR:
.ti +5
@ -163,10 +177,18 @@ requiring \fI.domain.name\fR patterns).
List of transport lookup tables.
.PP
Other parameters of interest:
.IP \fBlocal_transport\fR
The mail delivery transport to use when no transport is explicitly
specified, and the destination matches \fB$mydestination\fR.
.IP \fBdefault_transport\fR
The transport to use when no transport is explicitly specified.
The mail delivery transport to use when no transport is explicitly
specified, and the destination does not match \fB$mydestination\fR.
.IP \fBmydestination\fR
The destinations that are given to \fB$local_transport\fR
by default.
.IP \fBrelayhost\fR
The default host to send to when no transport table entry matches.
The default host for destinations that do not match
\fB$mydestination\fR.
.SH SEE ALSO
.na
.nf

View File

@ -29,7 +29,7 @@
# The format of the transport table is as follows:
# .IP "\fIpattern result\fR"
# When \fIpattern\fR matches the domain, use the corresponding
# \fIresult\fR.
# \fIresult\fR.
# .IP "blank lines and comments"
# Empty lines and whitespace-only lines are ignored, as
# are lines whose first non-whitespace character is a `#'.
@ -37,6 +37,22 @@
# A logical line starts with non-whitespace text. A line that
# starts with whitespace continues a logical line.
# .PP
# In an indexed file, a pattern of `\fB*\fR' matches everything.
# .PP
# The \fIresult\fR is of the form \fItransport\fB:\fInexthop\fR.
# The \fItransport\fR field specifies a mail delivery transport
# such as \fBsmtp\fR or \fBlocal\fR. The \fInexthop\fR field
# specifies where and how to deliver mail. A null \fItransport\fR
# or \fInexthop\fR field means "do not change": use the delivery
# transport and nexthop information that would be used if no
# match were found.
# .PP
# The interpretation of the \fInexthop\fR field is transport
# dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a
# non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR
# in order to disable MX (mail exchanger) DNS lookups. The [] form
# can also be used with IP addresses instead of hostnames.
# .PP
# 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:
@ -49,26 +65,23 @@
# 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
# the optional transport map, it may be safer to specify explicit
# entries for all domains specified in \fBmydestination\fR,
# for example:
#
# .ti +5
# \fBhostname.my.domain local:\fR
# .ti +5
# \fBlocalhost.my.domain local:\fR
#
# The interpretation of the \fInexthop\fR field is transport
# dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a
# non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR
# in order to disable MX (mail exchanger) DNS lookups. The [] form
# can also be used with IP addresses instead of hostnames.
# EXAMPLES
# .ad
# .fi
# In order to deliver internal mail directly, while using a
# mail relay for all other mail, specify a null entry for
# internal destinations (do not change the delivery transport or
# the nexthop information) and specify a wildcard for all other
# destinations. Note that for this trick to work you should
# not specify a \fBrelayhost\fR in the \fBmain.cf\fR file.
#
# .ti +5
# \fB\&my.domain :\fR
# .ti +5
# \fB\&.my.domain :\fR
# .ti +5
# \fB* smtp:outbound-relay.my.domain\fR
#
# In order to send mail for \fBfoo.org\fR and its subdomains
# via the \fBuucp\fR transport to the UUCP host named \fBfoo\fR:
#
@ -86,9 +99,10 @@
# .ti +5
# \fBfoo.org slow:\fR
#
# When no \fItransport\fR is specified, the default transport is
# used, as specified via the \fBdefault_transport\fR configuration
# parameter. The following sends all mail for \fBfoo.org\fR and its
# When no \fItransport\fR is specified, Postfix uses either
# \fB$local_transport\fR or \fB$default_transport\fR, depending
# on whether the destination matches \fB$mydestination\fR.
# The following sends all mail for \fBfoo.org\fR and its
# subdomains to host \fBgateway.foo.org\fR:
#
# .ti +5
@ -149,10 +163,18 @@
# List of transport lookup tables.
# .PP
# Other parameters of interest:
# .IP \fBlocal_transport\fR
# The mail delivery transport to use when no transport is explicitly
# specified, and the destination matches \fB$mydestination\fR.
# .IP \fBdefault_transport\fR
# The transport to use when no transport is explicitly specified.
# The mail delivery transport to use when no transport is explicitly
# specified, and the destination does not match \fB$mydestination\fR.
# .IP \fBmydestination\fR
# The destinations that are given to \fB$local_transport\fR
# by default.
# .IP \fBrelayhost\fR
# The default host to send to when no transport table entry matches.
# The default host for destinations that do not match
# \fB$mydestination\fR.
# SEE ALSO
# postmap(1) create mapping table
# trivial-rewrite(8) rewrite and resolve addresses

View File

@ -85,6 +85,8 @@
/* char *var_showq_service;
/* char *var_error_service;
/* char *var_flush_service;
/* int var_db_create_buf;
/* int var_db_read_buf;
/*
/* void mail_params_init()
/* DESCRIPTION
@ -131,6 +133,9 @@
#include <valid_hostname.h>
#include <stringops.h>
#include <safe.h>
#ifdef HAS_DB
#include <dict_db.h>
#endif
/* Global library. */
@ -223,6 +228,8 @@ char *var_rewrite_service;
char *var_showq_service;
char *var_error_service;
char *var_flush_service;
int var_db_create_buf;
int var_db_read_buf;
#define MAIN_CONF_FILE "main.cf"
@ -456,6 +463,8 @@ void mail_params_init()
VAR_FLOCK_TRIES, DEF_FLOCK_TRIES, &var_flock_tries, 1, 0,
VAR_DEBUG_PEER_LEVEL, DEF_DEBUG_PEER_LEVEL, &var_debug_peer_level, 1, 0,
VAR_FAULT_INJ_CODE, DEF_FAULT_INJ_CODE, &var_fault_inj_code, 0, 0,
VAR_DB_CREATE_BUF, DEF_DB_CREATE_BUF, &var_db_create_buf, 1, 0,
VAR_DB_READ_BUF, DEF_DB_READ_BUF, &var_db_read_buf, 1, 0,
0,
};
static CONFIG_TIME_TABLE time_defaults[] = {
@ -515,6 +524,9 @@ void mail_params_init()
check_mail_owner();
check_sgid_group();
check_overlap();
#ifdef HAS_DB
dict_db_mpool_size = var_db_read_buf;
#endif
/*
* Variables whose defaults are determined at runtime, after other

View File

@ -1475,6 +1475,17 @@ extern char *var_mbx_defer_errs;
#define DEF_MDR_DEFER_ERRS "enospc, estale"
extern char *var_mdr_defer_errs;
/*
* Berkeley DB memory pool sizes.
*/
#define VAR_DB_CREATE_BUF "berkeley_db_create_buffer_size"
#define DEF_DB_CREATE_BUF (16 * 1024 *1024)
extern int var_db_create_buf;
#define VAR_DB_READ_BUF "berkeley_db_read_buffer_size"
#define DEF_DB_READ_BUF (256 *1024)
extern int var_db_read_buf;
/* LICENSE
/* .ad
/* .fi

View File

@ -20,10 +20,10 @@
* Patches change the patchlevel and the release date. Snapshots change the
* release date only, unless they include the same bugfix as a patch release.
*/
#define MAIL_RELEASE_DATE "20020501"
#define MAIL_RELEASE_DATE "20020505"
#define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "1.1.7-" MAIL_RELEASE_DATE
#define DEF_MAIL_VERSION "1.1.8-" MAIL_RELEASE_DATE
extern char *var_mail_version;
/*

View File

@ -37,10 +37,6 @@
#include <sys_defs.h>
/* Global library. */
#include "mail_conf.h"
/* Utility library. */
#include <msg.h>
@ -49,6 +45,10 @@
#include <dict.h>
#include <dict_db.h>
/* Global library. */
#include <mail_params.h>
/* Application-specific. */
#include "mkmap.h"
@ -62,30 +62,29 @@
/* mkmap_db_open - create or open database */
/*
* db_mpool_size" is defined in util/dict_db.c and defaults to 256K,
* which works well for the lookup code.
*
* We use a larger memory pool when building ".db" files.
* For "hash" files performance degrades rapidly unless the memory pool
* is O(file size).
*
* For "btree" files peformance is good with sorted input even for small
* memory pools, but with random input degrades rapidly unless the memory
* pool is O(file size).
*/
extern int db_mpool_size;
#define VAR_MPOOL_SIZE "db_mkmap_mpool_size"
#define DEF_MPOOL_SIZE 16777216 /* 16MB */
static MKMAP *mkmap_db_open(const char *path,
DICT *(*db_open) (const char *, int, int))
{
MKMAP *mkmap = (MKMAP *) mymalloc(sizeof(*mkmap));
/* Override default mpool size for map rebuilds */
db_mpool_size = get_mail_conf_int(VAR_MPOOL_SIZE, DEF_MPOOL_SIZE, 0, 0);
/*
* Override the default mpool size for map (re)builds.
*
* db_mpool_size" is defined in util/dict_db.c and defaults to 256K, which
* works well for the lookup code.
*
* We use a larger memory pool when building ".db" files. For "hash" files
* performance degrades rapidly unless the memory pool is O(file size).
*
* For "btree" files peformance is good with sorted input even for small
* memory pools, but with random input degrades rapidly unless the memory
* pool is O(file size).
*
* XXX This should be specified via the DICT interface so that the buffer
* size becomes an object property, instead of being specified by poking
* a global variable so that it becomes a class property.
*/
dict_db_mpool_size = var_db_create_buf;
/*
* Fill in the generic members.

View File

@ -572,21 +572,21 @@ static void get_service_attr(PIPE_ATTR *attr, char **argv)
case 'B':
attr->flags |= MAIL_COPY_BLANK;
break;
case 'D':
attr->flags |= MAIL_COPY_DELIVERED;
break;
case 'F':
attr->flags |= MAIL_COPY_FROM;
break;
case 'R':
attr->flags |= MAIL_COPY_RETURN_PATH;
break;
case '.':
attr->flags |= MAIL_COPY_DOT;
break;
case '>':
attr->flags |= MAIL_COPY_QUOTE;
break;
case 'R':
attr->flags |= MAIL_COPY_RETURN_PATH;
break;
case 'D':
attr->flags |= MAIL_COPY_DELIVERED;
break;
case 'h':
attr->flags |= PIPE_OPT_FOLD_HOST;
break;

View File

@ -116,6 +116,12 @@
/* .IP \fBdatabase_type\fR
/* Default alias database type. On many UNIX systems, the default type
/* is either \fBdbm\fR or \fBhash\fR.
/* .IP \fBberkeley_db_create_buffer_size\fR
/* Amount of buffer memory to be used when creating a Berkeley DB
/* \fBhash\fR or \fBbtree\fR lookup table.
/* .IP \fBberkeley_db_read_buffer_size\fR
/* Amount of buffer memory to be used when reading a Berkeley DB
/* \fBhash\fR or \fBbtree\fR lookup table.
/* STANDARDS
/* RFC 822 (ARPA Internet Text Messages)
/* SEE ALSO

View File

@ -134,6 +134,12 @@
/* Default output database type.
/* On many UNIX systems, the default database type is either \fBhash\fR
/* or \fBdbm\fR.
/* .IP \fBberkeley_db_create_buffer_size\fR
/* Amount of buffer memory to be used when creating a Berkeley DB
/* \fBhash\fR or \fBbtree\fR lookup table.
/* .IP \fBberkeley_db_read_buffer_size\fR
/* Amount of buffer memory to be used when reading a Berkeley DB
/* \fBhash\fR or \fBbtree\fR lookup table.
/* LICENSE
/* .ad
/* .fi

View File

@ -188,7 +188,7 @@ static void show_queue(void)
* Don't assume that the mail system is down when the user has
* insufficient permission to access the showq socket.
*/
else if (errno != ECONNREFUSED && errno != ENOENT) {
else if (errno == EACCES) {
msg_fatal_status(EX_SOFTWARE,
"Connect to the %s %s service: %m",
var_mail_name, var_showq_service);

View File

@ -188,24 +188,12 @@ void resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop,
}
tok822_internalize(nextrcpt, tree, TOK822_STR_DEFL);
/*
* The transport map overrides any transport and next-hop host info that
* is set up below. For a long time, it was not possible to override
* routing of mail that resolves locally, because Postfix used a
* zero-length next-hop hostname result to indicate local delivery, and
* transport maps cannot return zero-length hostnames.
*/
if (*var_transport_maps
&& transport_lookup(strrchr(STR(nextrcpt), '@') + 1, channel, nexthop)) {
/* void */ ;
}
/*
* Non-local delivery, presumably. Set up the default remote transport
* specified with var_def_transport. Use the destination's mail exchanger
* unless a default mail relay is specified with var_relayhost.
*/
else if (domain != 0) {
if (domain != 0) {
vstring_strcpy(channel, var_def_transport);
if ((destination = split_at(STR(channel), ':')) != 0 && *destination)
vstring_strcpy(nexthop, destination);
@ -235,6 +223,16 @@ void resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop,
if (*STR(nexthop) == 0)
msg_panic("%s: null nexthop", myname);
/*
* The transport map overrides any transport and next-hop host info that
* is set up above. For a long time, it was not possible to override
* routing of mail that resolves locally, because Postfix used a
* zero-length next-hop hostname result to indicate local delivery, and
* transport maps cannot return zero-length hostnames.
*/
if (*var_transport_maps)
transport_lookup(strrchr(STR(nextrcpt), '@') + 1, channel, nexthop);
/*
* Clean up.
*/

View File

@ -85,17 +85,22 @@ void transport_init(void)
}
/* transport_wildcard_init - post-jail initialization */
void transport_wildcard_init(void)
{
wildcard_channel = vstring_alloc(10);
wildcard_nexthop = vstring_alloc(10);
if (!transport_lookup("*", wildcard_channel, wildcard_nexthop)) {
vstring_free(wildcard_channel);
vstring_free(wildcard_nexthop);
}
if (msg_verbose) {
msg_info("wildcard_{chan,hop}={%s %s}",
if (transport_lookup("*", wildcard_channel, wildcard_nexthop)) {
if (msg_verbose)
msg_info("wildcard_{chan:hop}={%s:%s}",
vstring_str(wildcard_channel), vstring_str(wildcard_nexthop));
} else {
vstring_free(wildcard_channel);
wildcard_channel = 0;
vstring_free(wildcard_nexthop);
wildcard_nexthop = 0;
}
}
@ -111,7 +116,6 @@ int transport_lookup(const char *domain, VSTRING *channel, VSTRING *nexthop)
char *saved_value;
char *transport;
int found = 0;
int null_found = 0;
#define FULL 0
#define PARTIAL DICT_FLAG_FIXED
@ -123,9 +127,12 @@ int transport_lookup(const char *domain, VSTRING *channel, VSTRING *nexthop)
/*
* Keep stripping domain components until nothing is left or until a
* matching entry is found. If a NULL entry (either no RHS, or ':'),
* then pretend we got no match, and return. If we really got no match,
* then return the wildcard transport, if any.
* matching entry is found.
*
* If the entry specifies no nexthop host and/or delivery channel, do not
* change caller-provided information.
*
* If we find no match, then return the wildcard entry, if any.
*
* After checking the full name, check for .upper.domain, to distinguish
* between the upper domain and it's decendants, ala sendmail and tcp
@ -140,22 +147,10 @@ int transport_lookup(const char *domain, VSTRING *channel, VSTRING *nexthop)
for (name = low_domain; /* void */ ; name = next) {
if ((value = maps_find(transport_path, name, maps_flag)) != 0) {
saved_value = mystrdup(value);
if ((host = split_at(saved_value, ':')) == 0 || *host == 0) {
if (*saved_value == 0) {
myfree(saved_value);
null_found = 1;
break;
}
host = domain;
}
if (*(transport = saved_value) == 0)
transport = var_def_transport;
vstring_strcpy(channel, transport);
(void) split_at(vstring_str(channel), ':');
if (*vstring_str(channel) == 0)
msg_fatal("null transport is not allowed: %s = %s",
VAR_DEF_TRANSPORT, var_def_transport);
vstring_strcpy(nexthop, host);
if ((host = split_at(saved_value, ':')) != 0 && *host != 0)
vstring_strcpy(nexthop, host);
if (*(transport = saved_value) != 0)
vstring_strcpy(channel, transport);
myfree(saved_value);
found = 1;
break;
@ -170,12 +165,14 @@ int transport_lookup(const char *domain, VSTRING *channel, VSTRING *nexthop)
}
myfree(low_domain);
if (wildcard_channel && !null_found) {
vstring_strcpy(channel, vstring_str(wildcard_channel));
if (vstring_str(wildcard_nexthop))
/*
* Fall back to the wild-card entry.
*/
if (found == 0 && wildcard_channel) {
if (*vstring_str(wildcard_channel))
vstring_strcpy(channel, vstring_str(wildcard_channel));
if (*vstring_str(wildcard_nexthop))
vstring_strcpy(nexthop, vstring_str(wildcard_nexthop));
else
vstring_strcpy(nexthop, domain);
found = 1;
}
return (found);

View File

@ -6,6 +6,8 @@
/* SYNOPSIS
/* #include <dict_db.h>
/*
/* int dict_db_mpool_size;
/*
/* DICT *dict_hash_open(path, open_flags, dict_flags)
/* const char *path;
/* int open_flags;
@ -20,6 +22,11 @@
/* a pointer to a structure that can be used to access the dictionary
/* using the generic methods documented in dict_open(3).
/*
/* The dict_db_mpool_size variable specifies a non-default I/O buffer
/* size. The default buffer size is adequate for reading. For better
/* performance while creating a large table, specify a large buffer size
/* before opening the file.
/*
/* Arguments:
/* .IP path
/* The database pathname, not including the ".db" suffix.
@ -105,16 +112,16 @@ typedef struct {
} DICT_DB;
/*
* db_mpool_size is initialized when the first database is opened. The
* parameter can be preempted by setting db_mpool_size != 0 before calling
* dict_hash_open() or dict_btree_open(). This is done in mkmap_db_open()
* via "db_mkmap_mpool_size" to set a larger memory pool for database
* rebuilds.
* You can override the default dict_db_mpool_size setting before calling
* dict_hash_open() or dict_btree_open(). This is done in mkmap_db_open() to
* set a larger memory pool for database (re)builds.
*
* XXX This should be specified via the DICT interface so that it becomes an
* object property, instead of being specified by poking a global variable
* so that it becomes a class property.
*/
#define VAR_MPOOL_SIZE "db_mpool_size"
#define DEF_MPOOL_SIZE 262144 /* 256K default memory pool */
#define DICT_DB_NELM 4096
int db_mpool_size;
int dict_db_mpool_size = (256 * 1024); /* 256K default memory pool */
#if DB_VERSION_MAJOR > 1
@ -152,6 +159,8 @@ static int sanitize(int status)
static DB_ENV *dict_db_env;
static int dict_db_refcount;
/* dict_db_env_alloc - allocate shared environment */
static int dict_db_env_alloc(DB_ENV ** env)
{
int err;
@ -164,19 +173,19 @@ static int dict_db_env_alloc(DB_ENV ** env)
if (dict_db_env != 0) {
++dict_db_refcount;
*env = dict_db_env;
return 0;
return (0);
}
#if DB_VERSION_MAJOR == 2
#define DICT_DB_ENV_FLAGS (DB_CREATE|DB_INIT_MPOOL|DB_MPOOL_PRIVATE)
dict_db_env = (DB_ENV *) mymalloc(sizeof(DB_ENV));
memset((char *) dict_db_env, 0, sizeof(DB_ENV));
dict_db_env->mp_size = db_mpool_size;
dict_db_env->mp_size = dict_db_mpool_size;
if ((err = db_appinit(0, 0, dict_db_env, DICT_DB_ENV_FLAGS)) != 0) {
myfree((char *) dict_db_env);
dict_db_env = 0;
return err;
return (err);
}
#endif /* DB_VERSION_MAJOR == 2 */
@ -185,7 +194,7 @@ static int dict_db_env_alloc(DB_ENV ** env)
err = db_env_create(&dict_db_env, 0);
if (err == 0)
err = dict_db_env->set_cachesize(dict_db_env, 0, db_mpool_size, 1);
err = dict_db_env->set_cachesize(dict_db_env, 0, dict_db_mpool_size, 1);
if (err == 0)
err = dict_db_env->open(dict_db_env, 0, DICT_DB_ENV_FLAGS, 0644);
@ -193,13 +202,13 @@ static int dict_db_env_alloc(DB_ENV ** env)
if (dict_db_env)
dict_db_env->close(dict_db_env, 0);
dict_db_env = 0;
return err;
return (err);
}
#endif /* DB_VERSION_MAJOR > 2 */
++dict_db_refcount;
*env = dict_db_env;
return 0;
return (0);
}
static void dict_db_env_free(void)
@ -213,6 +222,7 @@ static void dict_db_env_free(void)
#if DB_VERSION_MAJOR == 2
if (dict_db_env && dict_db_refcount > 0 && --dict_db_refcount == 0) {
db_appexit(dict_db_env);
myfree((char *) dict_db_env);
dict_db_env = 0;
}
#endif
@ -667,31 +677,21 @@ DICT *dict_hash_open(const char *path, int open_flags, int dict_flags)
#if DB_VERSION_MAJOR < 2
HASHINFO tweak;
memset((char *) &tweak, 0, sizeof(tweak));
tweak.nelem = DICT_DB_NELM;
tweak.cachesize = dict_db_mpool_size;
#endif
#if DB_VERSION_MAJOR == 2
DB_INFO tweak;
memset((char *) &tweak, 0, sizeof(tweak));
tweak.h_nelem = DICT_DB_NELM;
#endif
#if DB_VERSION_MAJOR > 2
void *tweak;
tweak = 0;
#endif
/* Set the mpool size if not already set in mkmap_db_open() */
if (db_mpool_size == 0)
db_mpool_size = get_mail_conf_int(VAR_MPOOL_SIZE, DEF_MPOOL_SIZE, 0, 0);
memset((char *) &tweak, 0, sizeof(tweak));
#if DB_VERSION_MAJOR < 2
tweak.nelem = DICT_DB_NELM;
tweak.cachesize = db_mpool_size;
#endif
#if DB_VERSION_MAJOR == 2
tweak.h_nelem = DICT_DB_NELM;
tweak.db_cachesize = 0;
#endif
return (dict_db_open(DICT_TYPE_HASH, path, open_flags, DB_HASH,
(void *) &tweak, dict_flags));
}
@ -703,24 +703,18 @@ DICT *dict_btree_open(const char *path, int open_flags, int dict_flags)
#if DB_VERSION_MAJOR < 2
BTREEINFO tweak;
memset((char *) &tweak, 0, sizeof(tweak));
tweak.cachesize = dict_db_mpool_size;
#endif
#if DB_VERSION_MAJOR == 2
DB_INFO tweak;
memset((char *) &tweak, 0, sizeof(tweak));
#endif
#if DB_VERSION_MAJOR > 2
void *tweak;
#endif
/* Set the mpool size if not already set in mkmap_db_open() */
if (db_mpool_size == 0)
db_mpool_size = get_mail_conf_int(VAR_MPOOL_SIZE, DEF_MPOOL_SIZE, 0, 0);
memset((char *) &tweak, 0, sizeof(tweak));
#if DB_VERSION_MAJOR < 2
tweak.cachesize = db_mpool_size;
tweak = 0;
#endif
return (dict_db_open(DICT_TYPE_BTREE, path, open_flags, DB_BTREE,

View File

@ -25,6 +25,11 @@
extern DICT *dict_hash_open(const char *, int, int);
extern DICT *dict_btree_open(const char *, int, int);
/*
* XXX Should be part of the DICT interface.
*/
extern int dict_db_mpool_size;
/* LICENSE
/* .ad
/* .fi