from outside of Postfix. Files: cleanup/cleanup_addr.c.
cleanup/cleanup_envelope.c cleanup/cleanup_extracted.c.
+20030417
+
+ Feature: the SMTP client now falls back to native name
+ service lookups (including /etc/hosts) when a host cannot
+ be found in the DNS. This is controlled by a new parameter
+ smtp_host_lookup (default: dns, native). Files: smtp/smtp.c,
+ smtp/smtp_addr.c.
+
Open problems:
Low: smtp-source may block when sending large test messages.
date. Snapshots change only the release date, unless they include
the same bugfixes as a patch release.
-Incompatible changes with Postfix snapshot 2.0.8-2004XXXX
+Incompatible changes with Postfix snapshot 2.0.8-20030417
=========================================================
"sendmail -t" no longer complains when recipients are given on the
command line. Instead, it now adds recipients from headers to the
-command-line recipients.
+recipients from the command-line.
-Major changes with Postfix snapshot 2.0.8-2004XXXX
+Major changes with Postfix snapshot 2.0.8-20030417
==================================================
-sender_bcc_maps and recipient_bcc_maps, after a reorganization
-of how auto-bcc recipients are added.
+Automatic BCC recipients depending on sender or recipient address.
+The configuration parameters in question are "sender_bcc_maps" and
+"recipient_bcc_maps". See conf/sample-misc.cf for details.
+
+Support for sending mail to hosts not in the DNS, without having
+to turn off DNS lookups. The "smtp_host_lookup" parameter controls
+how the Postfix SMTP client looks up hosts. The default is to use
+DNS and then the native mechanism. See conf/sample-smtp.cf.
Incompatible changes with Postfix snapshot 2.0.8-20040415
=========================================================
# receives a copy of each message that enters the Postfix system,
# not including bounces that are generated locally.
#
+# NOTE: if mail to the BCC address bounces it will be returned to
+# the sender.
+#
always_bcc =
# The daemon_timeout parameter specifies how much time a daemon may
# Specify the types and names of databases to use. After change,
# run "postmap /etc/postfix/relocated", then "postfix reload".
#
+# NOTE: if mail to the BCC address bounces it will be returned to
+# the sender.
+#
#recipient_bcc_maps = hash:/etc/postfix/recipient_bcc
recipient_bcc_maps =
# Specify the types and names of databases to use. After change,
# run "postmap /etc/postfix/relocated", then "postfix reload".
#
+# NOTE: if mail to the BCC address bounces it will be returned to
+# the sender.
+#
#sender_bcc_maps = hash:/etc/postfix/sender_bcc
sender_bcc_maps =
#
smtp_destination_recipient_limit = $default_destination_recipient_limit
+# The smtp_host_lookup parameter specifies what mechanism(s) to use
+# when the SMTP client looks up a host. This parameter is ignored
+# when DNS lookups are disabled.
+#
+# The default is to use both DNS and the native naming service which
+# (also) uses /etc/hosts.
+#
+# Specify "dns" if hosts can be found in the DNS (preferred).
+# Specify "dns, native" if some hosts are not in the DNS.
+# Specify "native" to use the native naming service only.
+#
+#smtp_host_lookup = dns
+smtp_host_lookup = dns, native
+
#
# TIMEOUT CONTROLS
#
This mode of operation is implemented by running
the <a href="smtpd.8.html"><b>smtpd</b>(8)</a> daemon.
- <b>-bv</b> Send an email report after verifying each recipient
- address. Verification always happens in the back-
- ground. This is useful for testing address rewrit-
- ing and routing configurations.
+ <b>-bv</b> Do not collect or deliver a message. Instead, send
+ an email report after verifying each recipient
+ address. This is useful for testing address
+ rewriting and routing configurations.
<b>-f</b> <i>sender</i>
Set the envelope sender address. This is the
Disable DNS lookups. This means that mail must be
forwarded via a smart relay host.
+ <b>smtp</b><i>_</i><b>host</b><i>_</i><b>lookup</b>
+ What host lookup mechanism the SMTP client should
+ use. Specify <b>dns</b> (use DNS lookup) and/or <b>native</b>
+ (use the native naming service which also uses
+ /etc/hosts). This setting is ignored when DNS
+ lookups are disabled.
+
<b>error</b><i>_</i><b>notice</b><i>_</i><b>recipient</b>
Recipient of protocol/policy/resource/software
error notices.
This mode of operation is implemented by running the
\fBsmtpd\fR(8) daemon.
.IP \fB-bv\fR
-Send an email report after verifying each recipient address.
-Verification always happens in the background. This is useful
+Do not collect or deliver a message. Instead, send an email
+report after verifying each recipient address. This is useful
for testing address rewriting and routing configurations.
.IP "\fB-f \fIsender\fR"
Set the envelope sender address. This is the address where
.IP \fBdisable_dns_lookups\fR
Disable DNS lookups. This means that mail must be forwarded
via a smart relay host.
+.IP \fBsmtp_host_lookup\fR
+What host lookup mechanism the SMTP client should use.
+Specify \fBdns\fR (use DNS lookup) and/or \fBnative\fR
+(use the native naming service which also uses /etc/hosts).
+This setting is ignored when DNS lookups are disabled.
.IP \fBerror_notice_recipient\fR
Recipient of protocol/policy/resource/software error notices.
.IP \fBfallback_relay\fR
cleanup_addr.o: ../../include/ext_prop.h
cleanup_addr.o: ../../include/mail_addr.h
cleanup_addr.o: ../../include/canon_addr.h
-cleanup_addr.o: cleanup.h
+cleanup_addr.o: ../../include/mail_addr_find.h
+cleanup_addr.o: ../../include/maps.h
+cleanup_addr.o: ../../include/dict.h
cleanup_addr.o: ../../include/argv.h
+cleanup_addr.o: cleanup.h
cleanup_addr.o: ../../include/nvtable.h
cleanup_addr.o: ../../include/htable.h
-cleanup_addr.o: ../../include/maps.h
-cleanup_addr.o: ../../include/dict.h
cleanup_addr.o: ../../include/tok822.h
cleanup_addr.o: ../../include/resolve_clnt.h
cleanup_addr.o: ../../include/been_here.h
#include <ext_prop.h>
#include <mail_addr.h>
#include <canon_addr.h>
+#include <mail_addr_find.h>
/* Application-specific. */
#include "cleanup.h"
-#define STR vstring_str
+#define STR vstring_str
+#define IGNORE_EXTENSION (char **) 0
/* cleanup_addr_sender - process envelope sender record */
if ((state->flags & CLEANUP_FLAG_BCC_OK)
&& *STR(clean_addr)
&& cleanup_send_bcc_maps
- && (bcc = maps_find(cleanup_send_bcc_maps, STR(clean_addr), 0)) != 0)
+ && (bcc = mail_addr_find(cleanup_send_bcc_maps, STR(clean_addr),
+ IGNORE_EXTENSION)) != 0)
cleanup_addr_bcc(state, bcc);
vstring_free(clean_addr);
}
if ((state->flags & CLEANUP_FLAG_BCC_OK)
&& *STR(clean_addr)
&& cleanup_rcpt_bcc_maps
- && (bcc = maps_find(cleanup_rcpt_bcc_maps, STR(clean_addr), 0)) != 0)
+ && (bcc = mail_addr_find(cleanup_rcpt_bcc_maps, STR(clean_addr),
+ IGNORE_EXTENSION)) != 0)
cleanup_addr_bcc(state, bcc);
vstring_free(clean_addr);
}
#define DEF_DISABLE_DNS 0
extern bool var_disable_dns;
+#define SMTP_HOST_LOOKUP_DNS "dns"
+#define SMTP_HOST_LOOKUP_NATIVE "native"
+
+#define VAR_SMTP_HOST_LOOKUP "smtp_host_lookup"
+#define DEF_SMTP_HOST_LOOKUP SMTP_HOST_LOOKUP_DNS "," SMTP_HOST_LOOKUP_NATIVE
+extern int var_smtp_dns_lookup;
+
/*
* Location of the mail queue directory tree.
*/
* Patches change the patchlevel and the release date. Snapshots change the
* release date only, unless they include the same bugfix as a patch release.
*/
-#define MAIL_RELEASE_DATE "20030416"
+#define MAIL_RELEASE_DATE "20030417"
#define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "2.0.8-" MAIL_RELEASE_DATE
sendmail.o: ../../include/stringops.h
sendmail.o: ../../include/set_ugid.h
sendmail.o: ../../include/connect.h
+sendmail.o: ../../include/split_at.h
sendmail.o: ../../include/mail_queue.h
sendmail.o: ../../include/mail_proto.h
sendmail.o: ../../include/attr.h
sendmail.o: ../../include/verp_sender.h
sendmail.o: ../../include/deliver_request.h
sendmail.o: ../../include/recipient_list.h
+sendmail.o: ../../include/mime_state.h
+sendmail.o: ../../include/header_opts.h
/* This mode of operation is implemented by running the
/* \fBsmtpd\fR(8) daemon.
/* .IP \fB-bv\fR
-/* Send an email report after verifying each recipient address.
-/* Verification always happens in the background. This is useful
+/* Do not collect or deliver a message. Instead, send an email
+/* report after verifying each recipient address. This is useful
/* for testing address rewriting and routing configurations.
/* .IP "\fB-f \fIsender\fR"
/* Set the envelope sender address. This is the address where
char *verp_delims;
/*
- * Context for extracting recipients.
+ * Callback context for extracting recipients.
*/
typedef struct SM_STATE {
VSTREAM *dst; /* output stream */
/* .IP \fBdisable_dns_lookups\fR
/* Disable DNS lookups. This means that mail must be forwarded
/* via a smart relay host.
+/* .IP \fBsmtp_host_lookup\fR
+/* What host lookup mechanism the SMTP client should use.
+/* Specify \fBdns\fR (use DNS lookup) and/or \fBnative\fR
+/* (use the native naming service which also uses /etc/hosts).
+/* This setting is ignored when DNS lookups are disabled.
/* .IP \fBerror_notice_recipient\fR
/* Recipient of protocol/policy/resource/software error notices.
/* .IP \fBfallback_relay\fR
int var_smtp_pix_delay;
int var_smtp_line_limit;
char *var_smtp_helo_name;
+char *var_smtp_host_lookup;
/*
* Global variables. smtp_errno is set by the address lookup routines and by
* the connection management routines.
*/
int smtp_errno;
+int smtp_host_lookup_mask;
/* deliver_message - deliver message with extreme prejudice */
static void pre_init(char *unused_name, char **unused_argv)
{
+ static NAME_MASK lookup_masks[] = {
+ SMTP_HOST_LOOKUP_DNS, SMTP_MASK_DNS,
+ SMTP_HOST_LOOKUP_NATIVE, SMTP_MASK_NATIVE,
+ 0,
+ };
+
+ /*
+ * Turn on per-peer debugging.
+ */
debug_peer_init();
+ /*
+ * Select hostname lookup mechanisms.
+ */
+ if (var_disable_dns)
+ smtp_host_lookup_mask = SMTP_MASK_NATIVE;
+ else
+ smtp_host_lookup_mask = name_mask(VAR_SMTP_HOST_LOOKUP, lookup_masks,
+ var_smtp_host_lookup);
+ if (msg_verbose)
+ msg_info("host name lookup methods: %s",
+ str_name_mask(VAR_SMTP_HOST_LOOKUP, lookup_masks,
+ smtp_host_lookup_mask));
+
+ /*
+ * SASL initialization.
+ */
if (var_smtp_sasl_enable)
#ifdef USE_SASL_AUTH
smtp_sasl_initialize();
static void pre_accept(char *unused_name, char **unused_argv)
{
const char *table;
-
+
if ((table = dict_changed_name()) != 0) {
msg_info("table %s has changed -- restarting", table);
exit(0);
VAR_SMTP_SASL_OPTS, DEF_SMTP_SASL_OPTS, &var_smtp_sasl_opts, 0, 0,
VAR_SMTP_BIND_ADDR, DEF_SMTP_BIND_ADDR, &var_smtp_bind_addr, 0, 0,
VAR_SMTP_HELO_NAME, DEF_SMTP_HELO_NAME, &var_smtp_helo_name, 1, 0,
+ VAR_SMTP_HOST_LOOKUP, DEF_SMTP_HOST_LOOKUP, &var_smtp_host_lookup, 1, 0,
0,
};
static CONFIG_TIME_TABLE time_table[] = {
* smtp.c
*/
extern int smtp_errno; /* XXX can we get rid of this? */
+extern int smtp_host_lookup_mask; /* host lookup methods to use */
+
+#define SMTP_MASK_DNS (1<<0)
+#define SMTP_MASK_NATIVE (1<<1)
/*
* smtp_session.c
}
/*
- * Use gethostbyname() when DNS is disabled.
+ * Use DNS lookup, but keep the option open to use native name service.
*/
- if (var_disable_dns) {
+ if (smtp_host_lookup_mask & SMTP_MASK_DNS) {
+ switch (dns_lookup(host, T_A, RES_DEFNAMES, &addr, (VSTRING *) 0, why)) {
+ case DNS_OK:
+ for (rr = addr; rr; rr = rr->next)
+ rr->pref = pref;
+ addr_list = dns_rr_append(addr_list, addr);
+ return (addr_list);
+ default:
+ smtp_errno = SMTP_RETRY;
+ return (addr_list);
+ case DNS_FAIL:
+ smtp_errno = SMTP_FAIL;
+ return (addr_list);
+ case DNS_NOTFOUND:
+ smtp_errno = SMTP_FAIL;
+ /* maybe gethostbyname() will succeed */
+ break;
+ }
+ }
+
+ /*
+ * Use the native name service which also looks in /etc/hosts.
+ */
+ if (smtp_host_lookup_mask & SMTP_MASK_NATIVE) {
memset((char *) &fixed, 0, sizeof(fixed));
if ((hp = gethostbyname(host)) == 0) {
vstring_sprintf(why, "%s: %s", host, HSTRERROR(h_errno));
}
/*
- * Append the addresses for this host to the address list.
+ * No further alternatives for host lookup.
*/
- switch (dns_lookup(host, T_A, RES_DEFNAMES, &addr, (VSTRING *) 0, why)) {
- case DNS_OK:
- for (rr = addr; rr; rr = rr->next)
- rr->pref = pref;
- addr_list = dns_rr_append(addr_list, addr);
- break;
- default:
- smtp_errno = SMTP_RETRY;
- break;
- case DNS_NOTFOUND:
- case DNS_FAIL:
- smtp_errno = SMTP_FAIL;
- break;
- }
return (addr_list);
}