]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
snapshot-20000511
authorWietse Venema <wietse@porcupine.org>
Thu, 11 May 2000 00:00:00 +0000 (00:00 +0000)
committerWietse Venema <wietse@porcupine.org>
Thu, 17 Jan 2013 23:10:48 +0000 (18:10 -0500)
postfix/HISTORY
postfix/global/deliver_pass.c
postfix/global/mail_version.h
postfix/makedefs
postfix/smtpd/smtpd_chat.c
postfix/trivial-rewrite/resolve.c
postfix/util/dict_mysql.c
postfix/util/valid_hostname.c
postfix/util/valid_hostname.in
postfix/util/valid_hostname.ref

index 33ba6aebdf2aa5e0298ecd506bb8011496ae22d6..ac69fdd7431da52af57f5f4eb600b28e48b86879 100644 (file)
@@ -3916,3 +3916,31 @@ Apologies for any names omitted.
        IP address for SMTP client connections. Specify in master.cf
        as "smtp -o smtp_bind_address=x.x.x.x" in order to give
        different delivery agents different source addresses.
+
+20000510
+
+       Cleanup: mailbox_transport did not work with the lmtp
+       delivery agent. This dates back to when Postfix used empty
+       nexthop information to indicate that a destination was
+       local. File: global/deliver_pass.c.
+
+       Bugfix: configuration parameters for one mysql dictionary
+       would become default settings for the next one. File:
+       dict_mysql.c. This patch was merged into Postfix a while
+       back but apparently that Postfix version was nuked when
+       other parts were redesigned. Update by Scott Cotton.
+
+       Bugfix: some Postfix delivery agents would abort on addresses
+       of the form `stuff@.' which could be generated only locally.
+       Found by Patrik Rak. File:  trivial-rewrite/resolve.c.
+
+       Third-party Berkeley DB support for HP-UX by Lamont Jones.
+       File: makedefs.
+
+20000511
+
+       Bugfix: Postfix would incorrectly reject domain names with
+       adjacent - characters. File: util/valid_hostname.c.
+
+       The 20000505 pipeline tarpit delay flush was wrong and
+       caused SMTP protocol errors.
index fea9faafc74bf718e98fbb4d89ae066da026ec4a..9d09490db63f8c2dbcc26edc7d8391ca24e9058f 100644 (file)
@@ -90,7 +90,7 @@ static int deliver_pass_send_request(VSTREAM *stream, DELIVER_REQUEST *request,
     mail_print(stream, "%s %s %ld %ld %s %s %s %s %ld %ld %s %s",
               request->queue_name, request->queue_id,
               request->data_offset, request->data_size,
-              addr, request->sender,
+              request->nexthop, request->sender,
               request->errors_to, request->return_receipt,
               request->arrival_time,
               offs, addr, "0");
index df72da36d3ec066889c61b03268eccbb15c03db5..acb928366004e9db140d7a7907a447262ab61237 100644 (file)
@@ -15,7 +15,7 @@
   * Version of this program.
   */
 #define VAR_MAIL_VERSION       "mail_version"
-#define DEF_MAIL_VERSION       "Snapshot-20000507"
+#define DEF_MAIL_VERSION       "Snapshot-20000511"
 extern char *var_mail_version;
 
 /* LICENSE
index ad6a6414dea30e96f9ee3fd50936dda47fa65dc2..6a95037068ac685b48889089a60ba402356a16e4 100644 (file)
@@ -186,6 +186,9 @@ HP-UX.A.09.*)       SYSTYPE=HPUX9
                    CCARGS="$CCARGS -DHAS_DB"
                    SYSLIBS="$SYSLIBS -ldb"
                fi
+               if [ -f /usr/include/db_185.h ]; then
+                   CCARGS="$CCARGS -DPATH_DB_H='<db_185.h>'"
+               fi
                ;;
 HP-UX.B.10.*)  SYSTYPE=HPUX10
                CCARGS="$CCARGS `nm /usr/lib/libc.a 2>/dev/null |
@@ -194,6 +197,9 @@ HP-UX.B.10.*)       SYSTYPE=HPUX10
                    CCARGS="$CCARGS -DHAS_DB"
                    SYSLIBS=-ldb
                fi
+               if [ -f /usr/include/db_185.h ]; then
+                   CCARGS="$CCARGS -DPATH_DB_H='<db_185.h>'"
+               fi
                ;;
 HP-UX.B.11.*)  SYSTYPE=HPUX11
                SYSLIBS=-lnsl
@@ -201,6 +207,9 @@ HP-UX.B.11.*)       SYSTYPE=HPUX11
                    CCARGS="$CCARGS -DHAS_DB"
                    SYSLIBS="$SYSLIBS -ldb"
                fi
+               if [ -f /usr/include/db_185.h ]; then
+                   CCARGS="$CCARGS -DPATH_DB_H='<db_185.h>'"
+               fi
                ;;
 ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
                RANLIB=echo
