2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-09-03 15:45:24 +00:00

snapshot-19990414

This commit is contained in:
Wietse Venema
1999-04-14 00:00:00 -05:00
parent 36937a7745
commit c606018c41
8 changed files with 75 additions and 20 deletions

View File

@@ -2601,6 +2601,23 @@ Apologies for any names omitted.
Bugfix: auto-detection of changes to DB or DBM lookup Bugfix: auto-detection of changes to DB or DBM lookup
tables wan't done for TCP connections. 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: Future:

View File

@@ -61,7 +61,7 @@ luser_relay =
mail_name = Postfix mail_name = Postfix
mail_owner = postfix mail_owner = postfix
mail_spool_directory = /var/mail mail_spool_directory = /var/mail
mail_version = Snapshot-19990410 mail_version = Snapshot-19990414
mailbox_command = mailbox_command =
mailbox_transport = mailbox_transport =
maps_rbl_domains = rbl.maps.vix.com maps_rbl_domains = rbl.maps.vix.com

View File

@@ -98,6 +98,7 @@
#include <msg.h> #include <msg.h>
#include <get_hostname.h> #include <get_hostname.h>
#include <valid_hostname.h> #include <valid_hostname.h>
#include <stringops.h>
/* Global library. */ /* Global library. */
@@ -167,11 +168,20 @@ static const char *check_myhostname(void)
{ {
const char *name; const char *name;
const char *dot; 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(); name = get_hostname();
if ((dot = strchr(name, '.')) == 0) if ((dot = strchr(name, '.')) == 0) {
msg_fatal("My hostname %s is not a FQDN. Set %s in %s/main.cf", if ((domain = config_lookup_eval(VAR_MYDOMAIN)) == 0)
name, VAR_MYHOSTNAME, var_config_dir); 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); return (name);
} }

View File

@@ -15,7 +15,7 @@
* Version of this program. * Version of this program.
*/ */
#define VAR_MAIL_VERSION "mail_version" #define VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "Snapshot-19990410" #define DEF_MAIL_VERSION "Snapshot-19990414"
extern char *var_mail_version; extern char *var_mail_version;
/* LICENSE /* LICENSE

View File

@@ -92,6 +92,7 @@ typedef struct {
struct mypasswd *pwd; /* recipient */ struct mypasswd *pwd; /* recipient */
char *extension; /* address extension */ char *extension; /* address extension */
char *domain; /* recipient's domain */ char *domain; /* recipient's domain */
char *recipient; /* recipient */
VSTRING *path; /* result */ VSTRING *path; /* result */
} FW_CONTEXT; } FW_CONTEXT;
@@ -101,7 +102,8 @@ typedef struct {
#define FW_FLAG_EXTENSION (1<<3) /* expanded $extension */ #define FW_FLAG_EXTENSION (1<<3) /* expanded $extension */
#define FW_FLAG_DELIMITER (1<<4) /* expanded $recipient_delimiter */ #define FW_FLAG_DELIMITER (1<<4) /* expanded $recipient_delimiter */
#define FW_FLAG_DOMAIN (1<<5) /* expanded $domain */ #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 */ /* dotforward_parse_callback - callback for mac_parse */
@@ -134,6 +136,9 @@ static void dotforward_parse_callback(int type, VSTRING *buf, char *context)
} else if (strcmp(vstring_str(buf), "domain") == 0) { } else if (strcmp(vstring_str(buf), "domain") == 0) {
flg = FW_FLAG_DOMAIN; flg = FW_FLAG_DOMAIN;
ptr = fw_context->domain; ptr = fw_context->domain;
} else if (strcmp(vstring_str(buf), "recipient") == 0) {
flg = FW_FLAG_RECIPIENT;
ptr = fw_context->recipient;
} else } else
msg_fatal("unknown macro $%s in %s", vstring_str(buf), msg_fatal("unknown macro $%s in %s", vstring_str(buf),
VAR_FORWARD_PATH); VAR_FORWARD_PATH);
@@ -277,6 +282,7 @@ int deliver_dotforward(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp)
fw_context.extension = state.msg_attr.extension; fw_context.extension = state.msg_attr.extension;
fw_context.path = path; fw_context.path = path;
fw_context.domain = domain; fw_context.domain = domain;
fw_context.recipient = state.msg_attr.recipient;
lookup_status = -1; lookup_status = -1;

View File

@@ -146,11 +146,34 @@ static CONFIG_STR_FN_TABLE str_fn_table_2[] = {
0, 0,
}; };
/*
* XXX Global so that call-backs can see it.
*/
static int mode = SHOW_NAME;
/* check_myhostname - lookup hostname and validate */ /* check_myhostname - lookup hostname and validate */
static const char *check_myhostname(void) 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 */ /* get_myhostname - look up and store my hostname */
@@ -444,7 +467,6 @@ static void show_parameters(int mode, char **names)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int ch; int ch;
int mode = SHOW_NAME;
int fd; int fd;
struct stat st; struct stat st;

View File

@@ -120,12 +120,19 @@ static void smtp_print_addr(char *what, DNS_RR *addr_list)
static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRING *why) static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref, VSTRING *why)
{ {
char *myname = "smtp_addr_one"; char *myname = "smtp_addr_one";
struct in_addr inaddr;
DNS_FIXED fixed;
DNS_RR *addr = 0; DNS_RR *addr = 0;
DNS_RR *rr; DNS_RR *rr;
if (msg_verbose) if (msg_verbose)
msg_info("%s: host %s", myname, host); 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. * Append the addresses for this host to the address list.
*/ */
@@ -366,24 +373,16 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
DNS_RR *smtp_host_addr(char *host, VSTRING *why) DNS_RR *smtp_host_addr(char *host, VSTRING *why)
{ {
DNS_FIXED fixed;
DNS_RR *addr_list; DNS_RR *addr_list;
struct in_addr addr;
/* /*
* If the host is specified by numerical address, just convert the * If the host is specified by numerical address, just convert the
* address to internal form. Otherwise, the host is specified by name. * address to internal form. Otherwise, the host is specified by name.
*/ */
#define PREF0 0 #define PREF0 0
if (ISDIGIT(host[0]) && (addr.s_addr = inet_addr(host)) != INADDR_NONE) { addr_list = smtp_addr_one((DNS_RR *) 0, host, PREF0, why);
fixed.type = fixed.class = fixed.ttl = fixed.length = 0; if (*var_fallback_relay)
addr_list = dns_rr_create(host, &fixed, PREF0, addr_list = smtp_addr_fallback(addr_list);
(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);
}
if (msg_verbose) if (msg_verbose)
smtp_print_addr(host, addr_list); smtp_print_addr(host, addr_list);
return (addr_list); return (addr_list);

View File

@@ -103,7 +103,8 @@ static ARGV *match_list_parse(ARGV *list, char *string)
if ((fp = vstream_fopen(pattern, O_RDONLY, 0)) == 0) if ((fp = vstream_fopen(pattern, O_RDONLY, 0)) == 0)
msg_fatal("%s: open file %s: %m", myname, pattern); msg_fatal("%s: open file %s: %m", myname, pattern);
while (vstring_fgets(buf, fp)) 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)) if (vstream_fclose(fp))
msg_fatal("%s: read file %s: %m", myname, pattern); msg_fatal("%s: read file %s: %m", myname, pattern);
} else if (strchr(pattern, ':') != 0) { /* type:table */ } else if (strchr(pattern, ':') != 0) { /* type:table */