-Incompatible changes with snapshot-19990426:
+Incompatible changes with snapshot-19990427:
===========================================
- If an address extension (+foo) matches a user's .forward+foo file
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,
/* 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
/* 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.
/* 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
/* System library. */
#include <sys_defs.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
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);
}
/*
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