]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-19990414
authorWietse Venema <wietse@porcupine.org>
Wed, 14 Apr 1999 05:00:00 +0000 (00:00 -0500)
committerWietse Venema <wietse@porcupine.org>
Thu, 17 Jan 2013 03:34:11 +0000 (22:34 -0500)
postfix/HISTORY
postfix/conf/main.cf.default
postfix/global/mail_params.c
postfix/global/mail_version.h
postfix/local/dotforward.c
postfix/postconf/postconf.c
postfix/smtp/smtp_addr.c
postfix/util/match_list.c

index 48a8751dd1822bb26a5b6767b13fb037b8cecfc0..c9e68603dc5bf6e677bfb44a5e4bfba6eef0f12c 100644 (file)
@@ -2601,6 +2601,23 @@ Apologies for any names omitted.
        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:
 
index e1dd69fa6838ad8e6f692363621e8e40b880b455..eb67f4ea0d7434402e5d320567b79ed73dba3c33 100644 (file)
@@ -61,7 +61,7 @@ luser_relay =
 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
index 856156a920a83f14f41e5f764aabdc77e858c6b0..5731a1c978af64631246a1a6597247ae282c388a 100644 (file)
@@ -98,6 +98,7 @@
 #include <msg.h>
 #include <get_hostname.h>
 #include <valid_hostname.h>
+#include <stringops.h>
 
 /* Global library. */
 
@@ -167,11 +168,20 @@ static const char *check_myhostname(void)
 {
     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);
 }
 
index 67394bfd52ed3552277096e381f25f5e8c87f43e..81a91b85632e5a33556afa1fab33aed8dfc2da5f 100644 (file)
@@ -15,7 +15,7 @@
   * 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
index d3e5b614c999163731389b6e40074f309d102e87..1f49e76710955b55d787a34457704bb42c9989f4 100644 (file)
@@ -92,6 +92,7 @@ typedef struct {
     struct mypasswd *pwd;              /* recipient */
     char   *extension;                 /* address extension */
     char   *domain;                    /* recipient's domain */
+    char   *recipient;                 /* recipient */
     VSTRING *path;                     /* result */
 } FW_CONTEXT;
 
@@ -101,7 +102,8 @@ typedef struct {
 #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 */
 
@@ -134,6 +136,9 @@ static void dotforward_parse_callback(int type, VSTRING *buf, char *context)
        } 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);
@@ -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.path = path;
     fw_context.domain = domain;
+    fw_context.recipient = state.msg_attr.recipient;
 
     lookup_status = -1;
 
index 9cee72ab8015ec38482406582138d8e3aeb67619..d6ec2e3cc0247327a615f4174dd70fb3e9681807 100644 (file)
@@ -146,11 +146,34 @@ static CONFIG_STR_FN_TABLE str_fn_table_2[] = {
     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 */
@@ -444,7 +467,6 @@ static void show_parameters(int mode, char **names)
 int     main(int argc, char **argv)
 {
     int     ch;
-    int     mode = SHOW_NAME;
     int     fd;
     struct stat st;
 
index 380d37cbdcd0e3298d5a8602bdfd2863f821e256..2ecd77868e7684c6a983fb759698a5f221ddde82 100644 (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)
 {
     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.
      */
@@ -366,24 +373,16 @@ DNS_RR *smtp_domain_addr(char *name, VSTRING *why)
 
 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);
index 4f406458a67123fefb123189cbaac7e4a901a6c1..7ae42d6d503e5d5c502bcf41a99fd3a42d76dd4e 100644 (file)
@@ -103,7 +103,8 @@ static ARGV *match_list_parse(ARGV *list, char *string)
            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 */