index 8c6d437f776d6da4749a37dce0d59e103c5298be..8f267eb4c933885c52bbf56f5e4299762a9d18d5 100644 (file)
@@ -133,6 +133,7 @@ void    smtpd_chat_query(SMTPD_STATE *state)
 void    smtpd_chat_reply(SMTPD_STATE *state, char *format,...)
 {
     va_list ap;
+    int     slept = 0;
 
     va_start(ap, format);
     vstring_vsprintf(state->buffer, format, ap);
@@ -147,16 +148,21 @@ void    smtpd_chat_reply(SMTPD_STATE *state, char *format,...)
      * that abort the connection and go into a connect-error-disconnect loop;
      * sleep-on-anything slows down clients that make an excessive number of
      * errors within a session.
-     * 
-     * Flush unsent output before sleeping. Pipelined error responses could
-     * result in client-side timeouts.
      */
     if (state->error_count > var_smtpd_soft_erlim)
-       vstream_fflush(state->client), sleep(state->error_count);
+       sleep(slept = state->error_count);
     else if (STR(state->buffer)[0] == '4' || STR(state->buffer)[0] == '5')
-       vstream_fflush(state->client), sleep(var_smtpd_err_sleep);
+       sleep(slept = var_smtpd_err_sleep);
 
     smtp_fputs(STR(state->buffer), LEN(state->buffer), state->client);
+
+    /*
+     * Flush unsent output AFTER writing instead of before sleeping (so that
+     * vstream_fflush() flushes the output half of a bidirectional stream).
+     * Pipelined error responses could result in client-side timeouts.
+     */
+    if (slept)
+       (vstream_fflush(state->client));
 }
 
 /* print_line - line_wrap callback */
index 43d932d82c51aa8b04a9c5b3aa05f6b4d71b403b..bc1fa58fbcc7823c708a5476cadd4c4ce0da2b9e 100644 (file)
@@ -110,10 +110,12 @@ void    resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop,
     while (tree->head) {
 
        /*
-        * Strip trailing dot.
+        * Strip trailing dot or @.
         */
-       if (tree->tail->type == '.')
+       if (tree->tail->type == '.' || tree->tail->type == '@') {
            tok822_free_tree(tok822_sub_keep_before(tree, tree->tail));
+           continue;
+       }
 
        /*
         * A lone empty string becomes the postmaster.
index 86c35ade9ea4a45c6c76f7efeb35cb7422287458..6d5fe32a164473b82c1a600e0e4822b38907f02c 100644 (file)
@@ -201,9 +201,9 @@ static const char *dict_mysql_lookup(DICT *dict, const char *name)
 
 /*
  * plmysql_query - process a MySQL query.  Return MYSQL_RES* on success.
- *                On failure, log failure and try other db instances.
- *                on failure of all db instances, return 0;
- *                close unnecessary active connections
+ *                  On failure, log failure and try other db instances.
+ *                  on failure of all db instances, return 0;
+ *                  close unnecessary active connections
  */
 
 static MYSQL_RES *plmysql_query(PLMYSQL *PLDB,
@@ -361,20 +361,29 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
     int     i;
     char   *nameval;
     char   *hosts;
-    /* the name of the dict for processing the mysql options file */
     MYSQL_NAME *name = (MYSQL_NAME *) mymalloc(sizeof(MYSQL_NAME));
     ARGV   *hosts_argv;
-    
-    dict_load_file(mysqlcf_path, mysqlcf_path);
+    VSTRING *opt_dict_name;
+
+    /*
+     * setup a dict containing info in the mysql cf file. the dict has a
+     * name, and a path.  The name must be distinct from the path, or the
+     * dict interface gets confused.  The name must be distinct for two
+     * different paths, or the configuration info will cache across different
+     * mysql maps, which can be confusing.
+     */
+    opt_dict_name = vstring_alloc(64);
+    vstring_sprintf(opt_dict_name, "mysql opt dict %s", mysqlcf_path);
+    dict_load_file(vstring_str(opt_dict_name), mysqlcf_path);
     /* mysql username lookup */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "user")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "user")) == NULL)
        name->username = mystrdup("");
     else
        name->username = mystrdup(nameval);
     if (msg_verbose)
        msg_info("mysqlname_parse(): set username to '%s'", name->username);
     /* password lookup */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "password")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "password")) == NULL)
        name->password = mystrdup("");
     else
        name->password = mystrdup(nameval);
@@ -382,7 +391,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
        msg_info("mysqlname_parse(): set password to '%s'", name->password);
 
     /* database name lookup */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "dbname")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "dbname")) == NULL)
        msg_fatal("%s: mysql options file does not include database name", mysqlcf_path);
     else
        name->dbname = mystrdup(nameval);
@@ -390,7 +399,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
        msg_info("mysqlname_parse(): set database name to '%s'", name->dbname);
 
     /* table lookup */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "table")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "table")) == NULL)
        msg_fatal("%s: mysql options file does not include table name", mysqlcf_path);
     else
        name->table = mystrdup(nameval);
