2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-09-01 06:35:27 +00:00

postfix-2.0.8-20030417

This commit is contained in:
Wietse Venema
2003-04-17 00:00:00 -05:00
committed by Viktor Dukhovni
parent 310a8503ae
commit 81ada73ca4
17 changed files with 150 additions and 40 deletions

View File

@@ -8001,6 +8001,14 @@ Apologies for any names omitted.
from outside of Postfix. Files: cleanup/cleanup_addr.c. from outside of Postfix. Files: cleanup/cleanup_addr.c.
cleanup/cleanup_envelope.c cleanup/cleanup_extracted.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: Open problems:
Low: smtp-source may block when sending large test messages. Low: smtp-source may block when sending large test messages.

View File

@@ -22,18 +22,24 @@ snapshot release). Patches change the patchlevel and the release
date. Snapshots change only the release date, unless they include date. Snapshots change only the release date, unless they include
the same bugfixes as a patch release. 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 "sendmail -t" no longer complains when recipients are given on the
command line. Instead, it now adds recipients from headers to 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 Automatic BCC recipients depending on sender or recipient address.
of how auto-bcc recipients are added. 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 Incompatible changes with Postfix snapshot 2.0.8-20040415
========================================================= =========================================================

View File

@@ -15,6 +15,9 @@ allow_min_user = no
# receives a copy of each message that enters the Postfix system, # receives a copy of each message that enters the Postfix system,
# not including bounces that are generated locally. # not including bounces that are generated locally.
# #
# NOTE: if mail to the BCC address bounces it will be returned to
# the sender.
#
always_bcc = always_bcc =
# The daemon_timeout parameter specifies how much time a daemon may # The daemon_timeout parameter specifies how much time a daemon may
@@ -416,6 +419,9 @@ recipient_delimiter =
# Specify the types and names of databases to use. After change, # Specify the types and names of databases to use. After change,
# run "postmap /etc/postfix/relocated", then "postfix reload". # 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 = hash:/etc/postfix/recipient_bcc
recipient_bcc_maps = recipient_bcc_maps =
@@ -476,6 +482,9 @@ resolve_dequoted_address = no
# Specify the types and names of databases to use. After change, # Specify the types and names of databases to use. After change,
# run "postmap /etc/postfix/relocated", then "postfix reload". # 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 = hash:/etc/postfix/sender_bcc
sender_bcc_maps = sender_bcc_maps =

View File

@@ -155,6 +155,20 @@ smtp_destination_concurrency_limit = 20
# #
smtp_destination_recipient_limit = $default_destination_recipient_limit 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 # TIMEOUT CONTROLS
# #

View File

@@ -138,10 +138,10 @@ SENDMAIL(1) SENDMAIL(1)
This mode of operation is implemented by running This mode of operation is implemented by running
the <a href="smtpd.8.html"><b>smtpd</b>(8)</a> daemon. the <a href="smtpd.8.html"><b>smtpd</b>(8)</a> daemon.
<b>-bv</b> Send an email report after verifying each recipient <b>-bv</b> Do not collect or deliver a message. Instead, send
address. Verification always happens in the back- an email report after verifying each recipient
ground. This is useful for testing address rewrit- address. This is useful for testing address
ing and routing configurations. rewriting and routing configurations.
<b>-f</b> <i>sender</i> <b>-f</b> <i>sender</i>
Set the envelope sender address. This is the Set the envelope sender address. This is the

View File

@@ -89,6 +89,13 @@ SMTP(8) SMTP(8)
Disable DNS lookups. This means that mail must be Disable DNS lookups. This means that mail must be
forwarded via a smart relay host. 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> <b>error</b><i>_</i><b>notice</b><i>_</i><b>recipient</b>
Recipient of protocol/policy/resource/software Recipient of protocol/policy/resource/software
error notices. error notices.

View File

@@ -121,8 +121,8 @@ run the process as the \fBmail_owner\fR user.
This mode of operation is implemented by running the This mode of operation is implemented by running the
\fBsmtpd\fR(8) daemon. \fBsmtpd\fR(8) daemon.
.IP \fB-bv\fR .IP \fB-bv\fR
Send an email report after verifying each recipient address. Do not collect or deliver a message. Instead, send an email
Verification always happens in the background. This is useful report after verifying each recipient address. This is useful
for testing address rewriting and routing configurations. for testing address rewriting and routing configurations.
.IP "\fB-f \fIsender\fR" .IP "\fB-f \fIsender\fR"
Set the envelope sender address. This is the address where Set the envelope sender address. This is the address where

View File

