Workaround: don't abort when IPv6 is present but busted.
File: util/inet_proto.c.
- Portability: Dovecot now officially supports more socket
- types for its authentication server. File:
+ Portability: the Dovecot 2.0 authentication server supports
+ more socket types for its authentication server. File:
xsasl/xsasl_dovecot_server.c.
+
+ Documentation: the Dovecot 2.0 authentication server supports
+ communication over TCP sockets. Patrick Ben Koetter. File:
+ proto/SASL_README.html.
+
+20111118
+
+ Cleanup: "postconf -M" now supports filtering. For example,
+ "postconf -M inet" shows only services that listen on the
+ network, and "postconf -M smtp.unix" shows the SMTP delivery
+ agent. File: postconf.c.
P\bPo\bos\bst\btf\bfi\bix\bx t\bto\bo D\bDo\bov\bve\bec\bco\bot\bt S\bSA\bAS\bSL\bL c\bco\bom\bmm\bmu\bun\bni\bic\bca\bat\bti\bio\bon\bn
Communication between the Postfix SMTP server and Dovecot SASL happens via a
-UNIX-domain socket. The socket pathname and the list of mechanisms offered to
-Postfix need to be specified on the Dovecot server side in dovecot.conf.
+UNIX-domain socket. Additionally, when using Dovecot version 2.0 and later,
+communication can take place over a TCP socket.
+
+U\bUN\bNI\bIX\bX-\b-d\bdo\bom\bma\bai\bin\bn s\bso\boc\bck\bke\bet\bt c\bco\bom\bmm\bmu\bun\bni\bic\bca\bat\bti\bio\bon\bn
+
+The socket pathname and the list of mechanisms offered to Postfix need to be
+specified on the Dovecot server side in dovecot.conf.
The following example assumes that the Postfix queue is under /var/spool/
postfix/.
Proceed with the section "Enabling SASL authentication and authorization in the
Postfix SMTP server" to turn on and use SASL in the Postfix SMTP server.
+T\bTC\bCP\bP s\bso\boc\bck\bke\bet\bt c\bco\bom\bmm\bmu\bun\bni\bic\bca\bat\bti\bio\bon\bn
+
+The TCP port and the list of mechanisms offered to Postfix need to be specified
+on the Dovecot server side in 10-auth.conf and 10-master.conf.
+
+The following examples assume that Postfix should communicate with Dovecot on
+TCP port 12345.
+
+ 1 /etc/dovecot/conf.d/10-auth.conf:
+ 2 auth_mechanisms = plain login
+
+Line 2 provides plain and login as mechanisms for the Postfix SMTP server.
+
+ 1 /etc/dovecot/conf.d/10-master.conf:
+ 2 service auth {
+ 3 unix_listener auth-userdb {
+ 4 }
+ 5 inet_listener {
+ 6 port = 12345
+ 7 }
+ 8 }
+
+Line 5 creates a new TCP socket and line 6 specifies port 12345 where Dovecot
+SASL should wait for Postfix authentication requests.
+
+Proceed with the section "Enabling SASL authentication and authorization in the
+Postfix SMTP server" to turn on and use SASL in the Postfix SMTP server.
+
C\bCo\bon\bnf\bfi\big\bgu\bur\bri\bin\bng\bg C\bCy\byr\bru\bus\bs S\bSA\bAS\bSL\bL
The Cyrus SASL framework supports a wide variety of applications (POP, IMAP,
/etc/postfix/main.cf:
smtpd_sasl_type = dovecot
-Additionally set the path where the Postfix SMTP server can find the Dovecot
-SASL socket:
+Additionally specify how Postfix SMTP server can find the Dovecot
+authentication server. This depends on the settings that you have selected in
+the section "Postfix to Dovecot SASL communication".
+
+ * If you configured Dovecot for UNIX-domain socket communication, configure
+ Postfix as follows:
/etc/postfix/main.cf:
smtpd_sasl_path = private/auth
N\bNo\bot\bte\be
-
This example uses a pathname relative to the Postfix queue directory, so
that it will work whether or not the Postfix SMTP server runs chrooted.
+ * If you configured Dovecot for TCP socket communication, configure Postfix
+ as follows (if Dovecot runs on a different machine, replace 127.0.0.1 by
+ that machine's IP address):
+
+ /etc/postfix/main.cf:
+ smtpd_sasl_path = inet:127.0.0.1:12345
+
E\bEn\bna\bab\bbl\bli\bin\bng\bg S\bSA\bAS\bSL\bL a\bau\but\bth\bhe\ben\bnt\bti\bic\bca\bat\bti\bio\bon\bn i\bin\bn t\bth\bhe\be P\bPo\bos\bst\btf\bfi\bix\bx S\bSM\bMT\bTP\bP s\bse\ber\brv\bve\ber\br
Regardless of the SASL implementation type, enabling SMTP authentication in the
If you upgrade from Postfix 2.7 or earlier, read RELEASE_NOTES-2.8
before proceeding.
+Major changes with snapshot 20111118
+====================================
+
+The "postconf -M" (display master.cf) command now supports filtering.
+For example, specify "postconf -M inet" to display only services
+that listen on the network.
+
Incompatible changes with snapshot 20111113
===========================================
Things to do after the stable release:
- postconf: add test cases for unused name=value entries in
- main.cf and master.cf; add support for per-service parameter
- name spaces in master.cf.
-
TLS_README has the priorities reversed. The section about
SMTP client settings begins with an exposition about client
certificates, which almost no-one needs. Instead, the text
<h4><a name="server_dovecot_comm">Postfix to Dovecot SASL communication</a></h4>
<p> Communication between the Postfix SMTP server
-and Dovecot SASL happens via a UNIX-domain socket. The socket
+and Dovecot SASL happens via a UNIX-domain socket. Additionally,
+when using Dovecot version 2.0 and later, communication can take
+place over a TCP socket.
+
+<h5>UNIX-domain socket communication</h5>
+
+<p> The socket
pathname and the list of mechanisms offered to Postfix need to be
specified on the Dovecot server side in <code>dovecot.conf</code>.
</p>
SASL authentication and authorization in the Postfix SMTP server</a>"
to turn on and use SASL in the Postfix SMTP server. </p>
+<h5>TCP socket communication</h5>
+
+<p> The TCP port and the list of mechanisms offered to Postfix need
+to be specified on the Dovecot server side in <code>10-auth.conf</code>
+and <code>10-master.conf</code>. </p>
+
+<p> The following examples assume that Postfix should communicate
+with Dovecot on TCP port 12345. </p>
+
+<blockquote>
+<pre>
+1 /etc/dovecot/conf.d/10-auth.conf:
+2 auth_mechanisms = plain login
+</pre>
+</blockquote>
+
+<p> Line 2 provides plain and login as mechanisms for the Postfix
+SMTP server. </p>
+
+<blockquote>
+<pre>
+1 /etc/dovecot/conf.d/10-master.conf:
+2 service auth {
+3 unix_listener auth-userdb {
+4 }
+5 inet_listener {
+6 port = 12345
+7 }
+8 }
+</pre>
+</blockquote>
+
+<p> Line 5 creates a new TCP socket and line 6 specifies port 12345
+where Dovecot SASL should wait for Postfix authentication requests.
+</p>
+
+<p> Proceed with the section "<a href="#server_sasl_enable">Enabling
+SASL authentication and authorization in the Postfix SMTP server</a>"
+to turn on and use SASL in the Postfix SMTP server. </p>
+
<h3><a name="server_cyrus">Configuring Cyrus SASL</a></h3>
<p> The Cyrus SASL framework supports a wide variety of applications
</pre>
</blockquote>
-<p> Additionally set the path where the Postfix SMTP server can
-find the Dovecot SASL socket: </p>
+<p> Additionally specify how Postfix SMTP server can find the Dovecot
+authentication server. This depends on the settings that you have
+selected in the section "<a href="#server_dovecot_comm">Postfix to
+Dovecot SASL communication</a>". </p>
+
+<ul>
+
+<li> <p> If you configured Dovecot for UNIX-domain socket communication,
+configure Postfix as follows: </p>
-<blockquote>
<pre>
/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#smtpd_sasl_path">smtpd_sasl_path</a> = private/auth
</pre>
-</blockquote>
-
-<blockquote>
<strong>Note</strong>
directory, so that it will work whether or not the Postfix SMTP
server runs chrooted. </p>
-</blockquote>
+<li> <p> If you configured Dovecot for TCP socket communication,
+configure Postfix as follows (if Dovecot runs on a different
+machine, replace 127.0.0.1 by that machine's IP address): </p>
+
+<pre>
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
+ <a href="postconf.5.html#smtpd_sasl_path">smtpd_sasl_path</a> = inet:127.0.0.1:12345
+</pre>
+
+</ul>
<h4><a name="server_sasl_authc">Enabling SASL authentication
in the Postfix SMTP server</a></h4>
postconf - Postfix configuration utility
<b>SYNOPSIS</b>
- <b>postconf</b> [<b>-dfhnv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter ...</i>]
+ <b>Managing <a href="postconf.5.html">main.cf</a>:</b>
- <b>postconf</b> [<b>-aAflmMv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>]
+ <b>postconf</b> [<b>-dfhnv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter ...</i>]
<b>postconf</b> [<b>-ev</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter=value ...</i>]
<b>postconf</b> [<b>-#v</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>parameter ...</i>]
+ <b>Managing <a href="master.5.html">master.cf</a>:</b>
+
+ <b>postconf</b> [<b>-fMv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>service ...</i>]
+
+ <b>Managing other configuration:</b>
+
+ <b>postconf</b> [<b>-aAlmv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>]
+
<b>postconf</b> [<b>-btv</b>] [<b>-c</b> <i>config</i><b>_</b><i>dir</i>] [<i>template</i><b>_</b><i>file</i>]
<b>DESCRIPTION</b>
Options:
+ <b>-A</b> List the available SASL client plug-in types. The
+ SASL plug-in type is selected with the
+ <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a></b> or <b><a href="postconf.5.html#lmtp_sasl_type">lmtp_sasl_type</a></b> configuration
+ parameters by specifying one of the names listed
+ below.
+
<b>-a</b> List the available SASL server plug-in types. The
SASL plug-in type is selected with the
<b><a href="postconf.5.html#smtpd_sasl_type">smtpd_sasl_type</a></b> configuration parameter by specify-
This feature is available with Postfix 2.3 and
later.
- <b>-A</b> List the available SASL client plug-in types. The
- SASL plug-in type is selected with the
- <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a></b> or <b><a href="postconf.5.html#lmtp_sasl_type">lmtp_sasl_type</a></b> configuration
- parameters by specifying one of the names listed
- below.
-
<b>cyrus</b> This client plug-in is available when Post-
fix is built with Cyrus SASL support.
lock file, as well as stale lock files that
were left behind after abnormal termination.
+ <b>-M</b> Show <a href="master.5.html"><b>master.cf</b></a> file contents instead of <a href="postconf.5.html"><b>main.cf</b></a>
+ file contents. Use <b>-Mf</b> to fold long lines for
+ human readability.
+
+ If <i>service ...</i> is specified, only the matching ser-
+ vices will be output. For example, a service of
+ <b>inet</b> will match all services that listen on the
+ network.
+
+ Specify zero or more argument, each with a <i>service-</i>
+ <i>type</i> name (<b>inet</b>, <b>unix</b>, <b>fifo</b>, or <b>pass</b>) or with a
+ <i>service-name.service-type</i> pair, where <i>service-name</i>
+ is the first field of a <a href="master.5.html">master.cf</a> entry.
+
+ This feature is available with Postfix 2.9 and
+ later.
+
<b>-m</b> List the names of all supported lookup table types.
- In Postfix configuration files, lookup tables are
- specified as <i>type</i><b>:</b><i>name</i>, where <i>type</i> is one of the
- types listed below. The table <i>name</i> syntax depends
- on the lookup table type as described in the <a href="DATABASE_README.html">DATA</a>-
+ In Postfix configuration files, lookup tables are
+ specified as <i>type</i><b>:</b><i>name</i>, where <i>type</i> is one of the
+ types listed below. The table <i>name</i> syntax depends
+ on the lookup table type as described in the <a href="DATABASE_README.html">DATA</a>-
<a href="DATABASE_README.html">BASE_README</a> document.
- <b>btree</b> A sorted, balanced tree structure. This is
+ <b>btree</b> A sorted, balanced tree structure. This is
available on systems with support for Berke-
ley DB databases.
- <b>cdb</b> A read-optimized structure with no support
- for incremental updates. This is available
+ <b>cdb</b> A read-optimized structure with no support
+ for incremental updates. This is available
on systems with support for CDB databases.
- <b>cidr</b> A table that associates values with Class-
- less Inter-Domain Routing (CIDR) patterns.
+ <b>cidr</b> A table that associates values with Class-
+ less Inter-Domain Routing (CIDR) patterns.
This is described in <a href="cidr_table.5.html"><b>cidr_table</b>(5)</a>.
<b>dbm</b> An indexed file type based on hashing. This
<b>environ</b>
The UNIX process environment array. The
- lookup key is the variable name. Originally
- implemented for testing, someone may find
+ lookup key is the variable name. Originally
+ implemented for testing, someone may find
this useful someday.
<b>hash</b> An indexed file type based on hashing. This
- is available on systems with support for
+ is available on systems with support for
Berkeley DB databases.
<b>internal</b>
tent are lost when a process terminates.
<b>ldap</b> (read-only)
- Perform lookups using the LDAP protocol.
+ Perform lookups using the LDAP protocol.
This is described in <a href="ldap_table.5.html"><b>ldap_table</b>(5)</a>.
<b>mysql</b> (read-only)
- Perform lookups using the MYSQL protocol.
+ Perform lookups using the MYSQL protocol.
This is described in <a href="mysql_table.5.html"><b>mysql_table</b>(5)</a>.
<b>pcre</b> (read-only)
A lookup table based on Perl Compatible Reg-
- ular Expressions. The file format is
+ ular Expressions. The file format is
described in <a href="pcre_table.5.html"><b>pcre_table</b>(5)</a>.
<b>pgsql</b> (read-only)
- Perform lookups using the PostgreSQL proto-
+ Perform lookups using the PostgreSQL proto-
col. This is described in <a href="pgsql_table.5.html"><b>pgsql_table</b>(5)</a>.
<b>proxy</b> (read-only)
- A lookup table that is implemented via the
- Postfix <a href="proxymap.8.html"><b>proxymap</b>(8)</a> service. The table name
+ A lookup table that is implemented via the
+ Postfix <a href="proxymap.8.html"><b>proxymap</b>(8)</a> service. The table name
syntax is <i>type</i><b>:</b><i>name</i>.
<b>regexp</b> (read-only)
A lookup table based on regular expressions.
- The file format is described in <a href="regexp_table.5.html"><b>regexp_ta-</b></a>
+ The file format is described in <a href="regexp_table.5.html"><b>regexp_ta-</b></a>
<a href="regexp_table.5.html"><b>ble</b>(5)</a>.
<b>sdbm</b> An indexed file type based on hashing. This
- is available on systems with support for
+ is available on systems with support for
SDBM databases.
<b>sqlite</b> (read-only)
- Perform lookups from SQLite database files.
+ Perform lookups from SQLite database files.
This is described in <a href="sqlite_table.5.html"><b>sqlite_table</b>(5)</a>.
<b>static</b> (read-only)
- A table that always returns its name as
- lookup result. For example, <b><a href="DATABASE_README.html#types">static</a>:foobar</b>
- always returns the string <b>foobar</b> as lookup
+ A table that always returns its name as
+ lookup result. For example, <b><a href="DATABASE_README.html#types">static</a>:foobar</b>
+ always returns the string <b>foobar</b> as lookup
result.
<b>tcp</b> (read-only)
Perform lookups using a simple request-reply
- protocol that is described in <a href="tcp_table.5.html"><b>tcp_table</b>(5)</a>.
+ protocol that is described in <a href="tcp_table.5.html"><b>tcp_table</b>(5)</a>.
<b>texthash</b> (read-only)
- Produces similar results as hash: files,
+ Produces similar results as hash: files,
except that you don't need to run the
- <a href="postmap.1.html">postmap(1)</a> command before you can use the
- file, and that it does not detect changes
+ <a href="postmap.1.html">postmap(1)</a> command before you can use the
+ file, and that it does not detect changes
after the file is read.
<b>unix</b> (read-only)
- A limited way to query the UNIX authentica-
+ A limited way to query the UNIX authentica-
tion database. The following tables are
implemented:
<b>unix:passwd.byname</b>
- The table is the UNIX password data-
- base. The key is a login name. The
- result is a password file entry in
+ The table is the UNIX password data-
+ base. The key is a login name. The
+ result is a password file entry in
<b>passwd</b>(5) format.
<b>unix:group.byname</b>
The table is the UNIX group database.
- The key is a group name. The result
- is a group file entry in <b>group</b>(5)
+ The key is a group name. The result
+ is a group file entry in <b>group</b>(5)
format.
- Other table types may exist depending on how Post-
+ Other table types may exist depending on how Post-
fix was built.
- <b>-M</b> Show <a href="master.5.html"><b>master.cf</b></a> file contents instead of <a href="postconf.5.html"><b>main.cf</b></a>
- file contents. Combine with <b>-f</b> to fold long lines
- for human readability.
-
- This feature is available with Postfix 2.9 and
- later.
-
<b>-n</b> Print <a href="postconf.5.html"><b>main.cf</b></a> parameter settings that are explic-
itly specified in <a href="postconf.5.html"><b>main.cf</b></a>.
.na
.nf
.fi
+\fBManaging main.cf:\fR
+
\fBpostconf\fR [\fB-dfhnv\fR] [\fB-c \fIconfig_dir\fR]
[\fIparameter ...\fR]
-\fBpostconf\fR [\fB-aAflmMv\fR] [\fB-c \fIconfig_dir\fR]
-
\fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
[\fIparameter=value ...\fR]
\fBpostconf\fR [\fB-#v\fR] [\fB-c \fIconfig_dir\fR]
[\fIparameter ...\fR]
+\fBManaging master.cf:\fR
+
+\fBpostconf\fR [\fB-fMv\fR] [\fB-c \fIconfig_dir\fR]
+[\fIservice ...\fR]
+
+\fBManaging other configuration:\fR
+
+\fBpostconf\fR [\fB-aAlmv\fR] [\fB-c \fIconfig_dir\fR]
+
\fBpostconf\fR [\fB-btv\fR] [\fB-c \fIconfig_dir\fR] [\fItemplate_file\fR]
.SH DESCRIPTION
.ad
about the Postfix mail system.
Options:
+.IP \fB-A\fR
+List the available SASL client plug-in types. The SASL
+plug-in type is selected with the \fBsmtp_sasl_type\fR or
+\fBlmtp_sasl_type\fR configuration parameters by specifying
+one of the names listed below.
.IP \fB-a\fR
List the available SASL server plug-in types. The SASL
plug-in type is selected with the \fBsmtpd_sasl_type\fR
.RE
.IP
This feature is available with Postfix 2.3 and later.
-.IP \fB-A\fR
-List the available SASL client plug-in types. The SASL
-plug-in type is selected with the \fBsmtp_sasl_type\fR or
-\fBlmtp_sasl_type\fR configuration parameters by specifying
-one of the names listed below.
.RS
.IP \fBcyrus\fR
This client plug-in is available when Postfix is built with
The application is expected to remove its own lock file, as well as
stale lock files that were left behind after abnormal termination.
.RE
+.IP \fB-M\fR
+Show \fBmaster.cf\fR file contents instead of \fBmain.cf\fR
+file contents. Use \fB-Mf\fR to fold long lines for human
+readability.
+
+If \fIservice ...\fR is specified, only the matching services
+will be output. For example, a service of \fBinet\fR will
+match all services that listen on the network.
+
+Specify zero or more argument, each with a \fIservice-type\fR
+name (\fBinet\fR, \fBunix\fR, \fBfifo\fR, or \fBpass\fR)
+or with a \fIservice-name.service-type\fR pair, where
+\fIservice-name\fR is the first field of a master.cf entry.
+
+This feature is available with Postfix 2.9 and later.
.IP \fB-m\fR
List the names of all supported lookup table types. In Postfix
configuration files,
.RE
.IP
Other table types may exist depending on how Postfix was built.
-.IP \fB-M\fR
-Show \fBmaster.cf\fR file contents instead of \fBmain.cf\fR
-file contents. Combine with \fB-f\fR to fold long lines
-for human readability.
-
-This feature is available with Postfix 2.9 and later.
.IP \fB-n\fR
Print \fBmain.cf\fR parameter settings that are explicitly
specified in \fBmain.cf\fR.
<h4><a name="server_dovecot_comm">Postfix to Dovecot SASL communication</a></h4>
<p> Communication between the Postfix SMTP server
-and Dovecot SASL happens via a UNIX-domain socket. The socket
+and Dovecot SASL happens via a UNIX-domain socket. Additionally,
+when using Dovecot version 2.0 and later, communication can take
+place over a TCP socket.
+
+<h5>UNIX-domain socket communication</h5>
+
+<p> The socket
pathname and the list of mechanisms offered to Postfix need to be
specified on the Dovecot server side in <code>dovecot.conf</code>.
</p>
SASL authentication and authorization in the Postfix SMTP server</a>"
to turn on and use SASL in the Postfix SMTP server. </p>
+<h5>TCP socket communication</h5>
+
+<p> The TCP port and the list of mechanisms offered to Postfix need
+to be specified on the Dovecot server side in <code>10-auth.conf</code>
+and <code>10-master.conf</code>. </p>
+
+<p> The following examples assume that Postfix should communicate
+with Dovecot on TCP port 12345. </p>
+
+<blockquote>
+<pre>
+1 /etc/dovecot/conf.d/10-auth.conf:
+2 auth_mechanisms = plain login
+</pre>
+</blockquote>
+
+<p> Line 2 provides plain and login as mechanisms for the Postfix
+SMTP server. </p>
+
+<blockquote>
+<pre>
+1 /etc/dovecot/conf.d/10-master.conf:
+2 service auth {
+3 unix_listener auth-userdb {
+4 }
+5 inet_listener {
+6 port = 12345
+7 }
+8 }
+</pre>
+</blockquote>
+
+<p> Line 5 creates a new TCP socket and line 6 specifies port 12345
+where Dovecot SASL should wait for Postfix authentication requests.
+</p>
+
+<p> Proceed with the section "<a href="#server_sasl_enable">Enabling
+SASL authentication and authorization in the Postfix SMTP server</a>"
+to turn on and use SASL in the Postfix SMTP server. </p>
+
<h3><a name="server_cyrus">Configuring Cyrus SASL</a></h3>
<p> The Cyrus SASL framework supports a wide variety of applications
</pre>
</blockquote>
-<p> Additionally set the path where the Postfix SMTP server can
-find the Dovecot SASL socket: </p>
+<p> Additionally specify how Postfix SMTP server can find the Dovecot
+authentication server. This depends on the settings that you have
+selected in the section "<a href="#server_dovecot_comm">Postfix to
+Dovecot SASL communication</a>". </p>
+
+<ul>
+
+<li> <p> If you configured Dovecot for UNIX-domain socket communication,
+configure Postfix as follows: </p>
-<blockquote>
<pre>
/etc/postfix/main.cf:
smtpd_sasl_path = private/auth
</pre>
-</blockquote>
-
-<blockquote>
<strong>Note</strong>
directory, so that it will work whether or not the Postfix SMTP
server runs chrooted. </p>
-</blockquote>
+<li> <p> If you configured Dovecot for TCP socket communication,
+configure Postfix as follows (if Dovecot runs on a different
+machine, replace 127.0.0.1 by that machine's IP address): </p>
+
+<pre>
+/etc/postfix/main.cf:
+ smtpd_sasl_path = inet:127.0.0.1:12345
+</pre>
+
+</ul>
<h4><a name="server_sasl_authc">Enabling SASL authentication
in the Postfix SMTP server</a></h4>
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20111117"
+#define MAIL_RELEASE_DATE "20111118"
#define MAIL_VERSION_NUMBER "2.9"
#ifdef SNAPSHOT
/* ARGV *match_service_init(pattern_list)
/* const char *pattern_list;
/*
+/* ARGV *match_service_init_argv(pattern_list)
+/* char **pattern_list;
+/*
/* int match_service_match(list, name_type)
/* ARGV *list;
/* const char *name_type;
/* match_service_init() parses the pattern list. The result
/* must be passed to match_service_match() or match_service_free().
/*
+/* match_service_init_argv() provides an alternate interface
+/* for pre-parsed strings.
+/*
/* match_service_match() matches one service name.type string
/* against the specified pattern list.
/*
const char *item;
while ((item = mystrtok(&bp, delim)) != 0)
- argv_add(list, item, (char *) 0);
+ argv_add(list, item, (char *) 0);
argv_terminate(list);
myfree(saved_patterns);
return (list);
}
+/* match_service_init_argv - impedance adapter */
+
+ARGV *match_service_init_argv(char **patterns)
+{
+ ARGV *list = argv_alloc(1);
+ char **cpp;
+
+ for (cpp = patterns; *cpp; cpp++)
+ argv_add(list, *cpp, (char *) 0);
+ argv_terminate(list);
+ return (list);
+}
+
/* match_service_match - match service name.type against pattern list */
int match_service_match(ARGV *list, const char *name_type)
/* External interface. */
extern ARGV *match_service_init(const char *);
+extern ARGV *match_service_init_argv(char **);
extern int match_service_match(ARGV *, const char *);
extern void match_service_free(ARGV *);
test: $(TESTPROG)
-tests: test1 test2 test3 test4 test5 test6 test7 test8
+tests: test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11
root_tests:
diff test8.ref test8.tmp
rm -f main.cf master.cf test8.tmp
+test9: $(PROG) test9.ref
+ rm -f main.cf master.cf
+ touch main.cf master.cf
+ echo foo inet - n n - 0 spawn >> master.cf
+ echo bar unix - n n - 0 spawn >> master.cf
+ ./$(PROG) -c . -M inet >test9.tmp 2>&1
+ diff test9.ref test9.tmp
+ rm -f main.cf master.cf test9.tmp
+
+test10: $(PROG) test10.ref
+ rm -f main.cf master.cf
+ touch main.cf master.cf
+ echo foo inet - n n - 0 spawn >> master.cf
+ echo bar unix - n n - 0 spawn >> master.cf
+ ./$(PROG) -c . -M bar.inet foo.unix >test10.tmp 2>&1
+ diff test10.ref test10.tmp
+ rm -f main.cf master.cf test10.tmp
+
+test11: $(PROG) test11.ref
+ rm -f main.cf master.cf
+ touch main.cf master.cf
+ echo foo inet - n n - 0 spawn >> master.cf
+ echo bar unix - n n - 0 spawn >> master.cf
+ ./$(PROG) -c . -M >test11.tmp 2>&1
+ diff test11.ref test11.tmp
+ rm -f main.cf master.cf test11.tmp
+
printfck: $(OBJS) $(PROG)
rm -rf printfck
mkdir printfck
postconf.o: ../../include/mail_run.h
postconf.o: ../../include/mail_version.h
postconf.o: ../../include/master_proto.h
+postconf.o: ../../include/match_service.h
postconf.o: ../../include/mbox_conf.h
postconf.o: ../../include/msg.h
postconf.o: ../../include/msg_vstream.h
/* Postfix configuration utility
/* SYNOPSIS
/* .fi
+/* \fBManaging main.cf:\fR
+/*
/* \fBpostconf\fR [\fB-dfhnv\fR] [\fB-c \fIconfig_dir\fR]
/* [\fIparameter ...\fR]
/*
-/* \fBpostconf\fR [\fB-aAflmMv\fR] [\fB-c \fIconfig_dir\fR]
-/*
/* \fBpostconf\fR [\fB-ev\fR] [\fB-c \fIconfig_dir\fR]
/* [\fIparameter=value ...\fR]
/*
/* \fBpostconf\fR [\fB-#v\fR] [\fB-c \fIconfig_dir\fR]
/* [\fIparameter ...\fR]
/*
+/* \fBManaging master.cf:\fR
+/*
+/* \fBpostconf\fR [\fB-fMv\fR] [\fB-c \fIconfig_dir\fR]
+/* [\fIservice ...\fR]
+/*
+/* \fBManaging other configuration:\fR
+/*
+/* \fBpostconf\fR [\fB-aAlmv\fR] [\fB-c \fIconfig_dir\fR]
+/*
/* \fBpostconf\fR [\fB-btv\fR] [\fB-c \fIconfig_dir\fR] [\fItemplate_file\fR]
/* DESCRIPTION
/* By default, the \fBpostconf\fR(1) command displays the
/* about the Postfix mail system.
/*
/* Options:
+/* .IP \fB-A\fR
+/* List the available SASL client plug-in types. The SASL
+/* plug-in type is selected with the \fBsmtp_sasl_type\fR or
+/* \fBlmtp_sasl_type\fR configuration parameters by specifying
+/* one of the names listed below.
/* .IP \fB-a\fR
/* List the available SASL server plug-in types. The SASL
/* plug-in type is selected with the \fBsmtpd_sasl_type\fR
/* .RE
/* .IP
/* This feature is available with Postfix 2.3 and later.
-/* .IP \fB-A\fR
-/* List the available SASL client plug-in types. The SASL
-/* plug-in type is selected with the \fBsmtp_sasl_type\fR or
-/* \fBlmtp_sasl_type\fR configuration parameters by specifying
-/* one of the names listed below.
/* .RS
/* .IP \fBcyrus\fR
/* This client plug-in is available when Postfix is built with
/* The application is expected to remove its own lock file, as well as
/* stale lock files that were left behind after abnormal termination.
/* .RE
+/* .IP \fB-M\fR
+/* Show \fBmaster.cf\fR file contents instead of \fBmain.cf\fR
+/* file contents. Use \fB-Mf\fR to fold long lines for human
+/* readability.
+/*
+/* If \fIservice ...\fR is specified, only the matching services
+/* will be output. For example, a service of \fBinet\fR will
+/* match all services that listen on the network.
+/*
+/* Specify zero or more argument, each with a \fIservice-type\fR
+/* name (\fBinet\fR, \fBunix\fR, \fBfifo\fR, or \fBpass\fR)
+/* or with a \fIservice-name.service-type\fR pair, where
+/* \fIservice-name\fR is the first field of a master.cf entry.
+/*
+/* This feature is available with Postfix 2.9 and later.
/* .IP \fB-m\fR
/* List the names of all supported lookup table types. In Postfix
/* configuration files,
/* .RE
/* .IP
/* Other table types may exist depending on how Postfix was built.
-/* .IP \fB-M\fR
-/* Show \fBmaster.cf\fR file contents instead of \fBmain.cf\fR
-/* file contents. Combine with \fB-f\fR to fold long lines
-/* for human readability.
-/*
-/* This feature is available with Postfix 2.9 and later.
/* .IP \fB-n\fR
/* Print \fBmain.cf\fR parameter settings that are explicitly
/* specified in \fBmain.cf\fR.
#include <mail_addr.h>
#include <mbox_conf.h>
#include <mail_run.h>
+#include <match_service.h>
/* XSASL library. */
#define DEF_MODE SHOW_NAME
static int cmd_mode = DEF_MODE;
+/* set_config_dir - forcibly override var_config_dir */
+
+static void set_config_dir(void)
+{
+ char *config_dir;
+
+ if (var_config_dir)
+ myfree(var_config_dir);
+ var_config_dir = mystrdup((config_dir = safe_getenv(CONF_ENV_PATH)) != 0 ?
+ config_dir : DEF_CONFIG_DIR); /* XXX */
+ set_mail_conf_str(VAR_CONFIG_DIR, var_config_dir);
+}
+
/* check_myhostname - lookup hostname and validate */
static const char *check_myhostname(void)
static void edit_parameters(int cmd_mode, int argc, char **argv)
{
- char *config_dir;
char *path;
EDIT_FILE *ep;
VSTREAM *src;
htable_enter(table, edit_key, (char *) cvalue);
}
- /*
- * XXX Avoid code duplication by better code decomposition.
- */
- if (var_config_dir)
- myfree(var_config_dir);
- var_config_dir = mystrdup((config_dir = safe_getenv(CONF_ENV_PATH)) != 0 ?
- config_dir : DEF_CONFIG_DIR); /* XXX */
- set_mail_conf_str(VAR_CONFIG_DIR, var_config_dir);
-
/*
* Open a temp file for the result. This uses a deterministic name so we
* don't leave behind thrash with random names.
*/
- path = concatenate(var_config_dir, "/", "main.cf", (char *) 0);
+ set_config_dir();
+ path = concatenate(var_config_dir, "/", MAIN_CONF_FILE, (char *) 0);
if ((ep = edit_file_open(path, O_CREAT | O_WRONLY, 0644)) == 0)
msg_fatal("open %s%s: %m", path, EDIT_FILE_SUFFIX);
dst = ep->tmp_fp;
htable_free(table, myfree);
}
-/* set_config_dir - forcibly override var_config_dir */
-
-static void set_config_dir(void)
-{
- char *config_dir;
-
- if (var_config_dir)
- myfree(var_config_dir);
- var_config_dir = mystrdup((config_dir = safe_getenv(CONF_ENV_PATH)) != 0 ?
- config_dir : DEF_CONFIG_DIR); /* XXX */
- set_mail_conf_str(VAR_CONFIG_DIR, var_config_dir);
-}
-
/* read_parameters - read parameter info from file */
static void read_parameters(void)
*/
dict_unknown_allowed = 1;
set_config_dir();
- path = concatenate(var_config_dir, "/", "main.cf", (char *) 0);
+ path = concatenate(var_config_dir, "/", MAIN_CONF_FILE, (char *) 0);
dict_load_file(CONFIG_DICT, path);
myfree(path);
}
/* scan_user_parameter_value - extract macro names from parameter value */
-#ifdef MAC_EXP_FLAG_SCAN
#define NO_SCAN_RESULT ((VSTRING *) 0)
#define NO_SCAN_FILTER ((char *) 0)
#define NO_SCAN_MODE (0)
(void) mac_expand(NO_SCAN_RESULT, (value), MAC_EXP_FLAG_SCAN, \
NO_SCAN_FILTER, check_user_parameter, NO_SCAN_CONTEXT); \
} while (0)
-#else
-#define scan_user_parameter_value(value) do { /* void */; } while (0)
-#endif
/* check_user_parameter - try to promote user-defined parameter */
argv_free(locks_argv);
}
-/* show_master - show master.cf entries */
+/* print_master_line - print one master line */
-static void show_master(int mode)
+static void print_master_line(int mode, ARGV *argv)
{
- ARGV **argvp;
- ARGV *argv;
char *arg;
char *aval;
int line_len;
while (0)
#define ADD_SPACE ADD_TEXT(" ", 1)
- for (argvp = master_table; (argv = *argvp) != 0; argvp++) {
-
- /*
- * Show the standard fields at their preferred column position. Use
- * single-space separation when some field does not fit.
- */
- for (line_len = 0, field = 0; field < MASTER_FIELD_COUNT; field++) {
- arg = argv->argv[field];
- if (line_len > 0) {
- while (line_len < column_goal[field] - 1)
- ADD_SPACE;
+ /*
+ * Show the standard fields at their preferred column position. Use
+ * single-space separation when some field does not fit.
+ */
+ for (line_len = 0, field = 0; field < MASTER_FIELD_COUNT; field++) {
+ arg = argv->argv[field];
+ if (line_len > 0) {
+ while (line_len < column_goal[field] - 1)
ADD_SPACE;
- }
- ADD_TEXT(arg, strlen(arg));
+ ADD_SPACE;
}
+ ADD_TEXT(arg, strlen(arg));
+ }
- /*
- * Format the daemon command-line options and non-option arguments.
- * Here, we have no data-dependent preference for column positions,
- * but we do have argument grouping preferences.
- */
- in_daemon_options = 1;
- for ( /* void */ ; argv->argv[field] != 0; field++) {
- arg = argv->argv[field];
- if (in_daemon_options) {
-
- /*
- * Try to show the generic options (-v -D) on the first line,
- * and non-options on a later line.
- */
- if (arg[0] != '-') {
- in_daemon_options = 0;
- if ((mode & FOLD_LINE)
- && line_len > column_goal[MASTER_FIELD_COUNT - 1]) {
- vstream_fputs("\n" INDENT_TEXT, VSTREAM_OUT);
- line_len = INDENT_LEN;
- }
- }
+ /*
+ * Format the daemon command-line options and non-option arguments. Here,
+ * we have no data-dependent preference for column positions, but we do
+ * have argument grouping preferences.
+ */
+ in_daemon_options = 1;
+ for ( /* void */ ; argv->argv[field] != 0; field++) {
+ arg = argv->argv[field];
+ if (in_daemon_options) {
- /*
- * Try to avoid breaking "-o name=value" over multiple lines
- * if it would fit on one line.
- */
- else if ((mode & FOLD_LINE)
- && line_len > INDENT_LEN && strcmp(arg, "-o") == 0
- && (aval = argv->argv[field + 1]) != 0
- && INDENT_LEN + 3 + strlen(aval) < LINE_LIMIT) {
+ /*
+ * Try to show the generic options (-v -D) on the first line, and
+ * non-options on a later line.
+ */
+ if (arg[0] != '-') {
+ in_daemon_options = 0;
+ if ((mode & FOLD_LINE)
+ && line_len > column_goal[MASTER_FIELD_COUNT - 1]) {
vstream_fputs("\n" INDENT_TEXT, VSTREAM_OUT);
line_len = INDENT_LEN;
- ADD_TEXT(arg, strlen(arg));
- arg = aval;
- field += 1;
}
}
/*
- * Insert a line break when the next argument won't fit (unless,
- * of course, we just inserted a line break).
+ * Try to avoid breaking "-o name=value" over multiple lines if
+ * it would fit on one line.
*/
- if (line_len > INDENT_LEN) {
- if ((mode & FOLD_LINE) == 0
- || line_len + 1 + strlen(arg) < LINE_LIMIT) {
- ADD_SPACE;
- } else {
- vstream_fputs("\n" INDENT_TEXT, VSTREAM_OUT);
- line_len = INDENT_LEN;
- }
+ else if ((mode & FOLD_LINE)
+ && line_len > INDENT_LEN && strcmp(arg, "-o") == 0
+ && (aval = argv->argv[field + 1]) != 0
+ && INDENT_LEN + 3 + strlen(aval) < LINE_LIMIT) {
+ vstream_fputs("\n" INDENT_TEXT, VSTREAM_OUT);
+ line_len = INDENT_LEN;
+ ADD_TEXT(arg, strlen(arg));
+ arg = aval;
+ field += 1;
}
- ADD_TEXT(arg, strlen(arg));
}
- vstream_fputs("\n", VSTREAM_OUT);
+
+ /*
+ * Insert a line break when the next argument won't fit (unless, of
+ * course, we just inserted a line break).
+ */
+ if (line_len > INDENT_LEN) {
+ if ((mode & FOLD_LINE) == 0
+ || line_len + 1 + strlen(arg) < LINE_LIMIT) {
+ ADD_SPACE;
+ } else {
+ vstream_fputs("\n" INDENT_TEXT, VSTREAM_OUT);
+ line_len = INDENT_LEN;
+ }
+ }
+ ADD_TEXT(arg, strlen(arg));
+ }
+ vstream_fputs("\n", VSTREAM_OUT);
+}
+
+/* show_master - show master.cf entries */
+
+static void show_master(int mode, char **filters)
+{
+ ARGV **argvp;
+ ARGV *argv;
+ VSTRING *service_name = 0;
+ ARGV *service_filter = 0;
+
+ /*
+ * Initialize the service filter.
+ */
+ if (filters[0]) {
+ service_name = vstring_alloc(10);
+ service_filter = match_service_init_argv(filters);
+ }
+
+ /*
+ * Iterate over the master table.
+ */
+ for (argvp = master_table; (argv = *argvp) != 0; argvp++) {
+ if (service_filter) {
+ vstring_sprintf(service_name, "%s.%s",
+ argv->argv[0], argv->argv[1]);
+ if (match_service_match(service_filter, STR(service_name)) == 0)
+ continue;
+ }
+ print_master_line(mode, argv);
+ }
+ if (service_filter) {
+ argv_free(service_filter);
+ vstring_free(service_name);
}
}
*/
else if (cmd_mode & SHOW_MASTER) {
read_master();
- show_master(cmd_mode);
+ show_master(cmd_mode, argv + optind);
}
/*
* because that ignores all the user-specified parameters and
* user-specified macro expansions in main.cf.
*/
-#ifdef MAC_EXP_FLAG_SCAN
if ((cmd_mode & SHOW_DEFS) == 0) {
flag_unused_main_parameters();
flag_unused_master_parameters();
}
-#endif
}
vstream_fflush(VSTREAM_OUT);
exit(0);
--- /dev/null
+foo inet - n n - 0 spawn
+bar unix - n n - 0 spawn
--- /dev/null
+foo inet - n n - 0 spawn