]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-19990427
authorWietse Venema <wietse@porcupine.org>
Tue, 27 Apr 1999 05:00:00 +0000 (00:00 -0500)
committerWietse Venema <wietse@porcupine.org>
Thu, 17 Jan 2013 03:34:16 +0000 (22:34 -0500)
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/conf/main.cf.default
postfix/global/mail_version.h
postfix/makedefs
postfix/smtp/smtp.c
postfix/smtp/smtp_addr.c
postfix/smtp/smtp_connect.c
postfix/util/sys_defs.h

index 937953528aad1e7fa46951738ee033fbb64fec23..8dba72fc5c6f410e6747b11ea2199a9b8f83debc 100644 (file)
@@ -2681,3 +2681,9 @@ Apologies for any names omitted.
        "host.domain    error:host.domain is unavailable". Too bad
        that the transport table triggers on destination domain
        only; it would be nice to bounce specific users as well.
+
+19990427
+
+       Cleanup: "disable_dns_lookups = yes" now should disable
+       all DNS lookups by the SMTP client.
+
index 4baa9ed89299800d53805ce08103c159764fbd88..642ebf1de2eb1eb9493635cfc82e4c0a1eede39f 100644 (file)
@@ -1,4 +1,4 @@
-Incompatible changes with snapshot-19990426:
+Incompatible changes with snapshot-19990427:
 ===========================================
 
 - If an address extension (+foo) matches a user's .forward+foo file
@@ -6,7 +6,7 @@ name, the +foo extension is no longer appended to recipient addresses
 listed in the .forward+foo file. This is more consistent with the
 way Postfix expands aliases.
 
-Major changes with snapshot-19990426:
+Major changes with snapshot-19990427:
 =====================================
 
 In addition to several little bugfixes, none related to security,
index 51378131788b924116386f3b1b3ed4370dd16599..0483d9882b0d1edfe65def3e8b54e9dbce838082 100644 (file)
@@ -61,7 +61,7 @@ luser_relay =
 mail_name = Postfix
 mail_owner = postfix
 mail_spool_directory = /var/mail
-mail_version = Snapshot-19990426
+mail_version = Snapshot-19990427
 mailbox_command = 
 mailbox_transport = 
 maps_rbl_domains = rbl.maps.vix.com
index faa66cf08fee7d0a17021191604db8151a2f51d4..ac5e4d83b328b212e07c2c7f8ee5079b1550f301 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-19990426"
+#define DEF_MAIL_VERSION       "Snapshot-19990427"
 extern char *var_mail_version;
 
 /* LICENSE
index 14846374f34bfa520291a6e10818eb93b09c4625..ef7e37e4e9288216bf4191bfa09f188b3435101f 100644 (file)
@@ -102,7 +102,8 @@ case "$SYSTEM.$RELEASE" in
                RANLIB=echo
                SYSLIBS="-lresolv -lsocket -lnsl"
                case $RELEASE in
-                   5.[0-4]) CCARGS="$CCARGS -Dusleep=doze"
+                   5.[0-4]) CCARGS="$CCARGS -Dusleep=doze";;
+                         *) CCARGS="$CCARGS -DHAS_POSIX_REGEXP";;
                esac
                # Avoid common types of braindamage
                case "$LD_LIBRARY_PATH" in
index 10a6aa988178088e0cedf69c65942b8656ef3280..81c0188d807d25b0dac25ef075d3935983222f98 100644 (file)
@@ -66,6 +66,9 @@
 /*     List of domain or network patterns. When a remote host matches
 /*     a pattern, increase the verbose logging level by the amount
 /*     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 \fBerror_notice_recipient\fR
 /*     Recipient of protocol/policy/resource/software error notices.
 /* .IP \fBfallback_relay\fR
index 2ecd77868e7684c6a983fb759698a5f221ddde82..9d32ba0749a459f88717a29837d5ad3671619f47 100644 (file)
@@ -16,7 +16,9 @@
 /* DESCRIPTION
 /*     This module implements Internet address lookups. By default,
 /*     lookups are done via the Internet domain name service (DNS).
-/*     A reasonable number of CNAME indirections is permitted.
+/*     A reasonable number of CNAME indirections is permitted. When
+/*     DNS lookups are disabled, host address lookup is done with
+/*     gethostbyname().
 /*
 /*     smtp_domain_addr() looks up the network addresses for mail
 /*     exchanger hosts listed for the named domain. Addresses are
@@ -30,6 +32,9 @@
 /*     When no mail exchanger is listed in the DNS for \fIname\fR, the
 /*     request is passed to smtp_host_addr().
 /*
+/*     It is an error to call smtp_domain_addr() when DNS lookups are
+/*     disabled.
+/*
 /*     smtp_host_addr() looks up all addresses listed for the named
 /*     host.  The host can be specified as a numerical Internet network
 /*     address, or as a symbolic host name.
@@ -37,6 +42,9 @@
 /*     Results from smtp_domain_addr() or smtp_host_addr() are
 /*     destroyed by dns_rr_free(), including null lists.
 /* DIAGNOSTICS
+/*     Panics: interface violations. For example, calling smtp_domain_addr()
+/*     when DNS lookups are explicitly disabled.
+/*
 /*     All routines either return a DNS_RR pointer, or return a null
 /*     pointer and set the \fIsmtp_errno\fR global variable accordingly:
 /* .IP SMTP_RETRY
@@ -60,6 +68,7 @@
 /* System library. */
 
 #include <sys_defs.h>