@@ -95,6 +95,11 @@ specified in the \fBdebug_peer_level\fR parameter.
.IP \fBdisable_dns_lookups\fR .IP \fBdisable_dns_lookups\fR
Disable DNS lookups. This means that mail must be forwarded Disable DNS lookups. This means that mail must be forwarded
via a smart relay host. 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 .IP \fBerror_notice_recipient\fR
Recipient of protocol/policy/resource/software error notices. Recipient of protocol/policy/resource/software error notices.
.IP \fBfallback_relay\fR .IP \fBfallback_relay\fR

View File

@@ -129,12 +129,13 @@ cleanup_addr.o: ../../include/mail_params.h
cleanup_addr.o: ../../include/ext_prop.h cleanup_addr.o: ../../include/ext_prop.h
cleanup_addr.o: ../../include/mail_addr.h cleanup_addr.o: ../../include/mail_addr.h
cleanup_addr.o: ../../include/canon_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/argv.h
cleanup_addr.o: ../../include/nvtable.h
cleanup_addr.o: ../../include/htable.h
cleanup_addr.o: ../../include/maps.h cleanup_addr.o: ../../include/maps.h
cleanup_addr.o: ../../include/dict.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/tok822.h cleanup_addr.o: ../../include/tok822.h
cleanup_addr.o: ../../include/resolve_clnt.h cleanup_addr.o: ../../include/resolve_clnt.h
cleanup_addr.o: ../../include/been_here.h cleanup_addr.o: ../../include/been_here.h

View File

@@ -75,12 +75,14 @@
#include <ext_prop.h> #include <ext_prop.h>
#include <mail_addr.h> #include <mail_addr.h>
#include <canon_addr.h> #include <canon_addr.h>
#include <mail_addr_find.h>
/* Application-specific. */ /* Application-specific. */
#include "cleanup.h" #include "cleanup.h"
#define STR vstring_str #define STR vstring_str
#define IGNORE_EXTENSION (char **) 0
/* cleanup_addr_sender - process envelope sender record */ /* cleanup_addr_sender - process envelope sender record */
@@ -111,7 +113,8 @@ void cleanup_addr_sender(CLEANUP_STATE *state, const char *buf)
if ((state->flags & CLEANUP_FLAG_BCC_OK) if ((state->flags & CLEANUP_FLAG_BCC_OK)
&& *STR(clean_addr) && *STR(clean_addr)
&& cleanup_send_bcc_maps && 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); cleanup_addr_bcc(state, bcc);
vstring_free(clean_addr); vstring_free(clean_addr);
} }
@@ -139,7 +142,8 @@ void cleanup_addr_recipient(CLEANUP_STATE *state, const char *buf)
if ((state->flags & CLEANUP_FLAG_BCC_OK) if ((state->flags & CLEANUP_FLAG_BCC_OK)
&& *STR(clean_addr) && *STR(clean_addr)
&& cleanup_rcpt_bcc_maps && 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); cleanup_addr_bcc(state, bcc);
vstring_free(clean_addr); vstring_free(clean_addr);
} }

View File

@@ -173,6 +173,13 @@ extern char *var_fallback_relay;
#define DEF_DISABLE_DNS 0 #define DEF_DISABLE_DNS 0
extern bool var_disable_dns; 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. * Location of the mail queue directory tree.
*/ */

View File

@@ -20,7 +20,7 @@
* Patches change the patchlevel and the release date. Snapshots change the * Patches change the patchlevel and the release date. Snapshots change the
* release date only, unless they include the same bugfix as a patch release. * 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 VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "2.0.8-" MAIL_RELEASE_DATE #define DEF_MAIL_VERSION "2.0.8-" MAIL_RELEASE_DATE

View File

@@ -73,6 +73,7 @@ sendmail.o: ../../include/iostuff.h
sendmail.o: ../../include/stringops.h sendmail.o: ../../include/stringops.h
sendmail.o: ../../include/set_ugid.h sendmail.o: ../../include/set_ugid.h
sendmail.o: ../../include/connect.h sendmail.o: ../../include/connect.h
sendmail.o: ../../include/split_at.h
sendmail.o: ../../include/mail_queue.h sendmail.o: ../../include/mail_queue.h
sendmail.o: ../../include/mail_proto.h sendmail.o: ../../include/mail_proto.h
sendmail.o: ../../include/attr.h sendmail.o: ../../include/attr.h
@@ -92,3 +93,5 @@ sendmail.o: ../../include/mail_stream.h
sendmail.o: ../../include/verp_sender.h sendmail.o: ../../include/verp_sender.h
sendmail.o: ../../include/deliver_request.h sendmail.o: ../../include/deliver_request.h
sendmail.o: ../../include/recipient_list.h sendmail.o: ../../include/recipient_list.h
sendmail.o: ../../include/mime_state.h
sendmail.o: ../../include/header_opts.h

