]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.0.8-20030417
authorWietse Venema <wietse@porcupine.org>
Thu, 17 Apr 2003 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:28:50 +0000 (06:28 +0000)
17 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/conf/sample-misc.cf
postfix/conf/sample-smtp.cf
postfix/html/sendmail.1.html
postfix/html/smtp.8.html
postfix/man/man1/sendmail.1
postfix/man/man8/smtp.8
postfix/src/cleanup/Makefile.in
postfix/src/cleanup/cleanup_addr.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/sendmail/Makefile.in
postfix/src/sendmail/sendmail.c
postfix/src/smtp/smtp.c
postfix/src/smtp/smtp.h
postfix/src/smtp/smtp_addr.c

index 08dc03abfdabba406b37c2a82a0b64f23361cdc9..d8d34834f02ea72bdefe4e8a0bf331fb3927d205 100644 (file)
@@ -8001,6 +8001,14 @@ Apologies for any names omitted.
        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.
index 2ea6bc9f4637fd8e7aba224e6ab62d8b39f33617..e5f168aa08da7509f67a8639f210ab193ec290d6 100644 (file)
@@ -22,18 +22,24 @@ snapshot release).  Patches change the patchlevel and the release
 date. Snapshots change only the release date, unless they include
 the same bugfixes as a patch release.
 
-Incompatible changes with Postfix snapshot 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
 =========================================================
index 1ec322d2001a01b886ddd28b11a4d87f784d535c..b97e9ee62decee0d48c4a65342d2f4cd3b007155 100644 (file)
@@ -15,6 +15,9 @@ allow_min_user = no
 # 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
@@ -416,6 +419,9 @@ recipient_delimiter =
 # 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 =
 
@@ -476,6 +482,9 @@ resolve_dequoted_address = no
 # 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 =
 
index 1ab352468f57d1d3bf258659794bcbff53e3c7f5..19b76893b51cd8ecf3f4c933832a9e77b213269b 100644 (file)
@@ -155,6 +155,20 @@ smtp_destination_concurrency_limit = 20
 #
 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
 #
index a5804b223a346b2a3290e6e5564ca1ec6e467dda..cbdf2d5c6ab4f6659831f7b64ffe098e9a8d313a 100644 (file)
@@ -138,10 +138,10 @@ SENDMAIL(1)                                           SENDMAIL(1)
               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
index d33b3af5309aad48c1d9b854ff272d2a6eda0dcc..be7b18649bd4824b88925dc1729ad64cbdc693c1 100644 (file)
@@ -89,6 +89,13 @@ SMTP(8)                                                   SMTP(8)
               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.
index e7453eb8d26541716de2ff4ded93e428ea228daf..5f453991af860258debab0d32d677afd5da5fd5e 100644 (file)
@@ -121,8 +121,8 @@ run the process as the \fBmail_owner\fR user.
 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
index 64fa7fae7e2f0c68ce87ebe0bb14d26f8a204524..1ca75585d41b88c767a9133950159df7d249ec75 100644 (file)
@@ -95,6 +95,11 @@ specified in the \fBdebug_peer_level\fR parameter.
 .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
index d3d8832dbf79d989c57742237ac151b7b40a2872..6ad1ee0ac02b0e0e93bca7980fc1c7b3dc4a580e 100644 (file)
@@ -129,12 +129,13 @@ cleanup_addr.o: ../../include/mail_params.h
 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
index b52a27a1820be1359034ff90ee91bc604e365d02..8c7f2f8920d7749c7029fbdbc23c9c2469ea7ee7 100644 (file)
 #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 */
 
@@ -111,7 +113,8 @@ void    cleanup_addr_sender(CLEANUP_STATE *state, const char *buf)
     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);
 }
@@ -139,7 +142,8 @@ void    cleanup_addr_recipient(CLEANUP_STATE *state, const char *buf)
     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);
 }
index 67cc4ea05c8795e665a7746d811a268c44862421..3c8021d5d8f9092bcc13342ccf4a9ef0695956db 100644 (file)
@@ -173,6 +173,13 @@ extern char *var_fallback_relay;
 #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.
   */
index cff3dd02cd643549ec1b799441281ce99bd98fa6..d31e34b0b5bcc443a7cd245c64637a2cc2444dc8 100644 (file)
@@ -20,7 +20,7 @@
   * 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
index 50d16cca453fbe0d39de854ead8d4cf0ccb0c127..7fdaae2327ac2d221e28ab6e04efc81e51f40057 100644 (file)
@@ -73,6 +73,7 @@ sendmail.o: ../../include/iostuff.h
 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
@@ -92,3 +93,5 @@ sendmail.o: ../../include/mail_stream.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
index 38e604c16ac2de2f081fa859f5845e46b6b6eef4..26989db70ec82543161b88476597e38c7098e31b 100644 (file)
 /*     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 */
index 8e8e9519beae24f4cf78d091c6f9f83a970963f6..f6c0a4c24320e83a8f8ea8ec363591ef84437b7e 100644 (file)
 /* .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
@@ -292,12 +297,14 @@ int     var_smtp_pix_thresh;
 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 */
 
@@ -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 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();
@@ -417,7 +449,7 @@ static void pre_init(char *unused_name, char **unused_argv)
 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);
@@ -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_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[] = {
index a3baeba6ccc1c626a4eab89a3350336a51215275..c4500d1d1f1a6c4d2c0b88e41d8a277914c3620c 100644 (file)
@@ -69,6 +69,10 @@ typedef struct SMTP_STATE {
   * 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
index 9235fe50216a21976e2d36d083076c69ebeb516c..021496b3ecafee619123006f80d64b4ad56cb7d1 100644 (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));
        if ((hp = gethostbyname(host)) == 0) {
            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);
 }