+#include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
@@ -124,13 +133,44 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRI
     DNS_FIXED fixed;
     DNS_RR *addr = 0;
     DNS_RR *rr;
+    struct hostent *hp;
 
     if (msg_verbose)
        msg_info("%s: host %s", myname, host);
 
+    /*
+     * Interpret a numerical name as an address.
+     */
     if (ISDIGIT(host[0]) && (inaddr.s_addr = inet_addr(host)) != INADDR_NONE) {
        memset((char *) &fixed, 0, sizeof(fixed));
-       return (dns_rr_create(host, &fixed, pref, (char *) &inaddr, sizeof(inaddr)));
+       return (dns_rr_append(addr_list,
+                             dns_rr_create(host, &fixed, pref,
+                                       (char *) &inaddr, sizeof(inaddr))));
+    }
+
+    /*
+     * Use gethostbyname() when DNS is disabled.
+     */
+    if (var_disable_dns) {
+       memset((char *) &fixed, 0, sizeof(fixed));
+       if ((hp = gethostbyname(host)) == 0) {
+           vstring_sprintf(why, "%s: host not found", host);
+           smtp_errno = SMTP_FAIL;
+       } else if (hp->h_addrtype != AF_INET) {
+           vstring_sprintf(why, "%s: host not found", host);
+           msg_warn("%s: unknown address family %d for %s",
+                    myname, hp->h_addrtype, host);
+           smtp_errno = SMTP_FAIL;
+       } else {
+           while (hp->h_addr_list[0]) {
+               addr_list = dns_rr_append(addr_list,
+                                         dns_rr_create(host, &fixed, pref,
+                                                       hp->h_addr_list[0],
+                                                       sizeof(inaddr)));
+               hp->h_addr_list++;
+           }
+       }
+       return (addr_list);
     }
 
     /*
@@ -326,6 +366,12 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
     DNS_RR *addr_list = 0;
     DNS_RR *self;
 
+    /*
+     * Sanity check.
+     */
+    if (var_disable_dns)
+       msg_panic("smtp_domain_addr: DNS lookup is disabled");
+
     /*
      * Look up the mail exchanger hosts listed for this name. Sort the
      * results by preference. Look up the corresponding host addresses, and
index 6cd3b208364db39d9ceccd8d11e4aa09c7c65dee..1cd81061ab0a68d78e17dec8db7bd9789023dc60 100644 (file)
@@ -345,11 +345,11 @@ SMTP_SESSION *smtp_connect(char *destination, VSTRING *why)
 
     /*
      * Connect to an SMTP server. Skip mail exchanger lookups when a quoted
-     * host is specified.
+     * host is specified, or when DNS lookups are disabled.
      */
     if (msg_verbose)
        msg_info("connecting to %s port %d", host, ntohs(port));
-    if (*destination == '[') {
+    if (var_disable_dns || *destination == '[') {
        session = smtp_connect_host(host, port, why);
     } else {
        session = smtp_connect_domain(host, port, why);
index f0a9f015b0893a26ccc95789e3a80c6efac6225f..850db0978db14d1870aaf26a52bfb5a49ae6be00 100644 (file)
@@ -98,6 +98,7 @@ extern int opterr;                    /* XXX use <getopt.h> */
 #define ROOT_PATH      "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
 #define USE_STATFS
 #define STATFS_IN_SYS_MOUNT_H
+#define HAS_POSIX_REGEXP
 #endif
 
 #ifdef SUNOS4