expression that matches the null string. This caused fatal
run-time errors. File: dict_pcre.c.
+20060324
+
+ Cleanup: eliminated name collisions between global and local
+ variables, and other forms of shadowing. Documented switch
+ fall-throughs with /* FALLTHROUGH */ where this wasn't
+ already done. Replaced (var = expr) by (var = expr) != 0
+ where this wasn't already done.
+
+20060324
+
+ Bugfix: mis-placed parenthesis in a before-filter error
+ test. A filter timeout was mis-reported as lost connection.
+ Found in code review. File: smtpd/smtpd_proxy.c.
+
Wish list:
+ Don't send xforward attributes to every site that announces
+ xforward support.
+
The sendmail command should not return non-std exit status
after fatal error in some internal library routine.
original recipient address.
* The delivery status.
-Some details are still preliminary and will change as Postfix implements the
-DSN (delivery status notification) standards.
+Some details depend on Postfix version. The example below is for Postfix
+version 2.3 and later.
Content-Description: Delivery report
Content-Type: message/delivery-status
Final-Recipient: rfc822; postfix-users@postfix.org
Action: deliverable
Status: 2.0.0
- Diagnostic-Code: X-Postfix; delivery via mail.cloud9.net[168.100.1.4]: 250
- Ok
+ Remote-MTA: dns; mail.cloud9.net
+ Diagnostic-Code: smtp; 250 Ok
The third part of the report contains the message that Postfix would have
delivered, including From: and To: message headers, so that you can see any
Execute the command "p\bpo\bos\bst\btm\bma\bap\bp /\b/e\bet\btc\bc/\b/p\bpo\bos\bst\btf\bfi\bix\bx/\b/t\btr\bra\ban\bns\bsp\bpo\bor\brt\bt" whenever you change the
transport table.
-NOTE: Do not use the fallback_relay feature when relaying mail for a backup or
-primary MX domain. Mail would loop between the Postfix MX host and the
-fallback_relay host when the final destination is unavailable.
+NOTE for Postfix < 2.2: Do not use the fallback_relay feature when relaying
+mail for a backup or primary MX domain. Mail would loop between the Postfix MX
+host and the fallback_relay host when the final destination is unavailable.
* In main.cf specify "relay_transport = relay",
* In master.cf specify "-o fallback_relay =" at the end of the relay entry.
* Problems in the TLS code: <postfix_tls@aet.tu-cottbus.de>
* Problems in vanilla Postfix: <postfix-users@postfix.org>
-C\bCo\bom\bmp\bpa\bat\bti\bib\bbi\bil\bli\bit\bty\by w\bwi\bit\bth\bh P\bPo\bos\bst\btf\bfi\bix\bx <\b<2\b2.\b.2\b2 T\bTL\bLS\bS s\bsu\bup\bpp\bpo\bor\brt\bt
+C\bCo\bom\bmp\bpa\bat\bti\bib\bbi\bil\bli\bit\bty\by w\bwi\bit\bth\bh P\bPo\bos\bst\btf\bfi\bix\bx <\b< 2\b2.\b.2\b2 T\bTL\bLS\bS s\bsu\bup\bpp\bpo\bor\brt\bt
Postfix version 2.2 TLS support is based on the Postfix/TLS patch by Lutz
Jänicke, but differs in a few minor ways.
# Global Postfix configuration file. This file lists only a subset
-# of all 300+ parameters. See the postconf(5) manual page for a
-# complete list.
+# of all parameters. For the syntax, and for a complete parameter
+# list, see the postconf(5) manual page (command: "man 5 postconf").
#
-# The general format of each line is: parameter = value. Lines
-# that begin with whitespace continue the previous line. A value can
-# contain references to other $names or ${name}s.
+# For common configuration examples, see BASIC_CONFIGURATION_README
+# and STANDARD_CONFIGURATION_README. To find these documents, use
+# the command "postconf html_directory readme_directory", or go to
+# http://www.postfix.org/.
#
-# NOTE - CHANGE NO MORE THAN 2-3 PARAMETERS AT A TIME, AND TEST IF
-# POSTFIX STILL WORKS AFTER EVERY CHANGE.
+# For best results, change no more than 2-3 parameters at a time,
+# and test if Postfix still works after every change.
# SOFT BOUNCE
#
#
# Postfix master process configuration file. For details on the format
-# of the file, see the Postfix master(5) manual page.
+# of the file, see the master(5) manual page (command: "man 5 master").
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
systems. </p>
<p> Canonical mapping is disabled by default. To enable, edit the
-<a href="postconf.5.html#canonical_maps">canonical_maps</a> parameter in the main.cf file and specify one or
+<a href="postconf.5.html#canonical_maps">canonical_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file and specify one or
more lookup tables, separated by whitespace or commas. </p>
<p> Example: </p>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#canonical_maps">canonical_maps</a> = hash:/etc/postfix/canonical
/etc/postfix/canonical:
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#sender_canonical_maps">sender_canonical_maps</a> = hash:/etc/postfix/sender_canonical
<a href="postconf.5.html#recipient_canonical_maps">recipient_canonical_maps</a> = hash:/etc/postfix/recipient_canonical
</pre>
</p>
<p> Canonical mapping can be turned off selectively for mail received
-by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding main.cf settings
-in the master.cf file. This feature is available in Postfix version
+by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding <a href="postconf.5.html">main.cf</a> settings
+in the <a href="master.5.html">master.cf</a> file. This feature is available in Postfix version
2.1 and later. </p>
<p> Example: </p>
<blockquote>
<pre>
-/etc/postfix/master.cf:
+/etc/postfix/<a href="master.5.html">master.cf</a>:
:10026 inet n - n - - smtpd
-o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a>
</pre>
<p> Address masquerading is disabled by default, and is implemented
by the <a href="cleanup.8.html">cleanup(8)</a> server. To enable, edit the <a href="postconf.5.html#masquerade_domains">masquerade_domains</a>
-parameter in the main.cf file and specify one or more domain names
+parameter in the <a href="postconf.5.html">main.cf</a> file and specify one or more domain names
separated by whitespace or commas. When Postfix tries to masquerade
a domain, it processes the list from left to right, and processing
stops at the first match. </p>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#masquerade_domains">masquerade_domains</a> = foo.example.com example.com
</pre>
</blockquote>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#masquerade_domains">masquerade_domains</a> = !foo.example.com example.com
</pre>
</blockquote>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#masquerade_exceptions">masquerade_exceptions</a> = root
</pre>
</blockquote>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#masquerade_classes">masquerade_classes</a> = envelope_sender, envelope_recipient,
header_sender, header_recipient
</pre>
no longer be able to send mail to individual machines. </p>
<p> Address masquerading can be turned off selectively for mail
-received by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding main.cf
-settings in the master.cf file. This feature is available in
+received by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding <a href="postconf.5.html">main.cf</a>
+settings in the <a href="master.5.html">master.cf</a> file. This feature is available in
Postfix version 2.1 and later. </p>
<p> Example: </p>
<blockquote>
<pre>
-/etc/postfix/master.cf:
+/etc/postfix/<a href="master.5.html">master.cf</a>:
:10026 inet n - n - - smtpd
-o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a>
</pre>
<p> Automatic BCC recipients (including <a href="postconf.5.html#always_bcc">always_bcc</a>) can be turned
off selectively for mail received by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>,
-by overriding main.cf settings in the master.cf file. This feature
+by overriding <a href="postconf.5.html">main.cf</a> settings in the <a href="master.5.html">master.cf</a> file. This feature
is available in Postfix version 2.1 and later. </p>
<p> Example: </p>
<blockquote>
<pre>
-/etc/postfix/master.cf:
+/etc/postfix/<a href="master.5.html">master.cf</a>:
:10026 inet n - n - - smtpd
-o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a>
</pre>
</p>
<p> Virtual aliasing is disabled by default. To enable, edit the
-<a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> parameter in the main.cf file and
+<a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file and
specify one or more lookup tables, separated by whitespace or
commas. </p>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = hash:/etc/postfix/virtual
-/etc/postfix/virtual:
+/etc/postfix/<a href="virtual.8.html">virtual</a>:
Wietse.Venema wietse
</pre>
</blockquote>
mail that is generated by Postfix itself. </p>
<p> Virtual aliasing can be turned off selectively for mail received
-by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding main.cf settings
-in the master.cf file. This feature is available in Postfix version
+by <a href="smtpd.8.html">smtpd(8)</a>, <a href="qmqpd.8.html">qmqpd(8)</a>, or <a href="pickup.8.html">pickup(8)</a>, by overriding <a href="postconf.5.html">main.cf</a> settings
+in the <a href="master.5.html">master.cf</a> file. This feature is available in Postfix version
2.1 and later. </p>
<p> Example: </p>
<blockquote>
<pre>
-/etc/postfix/master.cf:
+/etc/postfix/<a href="master.5.html">master.cf</a>:
:10026 inet n - n - - smtpd
-o <a href="postconf.5.html#receive_override_options">receive_override_options</a>=<a href="postconf.5.html#no_address_mappings">no_address_mappings</a>
</pre>
documents, and the examples in the <a href="transport.5.html">transport(5)</a> manual page. </p>
<p> Transport table lookups are disabled by default. To enable,
-edit the <a href="postconf.5.html#transport_maps">transport_maps</a> parameter in the main.cf file and specify
+edit the <a href="postconf.5.html#transport_maps">transport_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file and specify
one or more lookup tables, separated by whitespace or commas. </p>
<p> Example: </p>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#transport_maps">transport_maps</a> = hash:/etc/postfix/transport
</pre>
</blockquote>
can replace one recipient address by a different one. </p>
<p> Lookups of relocated users are disabled by default. To enable,
-edit the <a href="postconf.5.html#relocated_maps">relocated_maps</a> parameter in the main.cf file and specify
+edit the <a href="postconf.5.html#relocated_maps">relocated_maps</a> parameter in the <a href="postconf.5.html">main.cf</a> file and specify
one or more lookup tables, separated by whitespace or commas. </p>
<p> Example: </p>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#relocated_maps">relocated_maps</a> = hash:/etc/postfix/relocated
/etc/postfix/relocated:
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#smtp_generic_maps">smtp_generic_maps</a> = hash:/etc/postfix/generic
/etc/postfix/generic:
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#alias_maps">alias_maps</a> = hash:/etc/aliases
<a href="postconf.5.html#alias_maps">alias_maps</a> = dbm:/etc/aliases, nis:mail.aliases
</pre>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#alias_database">alias_database</a> = hash:/etc/aliases (4.4BSD, LINUX)
<a href="postconf.5.html#alias_database">alias_database</a> = dbm:/etc/aliases (4.3BSD, SYSV<4)
<a href="postconf.5.html#alias_database">alias_database</a> = dbm:/etc/mail/aliases (SYSV4)
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> =
</pre>
</blockquote>
-<p> (i.e. empty) in the main.cf file, otherwise the Postfix SMTP
+<p> (i.e. empty) in the <a href="postconf.5.html">main.cf</a> file, otherwise the Postfix SMTP
server will reject mail for non-UNIX accounts with "User unknown
in local recipient table". See the <a href="LOCAL_RECIPIENT_README.html">LOCAL_RECIPIENT_README</a> file
for more information on this.
</ul>
-<p> Some details are still preliminary and will change as Postfix
-implements the DSN (delivery status notification) standards. </p>
+<p> Some details depend on Postfix version. The example below is
+for Postfix version 2.3 and later. </p>
<blockquote>
<pre>
Final-Recipient: rfc822; postfix-users@postfix.org
Action: deliverable
Status: 2.0.0
-Diagnostic-Code: X-Postfix; delivery via mail.cloud9.net[168.100.1.4]: 250 Ok
+Remote-MTA: dns; mail.cloud9.net
+Diagnostic-Code: smtp; 250 Ok
</pre>
</blockquote>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#smtpd_restriction_classes">smtpd_restriction_classes</a> = restrictive, permissive
- # With Postfix < 2.3 specify <a href="postconf.5.html#reject_unknown_client_hostname">reject_unknown_client</a>.
+ # With Postfix < 2.3 specify <a href="postconf.5.html#reject_unknown_client_hostname">reject_unknown_client</a>.
restrictive = <a href="postconf.5.html#reject_unknown_sender_domain">reject_unknown_sender_domain</a> <a href="postconf.5.html#reject_unknown_client_hostname">reject_unknown_client_hostname</a> ...
permissive = permit
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
<a href="postconf.5.html#check_recipient_access">check_recipient_access</a> hash:/etc/postfix/access
<i>...the usual stuff...</i>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
<a href="postconf.5.html#check_recipient_access">check_recipient_access</a> hash:/etc/postfix/protected_destinations
<i>...the usual stuff...</i>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
<a href="postconf.5.html#check_sender_access">check_sender_access</a> hash:/etc/postfix/restricted_senders
<i>...other stuff...</i>
<ul>
<li> <p> By sending mail via a less restrictive mail
-relay host. </p>
+<a href="postconf.5.html#relayhost">relay host</a>. </p>
<li> <p> By sending mail as someone else who does have permission
to send mail to off-site destinations. </p>
<p> Examples of simple restriction lists are: </p>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
# Allow connections from trusted networks only.
<a href="postconf.5.html#smtpd_client_restrictions">smtpd_client_restrictions</a> = <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a>, reject
# Don't talk to mail systems that don't know their own hostname.
- # With Postfix < 2.3, specify <a href="postconf.5.html#reject_unknown_helo_hostname">reject_unknown_hostname</a>.
+ # With Postfix < 2.3, specify <a href="postconf.5.html#reject_unknown_helo_hostname">reject_unknown_hostname</a>.
<a href="postconf.5.html#smtpd_helo_restrictions">smtpd_helo_restrictions</a> = <a href="postconf.5.html#reject_unknown_helo_hostname">reject_unknown_helo_hostname</a>
# Don't accept mail from domains that don't exist.
in too much access permission: </p>
<pre>
-1 /etc/postfix/main.cf:
+1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
3 <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a>
4 <a href="postconf.5.html#check_helo_access">check_helo_access</a> hash:/etc/postfix/helo_access
</pre>
<p> Line 5 rejects mail from hosts that don't specify a proper
-hostname in the HELO command (with Postfix < 2.3, specify
+hostname in the HELO command (with Postfix < 2.3, specify
<a href="postconf.5.html#reject_unknown_helo_hostname">reject_unknown_hostname</a>). Lines 4 and 9 make an exception to
allow mail from some machine that announces itself with "HELO
localhost.localdomain". </p>
<dt> <a href="postconf.5.html#soft_bounce">soft_bounce</a> </dt> <dd> <p> This is a safety net that changes
SMTP server REJECT actions into DEFER (try again later) actions.
This keeps mail queued that would otherwise be returned to the
-sender. Specify "<a href="postconf.5.html#soft_bounce">soft_bounce</a> = yes" in the main.cf file to prevent
+sender. Specify "<a href="postconf.5.html#soft_bounce">soft_bounce</a> = yes" in the <a href="postconf.5.html">main.cf</a> file to prevent
the Postfix SMTP server from rejecting mail permanently, by changing
all 5xx SMTP reply codes into 4xx. </p> </dd>
<a href="http://www.postfix.org/">http://www.postfix.org/</a>. </p>
<p> You can use the command "<b>postconf -n</b>" to find out what
-settings are overruled by your main.cf. Besides a few pathname
+settings are overruled by your <a href="postconf.5.html">main.cf</a>. Besides a few pathname
settings, few parameters should be set on a stand-alone box, beyond
what is covered in the <a href="BASIC_CONFIGURATION_README.html">BASIC_CONFIGURATION_README</a> document: </p>
<blockquote>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
# Optional: send mail as user@domainname instead of user@hostname.
#<a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
<blockquote>
<pre>
-1 /etc/postfix/main.cf:
+1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
3 <a href="postconf.5.html#relayhost">relayhost</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
4 <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> = 127.0.0.1
5 <a href="postconf.5.html#local_transport">local_transport</a> = <a href="error.8.html">error</a>:local delivery is disabled
6
-7 /etc/postfix/master.cf:
+7 /etc/postfix/<a href="master.5.html">master.cf</a>:
8 Comment out the local delivery agent entry
</pre>
</blockquote>
<blockquote>
<pre>
-1 /etc/postfix/main.cf:
+1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
3 <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 10.0.0.0/24
4 <a href="postconf.5.html#relay_domains">relay_domains</a> =
1 DNS:
2 example.com IN MX 10 mailhost.example.com.
3
- 4 /etc/postfix/main.cf:
+ 4 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
5 <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
6 <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a> localhost.$<a href="postconf.5.html#mydomain">mydomain</a> localhost $<a href="postconf.5.html#mydomain">mydomain</a>
7 <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 10.0.0.0/24
<blockquote>
<pre>
-1 /etc/postfix/main.cf:
+1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#myorigin">myorigin</a> = example.com
3 <a href="postconf.5.html#mydestination">mydestination</a> =
4 <a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> =
5 <a href="postconf.5.html#local_transport">local_transport</a> = <a href="error.8.html">error</a>:local mail delivery is disabled
6
-7 /etc/postfix/master.cf:
+7 /etc/postfix/<a href="master.5.html">master.cf</a>:
8 Comment out the local delivery agent
</pre>
</blockquote>
<blockquote>
<pre>
-1 /etc/postfix/main.cf:
+1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = hash:/etc/postfix/virtual
3
-4 /etc/postfix/virtual:
+4 /etc/postfix/<a href="virtual.8.html">virtual</a>:
5 postmaster postmaster@example.com
6 abuse abuse@example.com
</pre>
<blockquote>
<pre>
- 1 /etc/postfix/main.cf:
+ 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 12.34.56.0/24
3 <a href="postconf.5.html#relay_domains">relay_domains</a> = example.com
4 <a href="postconf.5.html#parent_domain_matches_subdomains">parent_domain_matches_subdomains</a> =
<blockquote>
<pre>
-1 /etc/postfix/main.cf:
+1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = hash:/etc/postfix/virtual
3
-4 /etc/postfix/virtual:
+4 /etc/postfix/<a href="virtual.8.html">virtual</a>:
5 root root@localhost
6 . . .
</pre>
<blockquote>
<pre>
- 1 /etc/postfix/main.cf:
+ 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#transport_maps">transport_maps</a> = hash:/etc/postfix/transport
3 <a href="postconf.5.html#relayhost">relayhost</a> =
4 # Optional for a machine that isn't "always on"
internally. The <tt>[]</tt> forces Postfix to do no MX lookup.
</p>
-<li> <p> Line 3: IMPORTANT: do not specify a <a href="postconf.5.html#relayhost">relayhost</a> in main.cf.
+<li> <p> Line 3: IMPORTANT: do not specify a <a href="postconf.5.html#relayhost">relayhost</a> in <a href="postconf.5.html">main.cf</a>.
</p>
<li> <p> Line 5: This prevents mail from being stuck in the queue
1 DNS:
2 the.backed-up.domain.tld IN MX 100 your.machine.tld.
3
- 4 /etc/postfix/main.cf:
+ 4 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
5 <a href="postconf.5.html#relay_domains">relay_domains</a> = . . . the.backed-up.domain.tld
6 <a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
7 <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a> <a href="postconf.5.html#reject_unauth_destination">reject_unauth_destination</a>
<blockquote>
<pre>
-18 /etc/postfix/main.cf:
+18 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
19 <a href="postconf.5.html#transport_maps">transport_maps</a> = hash:/etc/postfix/transport
20
21 /etc/postfix/transport:
<p> Execute the command "<b>postmap /etc/postfix/transport</b>"
whenever you change the transport table. </p>
-<p> NOTE: Do not use the <a href="postconf.5.html#fallback_relay">fallback_relay</a> feature when relaying mail
+<p> NOTE for Postfix < 2.2: Do not use the <a href="postconf.5.html#fallback_relay">fallback_relay</a> feature
+when relaying mail
for a backup or primary MX domain. Mail would loop between the
Postfix MX host and the <a href="postconf.5.html#fallback_relay">fallback_relay</a> host when the final destination
is unavailable. </p>
<ul>
-<li> In main.cf specify "<tt><a href="postconf.5.html#relay_transport">relay_transport</a> = relay</tt>",
+<li> In <a href="postconf.5.html">main.cf</a> specify "<tt><a href="postconf.5.html#relay_transport">relay_transport</a> = relay</tt>",
-<li> In master.cf specify "<tt>-o <a href="postconf.5.html#fallback_relay">fallback_relay</a> =</tt>" at the
+<li> In <a href="master.5.html">master.cf</a> specify "<tt>-o <a href="postconf.5.html#fallback_relay">fallback_relay</a> =</tt>" at the
end of the <tt>relay</tt> entry.
<li> In transport maps, specify "<tt>relay:<i>nexthop...</i></tt>"
prevents Postfix from trying to look up DNS MX records. </p>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#relayhost">relayhost</a> = [smtprelay.someprovider.com]
</pre>
calls from being placed, disable spontaneous SMTP mail deliveries. </p>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#defer_transports">defer_transports</a> = smtp (Only for on-demand dialup IP hosts)
</pre>
<li> <p>Disable SMTP client DNS lookups (dialup LAN only).</p>
<pre>
-/etc/postfix/main.cf:
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
<a href="postconf.5.html#disable_dns_lookups">disable_dns_lookups</a> = yes (Only for on-demand dialup IP hosts)
</pre>
<blockquote>
<pre>
-1 /etc/postfix/main.cf:
+1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#smtp_generic_maps">smtp_generic_maps</a> = hash:/etc/postfix/generic
3
4 /etc/postfix/generic:
<blockquote>
<pre>
- 1 /etc/postfix/main.cf:
+ 1 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
2 <a href="postconf.5.html#myhostname">myhostname</a> = hostname.localdomain
3 <a href="postconf.5.html#mydomain">mydomain</a> = localdomain
4
9 /etc/postfix/canonical:
10 your-login-name your-account@your-isp.com
11
-12 /etc/postfix/virtual:
+12 /etc/postfix/<a href="virtual.8.html">virtual</a>:
13 your-account@your-isp.com your-login-name
</pre>
</blockquote>
<p> Postfix version 2.2 introduces support for TLS as described in
<a href="http://www.faqs.org/rfcs/rfc3207.html">RFC 3207</a>. TLS Support for older Postfix versions was available as
an add-on patch. The section "<a href="#compat">Compatibility with
-Postfix < 2.2 TLS support</a>" below discusses the differences
+Postfix < 2.2 TLS support</a>" below discusses the differences
between these implementations. </p>
<p> Topics covered in this document: </p>
<li><a href="#problems"> Reporting problems </a>
-<li><a href="#compat">Compatibility with Postfix < 2.2 TLS support</a>
+<li><a href="#compat">Compatibility with Postfix < 2.2 TLS support</a>
<li><a href="#credits"> Credits </a>
</ul>
-<h2><a name="compat">Compatibility with Postfix <2.2 TLS support</a></h2>
+<h2><a name="compat">Compatibility with Postfix < 2.2 TLS support</a></h2>
<p> Postfix version 2.2 TLS support is based on the Postfix/TLS
patch by Lutz Jänicke, but differs in a few minor ways. </p>
</p>
<p>
-To enable this feature, specify a non-zero integral value.
+To enable this feature, specify a non-zero time value (an integral
+value plus an optional one-letter suffix that specifies the time
+unit).
</p>
<p>
(default: yes)</b></DT><DD>
<p> Postpone the start of an SMTP mail transaction until a valid
-RCPT TO command is received. Specify "smtpd_delay_open_until_rcpt =
-yes" to create a mail transaction as soon as the SMTP server receives
-a valid MAIL FROM command. </p>
+RCPT TO command is received. Specify "no" to create a mail transaction
+as soon as the SMTP server receives a valid MAIL FROM command. </p>
-<p> Postponing the start of a mail transaction reduces the use of
+<p> With sites that reject lots of mail, the default setting reduces
+the use of
disk, CPU and memory resources. The downside is that rejected
recipients are logged with NOQUEUE instead of a mail transaction
ID. This complicates the logfile analysis of multi-recipient mail.
<ul>
<li> The sender domain matches $<a href="postconf.5.html#mydestination">mydestination</a>, $<a href="postconf.5.html#inet_interfaces">inet_interfaces</a> or
-$<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a>, but the recipient is not listed in
+$<a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a>, but the sender is not listed in
$<a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a>, and $<a href="postconf.5.html#local_recipient_maps">local_recipient_maps</a> is not null.
-<li> The sender domain matches $<a href="postconf.5.html#virtual_alias_domains">virtual_alias_domains</a> but the recipient
+<li> The sender domain matches $<a href="postconf.5.html#virtual_alias_domains">virtual_alias_domains</a> but the sender
is not listed in $<a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a>.
<li> The sender domain matches $<a href="postconf.5.html#virtual_mailbox_domains">virtual_mailbox_domains</a> but the
-recipient is not listed in $<a href="postconf.5.html#virtual_mailbox_maps">virtual_mailbox_maps</a>, and $<a href="postconf.5.html#virtual_mailbox_maps">virtual_mailbox_maps</a>
+sender is not listed in $<a href="postconf.5.html#virtual_mailbox_maps">virtual_mailbox_maps</a>, and $<a href="postconf.5.html#virtual_mailbox_maps">virtual_mailbox_maps</a>
is not null.
-<li> The sender domain matches $<a href="postconf.5.html#relay_domains">relay_domains</a> but the recipient is
+<li> The sender domain matches $<a href="postconf.5.html#relay_domains">relay_domains</a> but the sender is
not listed in $<a href="postconf.5.html#relay_recipient_maps">relay_recipient_maps</a>, and $<a href="postconf.5.html#relay_recipient_maps">relay_recipient_maps</a> is
not null.
The time after which the sender receives the message headers of
mail that is still queued.
.PP
-To enable this feature, specify a non-zero integral value.
+To enable this feature, specify a non-zero time value (an integral
+value plus an optional one-letter suffix that specifies the time
+unit).
.PP
Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks).
The default time unit is h (hours).
.ft R
.SH smtpd_delay_open_until_valid_rcpt (default: yes)
Postpone the start of an SMTP mail transaction until a valid
-RCPT TO command is received. Specify "smtpd_delay_open_until_rcpt =
-yes" to create a mail transaction as soon as the SMTP server receives
-a valid MAIL FROM command.
+RCPT TO command is received. Specify "no" to create a mail transaction
+as soon as the SMTP server receives a valid MAIL FROM command.
.PP
-Postponing the start of a mail transaction reduces the use of
+With sites that reject lots of mail, the default setting reduces
+the use of
disk, CPU and memory resources. The downside is that rejected
recipients are logged with NOQUEUE instead of a mail transaction
ID. This complicates the logfile analysis of multi-recipient mail.
of forged mail from worms or viruses.
.IP \(bu
The sender domain matches $mydestination, $inet_interfaces or
-$proxy_interfaces, but the recipient is not listed in
+$proxy_interfaces, but the sender is not listed in
$local_recipient_maps, and $local_recipient_maps is not null.
.IP \(bu
-The sender domain matches $virtual_alias_domains but the recipient
+The sender domain matches $virtual_alias_domains but the sender
is not listed in $virtual_alias_maps.
.IP \(bu
The sender domain matches $virtual_mailbox_domains but the
-recipient is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps
+sender is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps
is not null.
.IP \(bu
-The sender domain matches $relay_domains but the recipient is
+The sender domain matches $relay_domains but the sender is
not listed in $relay_recipient_maps, and $relay_recipient_maps is
not null.
.PP
</ul>
-<p> Some details are still preliminary and will change as Postfix
-implements the DSN (delivery status notification) standards. </p>
+<p> Some details depend on Postfix version. The example below is
+for Postfix version 2.3 and later. </p>
<blockquote>
<pre>
Final-Recipient: rfc822; postfix-users@postfix.org
Action: deliverable
Status: 2.0.0
-Diagnostic-Code: X-Postfix; delivery via mail.cloud9.net[168.100.1.4]: 250 Ok
+Remote-MTA: dns; mail.cloud9.net
+Diagnostic-Code: smtp; 250 Ok
</pre>
</blockquote>
<pre>
/etc/postfix/main.cf:
smtpd_restriction_classes = restrictive, permissive
- # With Postfix < 2.3 specify reject_unknown_client.
+ # With Postfix < 2.3 specify reject_unknown_client.
restrictive = reject_unknown_sender_domain reject_unknown_client_hostname ...
permissive = permit
smtpd_client_restrictions = permit_mynetworks, reject
# Don't talk to mail systems that don't know their own hostname.
- # With Postfix < 2.3, specify reject_unknown_hostname.
+ # With Postfix < 2.3, specify reject_unknown_hostname.
smtpd_helo_restrictions = reject_unknown_helo_hostname
# Don't accept mail from domains that don't exist.
</pre>
<p> Line 5 rejects mail from hosts that don't specify a proper
-hostname in the HELO command (with Postfix < 2.3, specify
+hostname in the HELO command (with Postfix < 2.3, specify
reject_unknown_hostname). Lines 4 and 9 make an exception to
allow mail from some machine that announces itself with "HELO
localhost.localdomain". </p>
<p> Execute the command "<b>postmap /etc/postfix/transport</b>"
whenever you change the transport table. </p>
-<p> NOTE: Do not use the fallback_relay feature when relaying mail
+<p> NOTE for Postfix < 2.2: Do not use the fallback_relay feature
+when relaying mail
for a backup or primary MX domain. Mail would loop between the
Postfix MX host and the fallback_relay host when the final destination
is unavailable. </p>
<p> Postfix version 2.2 introduces support for TLS as described in
RFC 3207. TLS Support for older Postfix versions was available as
an add-on patch. The section "<a href="#compat">Compatibility with
-Postfix < 2.2 TLS support</a>" below discusses the differences
+Postfix < 2.2 TLS support</a>" below discusses the differences
between these implementations. </p>
<p> Topics covered in this document: </p>
<li><a href="#problems"> Reporting problems </a>
-<li><a href="#compat">Compatibility with Postfix < 2.2 TLS support</a>
+<li><a href="#compat">Compatibility with Postfix < 2.2 TLS support</a>
<li><a href="#credits"> Credits </a>
</ul>
-<h2><a name="compat">Compatibility with Postfix <2.2 TLS support</a></h2>
+<h2><a name="compat">Compatibility with Postfix < 2.2 TLS support</a></h2>
<p> Postfix version 2.2 TLS support is based on the Postfix/TLS
patch by Lutz Jänicke, but differs in a few minor ways. </p>
</p>
<p>
-To enable this feature, specify a non-zero integral value.
+To enable this feature, specify a non-zero time value (an integral
+value plus an optional one-letter suffix that specifies the time
+unit).
</p>
<p>
<ul>
<li> The sender domain matches $mydestination, $inet_interfaces or
-$proxy_interfaces, but the recipient is not listed in
+$proxy_interfaces, but the sender is not listed in
$local_recipient_maps, and $local_recipient_maps is not null.
-<li> The sender domain matches $virtual_alias_domains but the recipient
+<li> The sender domain matches $virtual_alias_domains but the sender
is not listed in $virtual_alias_maps.
<li> The sender domain matches $virtual_mailbox_domains but the
-recipient is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps
+sender is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps
is not null.
-<li> The sender domain matches $relay_domains but the recipient is
+<li> The sender domain matches $relay_domains but the sender is
not listed in $relay_recipient_maps, and $relay_recipient_maps is
not null.
%PARAM smtpd_delay_open_until_valid_rcpt yes
<p> Postpone the start of an SMTP mail transaction until a valid
-RCPT TO command is received. Specify "smtpd_delay_open_until_rcpt =
-yes" to create a mail transaction as soon as the SMTP server receives
-a valid MAIL FROM command. </p>
+RCPT TO command is received. Specify "no" to create a mail transaction
+as soon as the SMTP server receives a valid MAIL FROM command. </p>
-<p> Postponing the start of a mail transaction reduces the use of
+<p> With sites that reject lots of mail, the default setting reduces
+the use of
disk, CPU and memory resources. The downside is that rejected
recipients are logged with NOQUEUE instead of a mail transaction
ID. This complicates the logfile analysis of multi-recipient mail.
* Parse pseudo-header labels and values.
*/
#define GETLINE(line, buf) \
- (((line) = (buf)) ? ((buf) = split_at((buf), '\n'), (line)) : 0)
+ (((line) = (buf)) != 0 ? ((buf) = split_at((buf), '\n'), (line)) : 0)
while ((GETLINE(cp, tval)) != 0 && (hlen = is_header(cp)) > 0) {
for (hval = cp + hlen; *hval && (*hval == ':' || ISSPACE(*hval)); hval++)
vstring_sprintf(why, "Name service error for name=%s type=%s: "
"Malformed or unexpected name server reply",
name, dns_strtype(type));
+ /* FALLTHROUGH */
case DNS_OK:
return (status);
case DNS_RECURSE:
switch (sscanf(strval, "%d%c%c", &intval, &unit, &junk)) {
case 1:
unit = def_unit;
+ /* FALLTHROUGH */
case 2:
if (intval < 0)
return (0);
extern DSN_BUF *PRINTFLIKE(8, 9) dsb_update(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *, const char *,...);
extern DSN_BUF *PRINTFLIKE(3, 4) dsb_simple(DSN_BUF *, const char *, const char *,...);
extern DSN_BUF *PRINTFLIKE(4, 5) dsb_unix(DSN_BUF *, const char *, const char *, const char *,...);
-extern DSN_BUF *PRINTFLIKE(4, 5) dsb_smtp(DSN_BUF *, const char *, const char *, const char *,...);
extern DSN_BUF *dsb_formal(DSN_BUF *, const char *, const char *, const char *, const char *, const char *, const char *);
extern DSN_BUF *dsb_status(DSN_BUF *, const char *);
extern void dsb_reset(DSN_BUF *);
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20060315"
+#define MAIL_RELEASE_DATE "20060325"
#define MAIL_VERSION_NUMBER "2.3"
#ifdef SNAPSHOT
/* Application-specific. */
-static INET_ADDR_LIST addr_list;
-static INET_ADDR_LIST mask_list;
-static INET_ADDR_LIST proxy_list;
+static INET_ADDR_LIST saved_addr_list;
+static INET_ADDR_LIST saved_mask_list;
+static INET_ADDR_LIST saved_proxy_list;
/* own_inet_addr_init - initialize my own address list */
{
int i;
- if (addr_list.used == 0)
- own_inet_addr_init(&addr_list, &mask_list);
+ if (saved_addr_list.used == 0)
+ own_inet_addr_init(&saved_addr_list, &saved_mask_list);
- for (i = 0; i < addr_list.used; i++)
- if (SOCK_ADDR_EQ_ADDR(addr, addr_list.addrs + i))
+ for (i = 0; i < saved_addr_list.used; i++)
+ if (SOCK_ADDR_EQ_ADDR(addr, saved_addr_list.addrs + i))
return (1);
return (0);
}
INET_ADDR_LIST *own_inet_addr_list(void)
{
- if (addr_list.used == 0)
- own_inet_addr_init(&addr_list, &mask_list);
+ if (saved_addr_list.used == 0)
+ own_inet_addr_init(&saved_addr_list, &saved_mask_list);
- return (&addr_list);
+ return (&saved_addr_list);
}
/* own_inet_mask_list - return list of addresses */
INET_ADDR_LIST *own_inet_mask_list(void)
{
- if (addr_list.used == 0)
- own_inet_addr_init(&addr_list, &mask_list);
+ if (saved_addr_list.used == 0)
+ own_inet_addr_init(&saved_addr_list, &saved_mask_list);
- return (&mask_list);
+ return (&saved_mask_list);
}
/* proxy_inet_addr_init - initialize my proxy interface list */
if (*var_proxy_interfaces == 0)
return (0);
- if (proxy_list.used == 0)
- proxy_inet_addr_init(&proxy_list);
+ if (saved_proxy_list.used == 0)
+ proxy_inet_addr_init(&saved_proxy_list);
- for (i = 0; i < proxy_list.used; i++)
- if (SOCK_ADDR_EQ_ADDR(addr, proxy_list.addrs + i))
+ for (i = 0; i < saved_proxy_list.used; i++)
+ if (SOCK_ADDR_EQ_ADDR(addr, saved_proxy_list.addrs + i))
return (1);
return (0);
}
INET_ADDR_LIST *proxy_inet_addr_list(void)
{
- if (*var_proxy_interfaces != 0 && proxy_list.used == 0)
- proxy_inet_addr_init(&proxy_list);
+ if (*var_proxy_interfaces != 0 && saved_proxy_list.used == 0)
+ proxy_inet_addr_init(&saved_proxy_list);
- return (&proxy_list);
+ return (&saved_proxy_list);
}
#ifdef TEST
static void kill_command(pid_t pid, int sig, uid_t kill_uid, gid_t kill_gid)
{
- pid_t saved_euid = geteuid();
+ uid_t saved_euid = geteuid();
gid_t saved_egid = getegid();
/*
struct addrinfo *res0 = 0;
ssize_t len;
+ /*
+ * The optimizer will eliminate tests that always fail.
+ */
#define RETURN(x) \
do { \
myfree(saved_addr); \
/*
* Change prefix@origin into prefix+user=domain@origin.
*/
- send_local_len = ((cp = strrchr(sender, '@')) ?
+ send_local_len = ((cp = strrchr(sender, '@')) != 0 ?
cp - sender : strlen(sender));
- rcpt_local_len = ((cp = strrchr(recipient, '@')) ?
+ rcpt_local_len = ((cp = strrchr(recipient, '@')) != 0 ?
cp - recipient : strlen(recipient));
vstring_strncpy(buf, sender, send_local_len);
VSTRING_ADDCH(buf, delimiters[0] & 0xff);
#include <events.h>
#include <iostuff.h>
#include <stringops.h>
+#include <mymalloc.h>
/* Global library. */
int status;
RECIPIENT *recipient;
int nrcpt;
+ char *whatsup;
if (dsb == 0)
dsb = dsb_create();
*/
if (status == DELIVER_STAT_CRASH) {
message->flags |= DELIVER_STAT_DEFER;
+#if 0
+ whatsup = concatenate("unknown ", transport->name,
+ " mail transport error", (char *) 0);
+ qmgr_transport_throttle(transport,
+ DSN_SIMPLE(&dsb->dsn, "4.3.0", whatsup));
+ myfree(whatsup);
+#else
qmgr_transport_throttle(transport,
DSN_SIMPLE(&dsb->dsn, "4.3.0",
"unknown mail transport error"));
+#endif
msg_warn("transport %s failure -- see a previous warning/fatal/panic logfile record for the problem description",
transport->name);
* (the todo list); stay away from queue entries that have been selected
* (the busy list), or we would have dangling pointers. The queue itself
* won't go away before we dispose of the current queue entry.
- *
+ *
* XXX Caution: DSN_COPY() will panic on empty status or reason.
*/
#define SUSPENDED "delivery temporarily suspended: "
QMGR_QUEUE *queue;
QMGR_ENTRY *entry;
DSN dsn;
+ char *whatsup;
/*
* Find out if this delivery process is really available. Once elected,
* while some other queue manipulation is happening.
*/
if (qmgr_deliver_initial_reply(stream) != 0) {
+#if 0
+ whatsup = concatenate(transport->name,
+ " mail transport unavailable", (char *) 0);
+ qmgr_transport_throttle(transport,
+ DSN_SIMPLE(&dsn, "4.3.0", whatsup));
+ myfree(whatsup);
+#else
qmgr_transport_throttle(transport,
DSN_SIMPLE(&dsn, "4.3.0",
"mail transport unavailable"));
+#endif
qmgr_defer_transport(transport, &dsn);
(void) vstream_fclose(stream);
return;
*/
if (qmgr_deliver_send_request(entry, stream) < 0) {
qmgr_entry_unselect(queue, entry);
+#if 0
+ whatsup = concatenate(transport->name,
+ " mail transport unavailable", (char *) 0);
+ qmgr_transport_throttle(transport,
+ DSN_SIMPLE(&dsn, "4.3.0", whatsup));
+ myfree(whatsup);
+#else
qmgr_transport_throttle(transport,
DSN_SIMPLE(&dsn, "4.3.0",
"mail transport unavailable"));
+#endif
qmgr_defer_transport(transport, &dsn);
/* warning: entry and queue may be dangling pointers here */
(void) vstream_fclose(stream);
if (info->st.st_uid == var_owner_uid) {
msg_info("%s: uid=%d from=<%s> orig_id=%s", info->id,
(int) info->st.st_uid, info->sender,
- ((name = strrchr(info->path, '/')) ?
+ ((name = strrchr(info->path, '/')) != 0 ?
name + 1 : info->path));
} else {
msg_info("%s: uid=%d from=<%s>", info->id,
/*
* XXX Global so that call-backs can see it.
*/
-static int mode = SHOW_NAME;
+static int cmd_mode = SHOW_NAME;
/* check_myhostname - lookup hostname and validate */
* XXX Do not complain when running as "postconf -d".
*/
name = get_hostname();
- if ((mode & SHOW_DEFS) == 0 && (dot = strchr(name, '.')) == 0) {
+ if ((cmd_mode & SHOW_DEFS) == 0 && (dot = strchr(name, '.')) == 0) {
if ((domain = mail_conf_lookup_eval(VAR_MYDOMAIN)) == 0) {
msg_warn("My hostname %s is not a fully qualified name - set %s or %s in %s/main.cf",
name, VAR_MYHOSTNAME, VAR_MYDOMAIN, var_config_dir);
const char *junk;
if (var_inet_interfaces == 0) {
- if ((mode & SHOW_DEFS)
- || !(junk = mail_conf_lookup_eval(VAR_INET_INTERFACES)))
+ if ((cmd_mode & SHOW_DEFS)
+ || (junk = mail_conf_lookup_eval(VAR_INET_INTERFACES)) == 0)
junk = DEF_INET_INTERFACES;
var_inet_interfaces = mystrdup(junk);
}
if (var_mynetworks_style == 0) {
- if ((mode & SHOW_DEFS)
- || !(junk = mail_conf_lookup_eval(VAR_MYNETWORKS_STYLE)))
+ if ((cmd_mode & SHOW_DEFS)
+ || (junk = mail_conf_lookup_eval(VAR_MYNETWORKS_STYLE)) == 0)
junk = DEF_MYNETWORKS_STYLE;
var_mynetworks_style = mystrdup(junk);
}
if (var_inet_protocols == 0) {
- if ((mode & SHOW_DEFS)
- || !(junk = mail_conf_lookup_eval(VAR_INET_PROTOCOLS)))
+ if ((cmd_mode & SHOW_DEFS)
+ || (junk = mail_conf_lookup_eval(VAR_INET_PROTOCOLS)) == 0)
junk = DEF_INET_PROTOCOLS;
var_inet_protocols = mystrdup(junk);
proto_info = inet_proto_init(VAR_INET_PROTOCOLS, var_inet_protocols);
while ((ch = GETOPT(argc, argv, "aAbc:deEhmlntv")) > 0) {
switch (ch) {
case 'a':
- mode |= SHOW_SASL_SERV;
+ cmd_mode |= SHOW_SASL_SERV;
break;
case 'A':
- mode |= SHOW_SASL_CLNT;
+ cmd_mode |= SHOW_SASL_CLNT;
break;
case 'b':
if (ext_argv)
msg_fatal("out of memory");
break;
case 'd':
- mode |= SHOW_DEFS;
+ cmd_mode |= SHOW_DEFS;
break;
case 'e':
- mode |= EDIT_MAIN;
+ cmd_mode |= EDIT_MAIN;
break;
/*
*/
#if 0
case 'E':
- mode |= SHOW_EVAL;
+ cmd_mode |= SHOW_EVAL;
break;
#endif
case 'h':
- mode &= ~SHOW_NAME;
+ cmd_mode &= ~SHOW_NAME;
break;
case 'l':
- mode |= SHOW_LOCKS;
+ cmd_mode |= SHOW_LOCKS;
break;
case 'm':
- mode |= SHOW_MAPS;
+ cmd_mode |= SHOW_MAPS;
break;
case 'n':
- mode |= SHOW_NONDEF;
+ cmd_mode |= SHOW_NONDEF;
break;
case 't':
if (ext_argv)
/*
* Sanity check.
*/
- junk = (mode & (SHOW_DEFS | SHOW_NONDEF | SHOW_MAPS | SHOW_LOCKS | EDIT_MAIN | SHOW_SASL_SERV | SHOW_SASL_CLNT));
+ junk = (cmd_mode & (SHOW_DEFS | SHOW_NONDEF | SHOW_MAPS | SHOW_LOCKS | EDIT_MAIN | SHOW_SASL_SERV | SHOW_SASL_CLNT));
if (junk != 0 && ((junk != SHOW_DEFS && junk != SHOW_NONDEF
&& junk != SHOW_MAPS && junk != SHOW_LOCKS && junk != EDIT_MAIN
&& junk != SHOW_SASL_SERV && junk != SHOW_SASL_CLNT)
/*
* If showing map types, show them and exit
*/
- if (mode & SHOW_MAPS) {
+ if (cmd_mode & SHOW_MAPS) {
mail_dict_init();
show_maps();
}
/*
* If showing locking methods, show them and exit
*/
- else if (mode & SHOW_LOCKS) {
+ else if (cmd_mode & SHOW_LOCKS) {
show_locks();
}
/*
* If showing SASL plug-in types, show them and exit
*/
- else if (mode & SHOW_SASL_SERV) {
+ else if (cmd_mode & SHOW_SASL_SERV) {
show_sasl(SHOW_SASL_SERV);
- } else if (mode & SHOW_SASL_CLNT) {
+ } else if (cmd_mode & SHOW_SASL_CLNT) {
show_sasl(SHOW_SASL_CLNT);
}
/*
* Edit main.cf.
*/
- else if (mode & EDIT_MAIN) {
+ else if (cmd_mode & EDIT_MAIN) {
edit_parameters(argc - optind, argv + optind);
}
* If showing non-default values, read main.cf.
*/
else {
- if ((mode & SHOW_DEFS) == 0) {
+ if ((cmd_mode & SHOW_DEFS) == 0) {
read_parameters();
set_parameters();
}
* Throw together all parameters and show the asked values.
*/
hash_parameters();
- show_parameters(mode, argv + optind);
+ show_parameters(cmd_mode, argv + optind);
}
vstream_fflush(VSTREAM_OUT);
exit(0);
qmgr_deliver.o: ../../include/mail_queue.h
qmgr_deliver.o: ../../include/msg.h
qmgr_deliver.o: ../../include/msg_stats.h
+qmgr_deliver.o: ../../include/mymalloc.h
qmgr_deliver.o: ../../include/rcpt_print.h
qmgr_deliver.o: ../../include/recipient_list.h
qmgr_deliver.o: ../../include/scan_dir.h
}
#define QMGR_LIST_UNLINK(head, type, object, peers) { \
- type next = object->peers.next; \
- type prev = object->peers.prev; \
- if (prev) prev->peers.next = next; \
- else head.next = next; \
- if (next) next->peers.prev = prev; \
- else head.prev = prev; \
+ type _next = object->peers.next; \
+ type _prev = object->peers.prev; \
+ if (_prev) _prev->peers.next = _next; \
+ else head.next = _next; \
+ if (_next) _next->peers.prev = _prev; \
+ else head.prev = _prev; \
object->peers.next = object->peers.prev = 0; \
}
#include <events.h>
#include <iostuff.h>
#include <stringops.h>
+#include <mymalloc.h>
/* Global library. */
int status;
RECIPIENT *recipient;
int nrcpt;
+ char *whatsup;
if (dsb == 0)
dsb = dsb_create();
*/
if (status == DELIVER_STAT_CRASH) {
message->flags |= DELIVER_STAT_DEFER;
+#if 0
+ whatsup = concatenate("unknown ", transport->name,
+ " mail transport error", (char *) 0);
+ qmgr_transport_throttle(transport,
+ DSN_SIMPLE(&dsb->dsn, "4.3.0", whatsup));
+ myfree(whatsup);
+#else
qmgr_transport_throttle(transport,
DSN_SIMPLE(&dsb->dsn, "4.3.0",
"unknown mail transport error"));
+#endif
msg_warn("transport %s failure -- see a previous warning/fatal/panic logfile record for the problem description",
transport->name);
* (the todo list); stay away from queue entries that have been selected
* (the busy list), or we would have dangling pointers. The queue itself
* won't go away before we dispose of the current queue entry.
- *
+ *
* XXX Caution: DSN_COPY() will panic on empty status or reason.
*/
#define SUSPENDED "delivery temporarily suspended: "
{
QMGR_ENTRY *entry;
DSN dsn;
+ char *whatsup;
/*
* Find out if this delivery process is really available. Once elected,
* while some other queue manipulation is happening.
*/
if (qmgr_deliver_initial_reply(stream) != 0) {
+#if 0
+ whatsup = concatenate(transport->name,
+ " mail transport unavailable", (char *) 0);
+ qmgr_transport_throttle(transport,
+ DSN_SIMPLE(&dsn, "4.3.0", whatsup));
+ myfree(whatsup);
+#else
qmgr_transport_throttle(transport,
DSN_SIMPLE(&dsn, "4.3.0",
"mail transport unavailable"));
+#endif
qmgr_defer_transport(transport, &dsn);
(void) vstream_fclose(stream);
return;
*/
if (qmgr_deliver_send_request(entry, stream) < 0) {
qmgr_entry_unselect(entry);
+#if 0
+ whatsup = concatenate(transport->name,
+ " mail transport unavailable", (char *) 0);
+ qmgr_transport_throttle(transport,
+ DSN_SIMPLE(&dsn, "4.3.0", whatsup));
+ myfree(whatsup);
+#else
qmgr_transport_throttle(transport,
DSN_SIMPLE(&dsn, "4.3.0",
"mail transport unavailable"));
+#endif
qmgr_defer_transport(transport, &dsn);
/* warning: entry may be a dangling pointer here */
(void) vstream_fclose(stream);
}
#define STREQ(x,y) (strcasecmp((x), (y)) == 0)
#define UPDATE_STR(s, v) do { \
+ const char *_v = (v); \
if (s) myfree(s); \
- s = (v) ? mystrdup(v) : 0; \
+ s = (_v) ? mystrdup(_v) : 0; \
} while(0)
/*
* Sanity check.
*/
if (!policy_clnt_table
- || !(policy_clnt = (ATTR_CLNT *) htable_find(policy_clnt_table, server)))
+ || (policy_clnt = (ATTR_CLNT *) htable_find(policy_clnt_table, server)) == 0)
msg_panic("check_policy_service: no client endpoint for server %s",
server);
if (vstream_ftimeout(state->proxy)
|| vstream_ferror(state->proxy)
|| vstream_feof(state->proxy)
- || ((err = vstream_setjmp(state->proxy) != 0)
+ || ((err = vstream_setjmp(state->proxy)) != 0
&& smtpd_proxy_rdwr_error(state->proxy, err))) {
state->error_mask |= MAIL_ERROR_SOFTWARE;
state->err |= CLEANUP_STAT_PROXY;
static int var_tmout;
static VSTRING *buffer;
static void disconnect(SINK_STATE *);
-static int count;
+static int count_deliveries;
static int counter;
/* send_reply - finish conversation */
vstring_sprintf(buffer, "%cOk", QMQP_STAT_OK);
NETSTRING_PUT_BUF(state->stream, buffer);
netstring_fflush(state->stream);
- if (count) {
+ if (count_deliveries) {
counter++;
vstream_printf("%d\r", counter);
vstream_fflush(VSTREAM_OUT);
protocols = INET_PROTO_NAME_IPV6;
break;
case 'c':
- count++;
+ count_deliveries++;
break;
case 'v':
msg_verbose++;
/* tls_session_stop - shut down the TLS connection and reset state */
-void tls_session_stop(SSL_CTX *ctx, VSTREAM *stream, int timeout,
+void tls_session_stop(SSL_CTX *unused_ctx, VSTREAM *stream, int timeout,
int failure, TLScontext_t *TLScontext)
{
const char *myname = "tls_session_stop";
* If no issuer CN field, use Organization instead. CA certs without a CN
* are common, so we only complain if the organization is also missing.
*/
- if (!(cn = tls_text_name(name, NID_commonName, "issuer CN", DONT_GRIPE)))
+ if ((cn = tls_text_name(name, NID_commonName, "issuer CN", DONT_GRIPE)) == 0)
cn = tls_text_name(name, NID_organizationName,
"issuer Organization", DO_GRIPE);
return (cn);
tree = tok822_scan_addr(vstring_str(addr_buf));
/*
- * Let the optimizer replace multiple expansions of this macro by a GOTO
- * to a single instance.
+ * The optimizer will eliminate tests that always fail, and will replace
+ * multiple expansions of this macro by a GOTO to a single instance.
*/
#define FREE_MEMORY_AND_RETURN { \
if (saved_domain) \
*/
tok822_internalize(nextrcpt, tree, TOK822_STR_DEFL);
rcpt_domain = strrchr(STR(nextrcpt), '@') + 1;
+ if (rcpt_domain == 0)
+ msg_panic("no @ in address: \"%s\"", STR(nextrcpt));
if (*rcpt_domain == '[') {
if (!valid_mailhost_literal(rcpt_domain, DONT_GRIPE))
*flags |= RESOLVE_FLAG_ERROR;
tok822_free_tree(tok822_sub_keep_before(tree, tree->tail));
}
-/* rewrite_addr - rewrite address according to rule set */
-
-void rewrite_addr(RWR_CONTEXT *context, char *addr, VSTRING *result)
-{
- TOK822 *tree;
-
- /*
- * Sanity check. An address is supposed to be in externalized form.
- */
- if (*addr == 0) {
- msg_warn("rewrite_addr: null address");
- vstring_strcpy(result, addr);
- return;
- }
-
- /*
- * Convert the address from externalized (quoted) form to token list,
- * rewrite it, and convert back.
- */
- tree = tok822_scan_addr(addr);
- rewrite_tree(context, tree);
- tok822_externalize(result, tree, TOK822_STR_DEFL);
- tok822_free_tree(tree);
-}
-
/* rewrite_proto - read request and send reply */
int rewrite_proto(VSTREAM *stream)
{
RWR_CONTEXT *context;
+ TOK822 *tree;
if (attr_scan(stream, ATTR_FLAG_STRICT,
ATTR_TYPE_STR, MAIL_ATTR_RULE, ruleset,
msg_warn("unknown context: %s", vstring_str(ruleset));
return (-1);
}
- rewrite_addr(context, vstring_str(address), result);
+ /*
+ * Sanity check. An address is supposed to be in externalized form.
+ */
+ if (*vstring_str(address) == 0) {
+ msg_warn("rewrite_addr: null address");
+ vstring_strcpy(result, vstring_str(address));
+ }
+
+ /*
+ * Convert the address from externalized (quoted) form to token list,
+ * rewrite it, and convert back.
+ */
+ else {
+ tree = tok822_scan_addr(vstring_str(address));
+ rewrite_tree(context, tree);
+ tok822_externalize(result, tree, TOK822_STR_DEFL);
+ tok822_free_tree(tree);
+ }
if (msg_verbose)
msg_info("`%s' `%s' -> `%s'", vstring_str(ruleset),
vstring_str(address), vstring_str(result));
{
DICT_NODE *node;
- return ((node = dict_node(dict_name)) ? node->dict : 0);
+ return ((node = dict_node(dict_name)) != 0 ? node->dict : 0);
}
/* dict_node_free - dict_unregister() callback */
*/
switch (status) {
- case DB_NOTFOUND: /* get, del */
- case DB_KEYEXIST: /* put */
- return (1); /* non-fatal */
+ case DB_NOTFOUND: /* get, del */
+ case DB_KEYEXIST: /* put */
+ return (1); /* non-fatal */
case 0:
return (0); /* success */
case DB_KEYEMPTY: /* get, others? */
status = EINVAL;
+ /* FALLTHROUGH */
default:
errno = status;
return (-1); /* fatal */
/* htable_link - insert element into table */
#define htable_link(table, element) { \
- HTABLE_INFO **h = table->data + htable_hash(element->key, table->size);\
+ HTABLE_INFO **_h = table->data + htable_hash(element->key, table->size);\
element->prev = 0; \
- if ((element->next = *h) != 0) \
- (*h)->prev = element; \
- *h = element; \
+ if ((element->next = *_h) != 0) \
+ (*_h)->prev = element; \
+ *_h = element; \
table->used++; \
}
switch (ip[1]) {
default: /* leave %<any> alone */
VSTRING_ADDCH(vp, *ip++);
+ /* FALLTHROUGH */
case '\0': /* don't fall off end */
VSTRING_ADDCH(vp, *ip++);
break;
/* safe_open_create - create new file */
static VSTREAM *safe_open_create(const char *path, int flags, mode_t mode,
- struct stat * st, uid_t user, uid_t group, VSTRING *why)
+ struct stat * st, uid_t user, gid_t group, VSTRING *why)
{
VSTREAM *fp;
#define VBUF_STRCAT(bp, s) { \
unsigned char *_cp = (unsigned char *) (s); \
- int ch; \
- while ((ch = *_cp++) != 0) \
- VBUF_PUT((bp), ch); \
+ int _ch; \
+ while ((_ch = *_cp++) != 0) \
+ VBUF_PUT((bp), _ch); \
}
/* vbuf_print - format string, vsprintf-like interface */
VSTRING_ADDNUM(fmt, width);
cp++;
} else { /* hard-coded field width */
- for (width = 0; ISDIGIT(ch = *cp); cp++) {
+ for (width = 0; ch = *cp, ISDIGIT(ch); cp++) {
width = width * 10 + ch - '0';
VSTRING_ADDCH(fmt, ch);
}
VSTRING_ADDNUM(fmt, prec);
cp++;
} else { /* hard-coded precision */
- for (prec = 0; ISDIGIT(ch = *cp); cp++) {
+ for (prec = 0; ch = *cp, ISDIGIT(ch); cp++) {
prec = prec * 10 + ch - '0';
VSTRING_ADDCH(fmt, ch);
}
/* given to vstream_longjmp().
/*
/* NB: non-local jumps such as vstream_longjmp() are not safe
-/* for jumping out of any vstream routine.
+/* for jumping out of any routine that manipulates VSTREAM data.
+/* longjmp() like calls are best avoided in signal handlers.
/*
/* vstream_ftime() returns the time of initialization, the last buffer
/* fill operation, or the last buffer flush operation for the specified
offset += bp->cnt; /* subtract unread data */
else if (whence == SEEK_END)
bp->flags &= ~VSTREAM_FLAG_SEEK;
+ /* FALLTHROUGH */
case 0:
VSTREAM_BUF_AT_END(bp);
break;