Bugfix: auto-detection of changes to DB or DBM lookup
tables wan't done for TCP connections.
+19990410
+
+ Feature: $recipient expansion in forward_path. Philip A.
+ Prindeville, Mirapoint, Inc., USA. File: local/dotforward.c
+
+ Feature: the smtp client consistently treats a numerical
+ hostname as an address. File: smtp/smtp_addr.c.
+
+19990414
+
+ Compatibility: support comment lines starting with # in
+ $mydestination include files. This makes Postfix more
+ compatible with sendmail.cw files. File: util/match_list.c.
+
+ Feature: specify "mydomain = domain.name" to have the local
+ domain name automagically appended to $myhostname. Files:
+ global/mail_params.c, postconf/postconf.c.
Future:
mail_name = Postfix
mail_owner = postfix
mail_spool_directory = /var/mail
-mail_version = Snapshot-19990410
+mail_version = Snapshot-19990414
mailbox_command =
mailbox_transport =
maps_rbl_domains = rbl.maps.vix.com
#include <msg.h>
#include <get_hostname.h>
#include <valid_hostname.h>
+#include <stringops.h>
/* Global library. */
{
const char *name;
const char *dot;
+ const char *domain;
+ /*
+ * If the local machine name is not in FQDN form, try to append the
+ * contents of $mydomain.
+ */
name = get_hostname();
- if ((dot = strchr(name, '.')) == 0)
- msg_fatal("My hostname %s is not a FQDN. Set %s in %s/main.cf",
- name, VAR_MYHOSTNAME, var_config_dir);
+ if ((dot = strchr(name, '.')) == 0) {
+ if ((domain = config_lookup_eval(VAR_MYDOMAIN)) == 0)
+ msg_fatal("My hostname %s is not a fully qualified name - "
+ "set %s or %s in %s/main.cf",
+ name, VAR_MYHOSTNAME, VAR_MYDOMAIN, var_config_dir);
+ name = concatenate(name, ".", domain, (char *) 0);
+ }
return (name);
}
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
-#define DEF_MAIL_VERSION "Snapshot-19990410"
+#define DEF_MAIL_VERSION "Snapshot-19990414"
extern char *var_mail_version;
/* LICENSE
struct mypasswd *pwd; /* recipient */
char *extension; /* address extension */
char *domain; /* recipient's domain */
+ char *recipient; /* recipient */
VSTRING *path; /* result */
} FW_CONTEXT;
#define FW_FLAG_EXTENSION (1<<3) /* expanded $extension */
#define FW_FLAG_DELIMITER (1<<4) /* expanded $recipient_delimiter */
#define FW_FLAG_DOMAIN (1<<5) /* expanded $domain */
-#define FW_FLAG_OTHER (1<<5) /* expanded text */
+#define FW_FLAG_RECIPIENT (1<<6) /* expanded $recipient */
+#define FW_FLAG_OTHER (1<<7) /* expanded text */
/* dotforward_parse_callback - callback for mac_parse */
} else if (strcmp(vstring_str(buf), "domain") == 0) {
flg = FW_FLAG_DOMAIN;
ptr = fw_context->domain;
+ } else if (strcmp(vstring_str(buf), "recipient") == 0) {
+ flg = FW_FLAG_RECIPIENT;
+ ptr = fw_context->recipient;
} else
msg_fatal("unknown macro $%s in %s", vstring_str(buf),
VAR_FORWARD_PATH);
fw_context.extension = state.msg_attr.extension;
fw_context.path = path;
fw_context.domain = domain;
+ fw_context.recipient = state.msg_attr.recipient;
lookup_status = -1;
0,
};
+ /*
+ * XXX Global so that call-backs can see it.
+ */
+static int mode = SHOW_NAME;
+
/* check_myhostname - lookup hostname and validate */
static const char *check_myhostname(void)
{
- return (get_hostname());
+ const char *name;
+ const char *dot;
+ const char *domain;
+
+ /*
+ * If the local machine name is not in FQDN form, try to append the
+ * contents of $mydomain.
+ *
+ * XXX Do not complain when running as "postconf -d".
+ */
+ name = get_hostname();
+ if ((mode & SHOW_DEFS) == 0 && (dot = strchr(name, '.')) == 0) {
+ if ((domain = config_lookup_eval(VAR_MYDOMAIN)) == 0)
+ msg_fatal("My hostname %s is not a fully qualified name - "
+ "set %s or %s in %s/main.cf",
+ name, VAR_MYHOSTNAME, VAR_MYDOMAIN, var_config_dir);
+ name = concatenate(name, ".", domain, (char *) 0);
+ }
+ return (name);
}
/* get_myhostname - look up and store my hostname */
int main(int argc, char **argv)
{
int ch;
- int mode = SHOW_NAME;
int fd;
struct stat st;
static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRING *why)
{
char *myname = "smtp_addr_one";
+ struct in_addr inaddr;
+ DNS_FIXED fixed;
DNS_RR *addr = 0;
DNS_RR *rr;
if (msg_verbose)
msg_info("%s: host %s", myname, host);
+ 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)));
+ }
+
/*
* Append the addresses for this host to the address list.
*/
DNS_RR *smtp_host_addr(char *host, VSTRING *why)
{
- DNS_FIXED fixed;
DNS_RR *addr_list;
- struct in_addr addr;
/*
* If the host is specified by numerical address, just convert the
* address to internal form. Otherwise, the host is specified by name.
*/
#define PREF0 0
- if (ISDIGIT(host[0]) && (addr.s_addr = inet_addr(host)) != INADDR_NONE) {
- fixed.type = fixed.class = fixed.ttl = fixed.length = 0;
- addr_list = dns_rr_create(host, &fixed, PREF0,
- (char *) &addr, sizeof(addr));
- } else {
- addr_list = smtp_addr_one((DNS_RR *) 0, host, PREF0, why);
- if (*var_fallback_relay)
- addr_list = smtp_addr_fallback(addr_list);
- }
+ addr_list = smtp_addr_one((DNS_RR *) 0, host, PREF0, why);
+ if (*var_fallback_relay)
+ addr_list = smtp_addr_fallback(addr_list);
if (msg_verbose)
smtp_print_addr(host, addr_list);
return (addr_list);
if ((fp = vstream_fopen(pattern, O_RDONLY, 0)) == 0)
msg_fatal("%s: open file %s: %m", myname, pattern);
while (vstring_fgets(buf, fp))
- list = match_list_parse(list, vstring_str(buf));
+ if (vstring_str(buf)[0] != '#')
+ list = match_list_parse(list, vstring_str(buf));
if (vstream_fclose(fp))
msg_fatal("%s: read file %s: %m", myname, pattern);
} else if (strchr(pattern, ':') != 0) { /* type:table */