From: Wietse Venema Date: Tue, 27 Apr 1999 05:00:00 +0000 (-0500) Subject: snapshot-19990427 X-Git-Tag: v20010228~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bd4ae80262f0485bd8b2bdc263576b34c89f46b;p=thirdparty%2Fpostfix.git snapshot-19990427 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 937953528..8dba72fc5 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -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. + diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 4baa9ed89..642ebf1de 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -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, diff --git a/postfix/conf/main.cf.default b/postfix/conf/main.cf.default index 513781317..0483d9882 100644 --- a/postfix/conf/main.cf.default +++ b/postfix/conf/main.cf.default @@ -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 diff --git a/postfix/global/mail_version.h b/postfix/global/mail_version.h index faa66cf08..ac5e4d83b 100644 --- a/postfix/global/mail_version.h +++ b/postfix/global/mail_version.h @@ -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 diff --git a/postfix/makedefs b/postfix/makedefs index 14846374f..ef7e37e4e 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -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 diff --git a/postfix/smtp/smtp.c b/postfix/smtp/smtp.c index 10a6aa988..81c0188d8 100644 --- a/postfix/smtp/smtp.c +++ b/postfix/smtp/smtp.c @@ -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 diff --git a/postfix/smtp/smtp_addr.c b/postfix/smtp/smtp_addr.c index 2ecd77868..9d32ba074 100644 --- a/postfix/smtp/smtp_addr.c +++ b/postfix/smtp/smtp_addr.c @@ -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 +#include #include #include #include @@ -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 diff --git a/postfix/smtp/smtp_connect.c b/postfix/smtp/smtp_connect.c index 6cd3b2083..1cd81061a 100644 --- a/postfix/smtp/smtp_connect.c +++ b/postfix/smtp/smtp_connect.c @@ -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); diff --git a/postfix/util/sys_defs.h b/postfix/util/sys_defs.h index f0a9f015b..850db0978 100644 --- a/postfix/util/sys_defs.h +++ b/postfix/util/sys_defs.h @@ -98,6 +98,7 @@ extern int opterr; /* XXX use */ #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