View File

@@ -115,8 +115,8 @@
/* This mode of operation is implemented by running the /* This mode of operation is implemented by running the
/* \fBsmtpd\fR(8) daemon. /* \fBsmtpd\fR(8) daemon.
/* .IP \fB-bv\fR /* .IP \fB-bv\fR
/* Send an email report after verifying each recipient address. /* Do not collect or deliver a message. Instead, send an email
/* Verification always happens in the background. This is useful /* report after verifying each recipient address. This is useful
/* for testing address rewriting and routing configurations. /* for testing address rewriting and routing configurations.
/* .IP "\fB-f \fIsender\fR" /* .IP "\fB-f \fIsender\fR"
/* Set the envelope sender address. This is the address where /* Set the envelope sender address. This is the address where
@@ -353,7 +353,7 @@
char *verp_delims; char *verp_delims;
/* /*
* Context for extracting recipients. * Callback context for extracting recipients.
*/ */
typedef struct SM_STATE { typedef struct SM_STATE {
VSTREAM *dst; /* output stream */ VSTREAM *dst; /* output stream */

View File

@@ -79,6 +79,11 @@
/* .IP \fBdisable_dns_lookups\fR /* .IP \fBdisable_dns_lookups\fR
/* Disable DNS lookups. This means that mail must be forwarded /* Disable DNS lookups. This means that mail must be forwarded
/* via a smart relay host. /* 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 /* .IP \fBerror_notice_recipient\fR
/* Recipient of protocol/policy/resource/software error notices. /* Recipient of protocol/policy/resource/software error notices.
/* .IP \fBfallback_relay\fR /* .IP \fBfallback_relay\fR
@@ -292,12 +297,14 @@ int var_smtp_pix_thresh;
int var_smtp_pix_delay; int var_smtp_pix_delay;
int var_smtp_line_limit; int var_smtp_line_limit;
char *var_smtp_helo_name; char *var_smtp_helo_name;
char *var_smtp_host_lookup;
/* /*
* Global variables. smtp_errno is set by the address lookup routines and by * Global variables. smtp_errno is set by the address lookup routines and by
* the connection management routines. * the connection management routines.
*/ */
int smtp_errno; int smtp_errno;
int smtp_host_lookup_mask;
/* deliver_message - deliver message with extreme prejudice */ /* deliver_message - deliver message with extreme prejudice */
@@ -401,8 +408,33 @@ static void smtp_service(VSTREAM *client_stream, char *unused_service, char **ar
static void pre_init(char *unused_name, char **unused_argv) 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(); 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) if (var_smtp_sasl_enable)
#ifdef USE_SASL_AUTH #ifdef USE_SASL_AUTH
smtp_sasl_initialize(); smtp_sasl_initialize();
@@ -417,7 +449,7 @@ static void pre_init(char *unused_name, char **unused_argv)
static void pre_accept(char *unused_name, char **unused_argv) static void pre_accept(char *unused_name, char **unused_argv)
{ {
const char *table; const char *table;
if ((table = dict_changed_name()) != 0) { if ((table = dict_changed_name()) != 0) {
msg_info("table %s has changed -- restarting", table); msg_info("table %s has changed -- restarting", table);
exit(0); exit(0);
@@ -447,6 +479,7 @@ int main(int argc, char **argv)
VAR_SMTP_SASL_OPTS, DEF_SMTP_SASL_OPTS, &var_smtp_sasl_opts, 0, 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_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_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, 0,
}; };
static CONFIG_TIME_TABLE time_table[] = { static CONFIG_TIME_TABLE time_table[] = {

View File

@@ -69,6 +69,10 @@ typedef struct SMTP_STATE {
* smtp.c * smtp.c
*/ */
extern int smtp_errno; /* XXX can we get rid of this? */ 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 * smtp_session.c

View File

@@ -175,9 +175,32 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRI
} }
/* /*
* 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)); memset((char *) &fixed, 0, sizeof(fixed));
if ((hp = gethostbyname(host)) == 0) { if ((hp = gethostbyname(host)) == 0) {
vstring_sprintf(why, "%s: %s", host, HSTRERROR(h_errno)); vstring_sprintf(why, "%s: %s", host, HSTRERROR(h_errno));
@@ -200,22 +223,8 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRI
} }
/* /*
* 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); return (addr_list);
} }