@@ -398,7 +407,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
        msg_info("mysqlname_parse(): set table name to '%s'", name->table);
 
     /* select field lookup */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "select_field")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "select_field")) == NULL)
        msg_fatal("%s: mysql options file does not include select field", mysqlcf_path);
     else
        name->select_field = mystrdup(nameval);
@@ -406,7 +415,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
        msg_info("mysqlname_parse(): set select_field to '%s'", name->select_field);
 
     /* where field lookup */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "where_field")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "where_field")) == NULL)
        msg_fatal("%s: mysql options file does not include where field", mysqlcf_path);
     else
        name->where_field = mystrdup(nameval);
@@ -414,7 +423,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
        msg_info("mysqlname_parse(): set where_field to '%s'", name->where_field);
 
     /* additional conditions */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "additional_conditions")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "additional_conditions")) == NULL)
        name->additional_conditions = mystrdup("");
     else
        name->additional_conditions = mystrdup(nameval);
@@ -422,7 +431,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
        msg_info("mysqlname_parse(): set additional_conditions to '%s'", name->additional_conditions);
 
     /* mysql server hosts */
-    if ((nameval = (char *) dict_lookup(mysqlcf_path, "hosts")) == NULL)
+    if ((nameval = (char *) dict_lookup(vstring_str(opt_dict_name), "hosts")) == NULL)
        hosts = mystrdup("");
     else
        hosts = mystrdup(nameval);
@@ -448,6 +457,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
        }
     }
     myfree(hosts);
+    vstring_free(opt_dict_name);
     argv_free(hosts_argv);
     return name;
 }
@@ -455,7 +465,7 @@ static MYSQL_NAME *mysqlname_parse(const char *mysqlcf_path)
 
 /*
  * plmysql_init - initalize a MYSQL database.
- *               Return NULL on failure, or a PLMYSQL * on success.
+ *                 Return NULL on failure, or a PLMYSQL * on success.
  */
 static PLMYSQL *plmysql_init(char *hostnames[],
                                     int len_hosts)
index 7fff779c37889ec60461b8f04d0b3cf0dd93b90c..9f75963eba47be5130bfed37e4da0ca2edfd4daa 100644 (file)
@@ -81,12 +81,18 @@ int     valid_hostname(const char *name)
            }
            if (!ISDIGIT(ch))
                non_numeric = 1;
-       } else if (ch == '.' || ch == '-') {
+       } else if (ch == '.') {
            if (label_length == 0 || cp[1] == 0) {
                msg_warn("%s: misplaced delimiter: %.100s", myname, name);
                return (0);
            }
            label_length = 0;
+       } else if (ch == '-') {
+           label_length++;
+           if (label_length == 1 || cp[1] == 0 || cp[1] == '.') {
+               msg_warn("%s: misplaced hyphen: %.100s", myname, name);
+               return (0);
+           }
        } else {
            msg_warn("%s: invalid character %d(decimal): %.100s",
                     myname, ch, name);
index 78a6f2419dc68ddea05918a9319bd5bc7f669c18..9d48f5db0e9c7d555c3c0aa19529262b5085860b 100644 (file)
@@ -26,3 +26,13 @@ f1.2.3.4
 1.2.3.4f
 1.2.3.f4
 1.2.3.f
+-.a.b
+a.-.b
+a.b.-
+-aa.b.b
+aa-.b.b
+a.-bb.b
+a.bb-.b
+a.b.-bb
+a.b.bb-
+a-a.b-b
index 44be99fe43ddadfef14bcc90bbe39ff73c7c6035..28e2e737c5d18b96842469ad31fc11023db6d281 100644 (file)
 ./valid_hostname: warning: valid_hostaddr: invalid character 102(decimal): 1.2.3.f4
 ./valid_hostname: testing: "1.2.3.f"
 ./valid_hostname: warning: valid_hostaddr: invalid character 102(decimal): 1.2.3.f
+./valid_hostname: testing: "-.a.b"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: -.a.b
+./valid_hostname: warning: valid_hostaddr: invalid character 45(decimal): -.a.b
+./valid_hostname: testing: "a.-.b"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: a.-.b
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): a.-.b
+./valid_hostname: testing: "a.b.-"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: a.b.-
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): a.b.-
+./valid_hostname: testing: "-aa.b.b"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: -aa.b.b
+./valid_hostname: warning: valid_hostaddr: invalid character 45(decimal): -aa.b.b
+./valid_hostname: testing: "aa-.b.b"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: aa-.b.b
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): aa-.b.b
+./valid_hostname: testing: "a.-bb.b"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: a.-bb.b
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): a.-bb.b
+./valid_hostname: testing: "a.bb-.b"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: a.bb-.b
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): a.bb-.b
+./valid_hostname: testing: "a.b.-bb"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: a.b.-bb
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): a.b.-bb
+./valid_hostname: testing: "a.b.bb-"
+./valid_hostname: warning: valid_hostname: misplaced hyphen: a.b.bb-
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): a.b.bb-
+./valid_hostname: testing: "a-a.b-b"
+./valid_hostname: warning: valid_hostaddr: invalid character 97(decimal): a-a.b-b