]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.3-20050427
authorWietse Venema <wietse@porcupine.org>
Wed, 27 Apr 2005 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:31:08 +0000 (06:31 +0000)
16 files changed:
postfix/HISTORY
postfix/README_FILES/RESTRICTION_CLASS_README
postfix/README_FILES/SASL_README
postfix/html/RESTRICTION_CLASS_README.html
postfix/html/SASL_README.html
postfix/proto/RESTRICTION_CLASS_README.html
postfix/proto/SASL_README.html
postfix/src/global/dsn_util.c
postfix/src/global/dsn_util.h
postfix/src/global/mail_version.h
postfix/src/global/mbox_open.c
postfix/src/lmtp/lmtp_addr.c
postfix/src/smtp/smtp_addr.c
postfix/src/smtp/smtp_connect.c
postfix/src/util/argv.c
postfix/src/util/argv.h

index 4c118e4374d6dcf5bbef3b64ec6854ec57555bac..611d00d7951868ca1432cbc011eb6fd59ff18b0b 100644 (file)
@@ -10693,6 +10693,17 @@ Apologies for any names omitted.
        Bugfix: simplified and improved the 20050422 fall-back relay
        fix. File: smtp/smtp_connect.c.
 
+20050427
+
+       Final solution for the 20050422 fall-back relay problem:
+       truncate the fall-back host list when the local MTA is MX
+       for some destination. Files: util/argv.c, smtp/smtp_connect.c.
+
+       Cleanup: extra dsn_vstring_update_dsn() routine to shut up
+       GCC complaints about valid code. Files: src/global/dsn_util.c,
+       src/global/mbox_open.c, src/lmtp/lmtp_addr.c, src/smtp/smtp_addr.c,
+       src/smtp/smtp_connect.c.
+
 Open problems:
 
        Med: disable header address rewriting after XCLIENT?
index 0dc53a08d3c0d74d61b5179159a44df4724eb5e0..be15bc9682f48bf384adec0e7d2da6937229ee23 100644 (file)
@@ -29,7 +29,7 @@ Example:
         smtpd_recipient_restrictions =
        permit_mynetworks
        reject_unauth_destination
-       hash:/etc/postfix/recipient_access
+       check_recipient_access hash:/etc/postfix/recipient_access
 
     /etc/postfix/recipient_access:
         joe@my.domain  permissive
@@ -61,7 +61,7 @@ SMTP client IP address, and therefore is subject to IP spoofing.
 
     /etc/postfix/main.cf:
         smtpd_recipient_restrictions =
-            hash:/etc/postfix/access
+            check_recipient_access hash:/etc/postfix/access
             ...the usual stuff...
 
     /etc/postfix/access:
@@ -86,7 +86,7 @@ subject to SMTP sender spoofing.
 
     /etc/postfix/main.cf:
         smtpd_recipient_restrictions =
-            hash:/etc/postfix/protected_destinations
+            check_recipient_access hash:/etc/postfix/protected_destinations
             ...the usual stuff...
 
         smtpd_restriction_classes = insiders_only
index 0c5eb1112252241d692bfb5c080f821ca1eafd4f..54c65bfcbb97b60d2bc9ee8e6b9f74012820618a 100644 (file)
@@ -295,11 +295,11 @@ sample client. Only then get back to Postfix.
 E\bEn\bna\bab\bbl\bli\bin\bng\bg S\bSA\bAS\bSL\bL a\bau\but\bth\bhe\ben\bnt\bti\bic\bca\bat\bti\bio\bon\bn i\bin\bn t\bth\bhe\be P\bPo\bos\bst\btf\bfi\bix\bx S\bSM\bMT\bTP\bP c\bcl\bli\bie\ben\bnt\bt
 
 Turn on client-side SASL authentication, and specify a table with per-host or
-per-destination username and password information. Postfix first looks up the
-server hostname; if no entry is found, then Postfix looks up the destination
-domain name. Usually, this is the right-hand part of an email address, but it
-can also be a hostname or address enclosed in [], with an optional ":port", as
-specified with relayhost in with transport_maps.
+per-destination username and password information. Postfix first searches the
+table for an entry with the server hostname; if no entry is found, then Postfix
+searches the table for an entry with the next-hop destination. Usually, that is
+the right-hand part of an email address, but it can also be the information
+that is specified with the relayhost parameter or with a transport(5) table.
 
     /etc/postfix/main.cf:
         smtp_sasl_auth_enable = yes
index 857ef431c1e1480fcfc1ed066cbf9ad784d0a2a0..c27f5f060359f7ca206222f508a5503d11a725b7 100644 (file)
@@ -49,7 +49,7 @@ care about these low-level details. </p>
     <a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> = 
        <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a>
        <a href="postconf.5.html#reject_unauth_destination">reject_unauth_destination</a>
-       hash:/etc/postfix/recipient_access
+       <a href="postconf.5.html#check_recipient_access">check_recipient_access</a> hash:/etc/postfix/recipient_access
 
 /etc/postfix/recipient_access:
     joe@my.domain      permissive
@@ -101,7 +101,7 @@ to IP spoofing. </p>
 <pre>
 /etc/postfix/main.cf:
     <a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
-        hash:/etc/postfix/access
+        <a href="postconf.5.html#check_recipient_access">check_recipient_access</a> hash:/etc/postfix/access
         <i>...the usual stuff...</i>
 
 /etc/postfix/access:
@@ -132,7 +132,7 @@ therefore is subject to SMTP sender spoofing. </p>
 <pre>
 /etc/postfix/main.cf:
     <a href="postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a> =
-        hash:/etc/postfix/protected_destinations
+        <a href="postconf.5.html#check_recipient_access">check_recipient_access</a> hash:/etc/postfix/protected_destinations
         <i>...the usual stuff...</i>
 
     <a href="postconf.5.html#smtpd_restriction_classes">smtpd_restriction_classes</a> = insiders_only
index 414aee0a4c793500e04df281ed875478dffdbc8d..e9f45f25b4d399d84a3c14fb3be725d3f5139ff4 100644 (file)
@@ -443,11 +443,12 @@ Postfix SMTP client</a></h2>
 
 <p> Turn on client-side SASL authentication, and specify a table
 with per-host or per-destination username and password information.
-Postfix first looks up the server hostname; if no entry is found,
-then Postfix looks up the destination domain name. Usually, this
-is the right-hand part of an email address, but it can also be a
-hostname or address enclosed in [], with an optional ":port", as
-specified with <a href="postconf.5.html#relayhost">relayhost</a> in with <a href="postconf.5.html#transport_maps">transport_maps</a>. </p>
+Postfix first searches the table for an entry with the server
+hostname; if no entry is found, then Postfix searches the table for
+an entry with the next-hop destination.  Usually, that is the
+right-hand part of an email address, but it can also be the information
+that is specified with the <a href="postconf.5.html#relayhost">relayhost</a> parameter or with a <a href="transport.5.html">transport(5)</a>
+table. </p>
 
 <blockquote>
 <pre>
index 3c5ca182553b6b0dc634133a9357551a60237ee9..c3d85dd15763c836220c50e7826f00b2ab426f04 100644 (file)
@@ -49,7 +49,7 @@ care about these low-level details. </p>
     smtpd_recipient_restrictions = 
        permit_mynetworks
        reject_unauth_destination
-       hash:/etc/postfix/recipient_access
+       check_recipient_access hash:/etc/postfix/recipient_access
 
 /etc/postfix/recipient_access:
     joe@my.domain      permissive
@@ -101,7 +101,7 @@ to IP spoofing. </p>
 <pre>
 /etc/postfix/main.cf:
     smtpd_recipient_restrictions =
-        hash:/etc/postfix/access
+        check_recipient_access hash:/etc/postfix/access
         <i>...the usual stuff...</i>
 
 /etc/postfix/access:
@@ -132,7 +132,7 @@ therefore is subject to SMTP sender spoofing. </p>
 <pre>
 /etc/postfix/main.cf:
     smtpd_recipient_restrictions =
-        hash:/etc/postfix/protected_destinations
+        check_recipient_access hash:/etc/postfix/protected_destinations
         <i>...the usual stuff...</i>
 
     smtpd_restriction_classes = insiders_only
index 931eed9a6ddabdd31fefa8357f55b2272d5704b6..9b019129f5ce6e944adf43939dee6d746648d1f7 100644 (file)
@@ -443,11 +443,12 @@ Postfix SMTP client</a></h2>
 
 <p> Turn on client-side SASL authentication, and specify a table
 with per-host or per-destination username and password information.
-Postfix first looks up the server hostname; if no entry is found,
-then Postfix looks up the destination domain name. Usually, this
-is the right-hand part of an email address, but it can also be a
-hostname or address enclosed in [], with an optional ":port", as
-specified with relayhost in with transport_maps. </p>
+Postfix first searches the table for an entry with the server
+hostname; if no entry is found, then Postfix searches the table for
+an entry with the next-hop destination.  Usually, that is the
+right-hand part of an email address, but it can also be the information
+that is specified with the relayhost parameter or with a transport(5)
+table. </p>
 
 <blockquote>
 <pre>
index 740de2cb98925fd037b22844646988ed4e20e53a..f79d68d1a87abc7965ef3081633b4b0c92a829b6 100644 (file)
 /*     const char *dsn;
 /*     const char *format;
 /*
+/*     DSN_VSTRING *dsn_vstring_update_dsn(dv, dsn)
+/*     DSN_VSTRING *dv;
+/*     const char *dsn;
+/*
 /*     void    dsn_vstring_free(dv)
 /*     DSN_VSTRING *dv;
 /*
@@ -84,6 +88,8 @@
 /*     free text, or both. Specify a null pointer (or zero-length
 /*     string) for information that should not be updated.
 /*
+/*     dsn_vstring_update_dsn() pacifies the gcc compiler.
+/*
 /*     dsn_vstring_free() recycles the storage that was allocated
 /*     by dsn_vstring_alloc() and dsn_vstring_update().
 /*
@@ -261,3 +267,15 @@ DSN_VSTRING *dsn_vstring_update(DSN_VSTRING *dv, const char *dsn,
     }
     return (dv);
 }
+
+/* dsn_vstring_update_dsn - update DSN */
+
+DSN_VSTRING *dsn_vstring_update_dsn(DSN_VSTRING *dv, const char *dsn)
+{
+    size_t  len;
+
+    if ((len = dsn_valid(dsn)) == 0)
+       msg_panic("dsn_vstring_update_dsn: bad dsn: \"%s\"", dsn);
+    DSN_UPDATE(dv->dsn, dsn, len);
+    return (dv);
+}
index 75c44aed5b7f404b59ce073016c33b0e6d4023c2..c78cdedd003e5bf4a94328c7d178dca1a47de5c6 100644 (file)
@@ -73,6 +73,7 @@ typedef struct {
 
 extern DSN_VSTRING *dsn_vstring_alloc(int);
 extern PRINTFLIKE(3, 4) DSN_VSTRING *dsn_vstring_update(DSN_VSTRING *, const char *, const char *,...);
+extern DSN_VSTRING *dsn_vstring_update_dsn(DSN_VSTRING *, const char *);
 extern void dsn_vstring_free(DSN_VSTRING *);
 
 /* LICENSE
index b6236a6c9a945e6cd8ff585a8fa3ea1f879eb5c7..fd71ce1708a22312530e4b30e1c6cd056bbe1cb5 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change the patchlevel and the release date. Snapshots change the
   * release date only.
   */
-#define MAIL_RELEASE_DATE      "20050426"
+#define MAIL_RELEASE_DATE      "20050427"
 #define MAIL_VERSION_NUMBER    "2.3"
 
 #define VAR_MAIL_VERSION       "mail_version"
index 181ac17c70fc6157cfdd12dce803f42dd3fbbb69..bc6f6e233ca385430520b303b5f67888400ac942 100644 (file)
@@ -127,7 +127,7 @@ MBOX   *mbox_open(const char *path, int flags, int mode, struct stat * st,
        st = &local_statbuf;
     if ((fp = safe_open(path, flags | O_NONBLOCK, mode, st,
                        chown_uid, chown_gid, why->vstring)) == 0) {
-       dsn_vstring_update(why, mbox_dsn(errno, def_dsn), "");
+       dsn_vstring_update_dsn(why, mbox_dsn(errno, def_dsn));
        return (0);
     }
     close_on_exec(vstream_fileno(fp), CLOSE_ON_EXEC);
@@ -151,13 +151,13 @@ MBOX   *mbox_open(const char *path, int flags, int mode, struct stat * st,
        if (dot_lockfile(path, why->vstring) == 0) {
            locked |= MBOX_DOT_LOCK;
        } else if (errno == EEXIST) {
-           dsn_vstring_update(why, mbox_dsn(EAGAIN, def_dsn), "");
+           dsn_vstring_update_dsn(why, mbox_dsn(EAGAIN, def_dsn));
            vstream_fclose(fp);
            return (0);
        } else if (lock_style & MBOX_DOT_LOCK_MAY_FAIL) {
            msg_warn("%s", vstring_str(why->vstring));
        } else {
-           dsn_vstring_update(why, mbox_dsn(errno, def_dsn), "");
+           dsn_vstring_update_dsn(why, mbox_dsn(errno, def_dsn));
            vstream_fclose(fp);
            return (0);
        }
@@ -177,7 +177,7 @@ MBOX   *mbox_open(const char *path, int flags, int mode, struct stat * st,
            && HUNKY_DORY(MBOX_FCNTL_LOCK, MYFLOCK_STYLE_FCNTL)) {
            locked |= lock_style;
        } else {
-           dsn_vstring_update(why, mbox_dsn(errno, def_dsn), "");
+           dsn_vstring_update_dsn(why, mbox_dsn(errno, def_dsn));
            if (locked & MBOX_DOT_LOCK)
                dot_unlockfile(path);
            vstream_fclose(fp);
index af44ebb8f3e982a9f19efe76962172b7a4d59a40..50e3c34294775cec13c5c16df01debc2baf6e0ed 100644 (file)
@@ -195,15 +195,15 @@ static DNS_RR *lmtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref,
        addr_list = dns_rr_append(addr_list, addr);
        break;
     default:
-       dsn_vstring_update(why, "4.4.3", "");
+       dsn_vstring_update_dsn(why, "4.4.3");
        lmtp_errno = LMTP_RETRY;
        break;
     case DNS_FAIL:
-       dsn_vstring_update(why, "4.4.3", "");
+       dsn_vstring_update_dsn(why, "4.4.3");
        lmtp_errno = LMTP_FAIL;
        break;
     case DNS_NOTFOUND:
-       dsn_vstring_update(why, "4.4.4", "");
+       dsn_vstring_update_dsn(why, "4.4.4");
        lmtp_errno = LMTP_FAIL;
        break;
     }
index 618dfab9c83422b586ba36786cf7e4136f1c4091..2f17354600ccf4ba5d3fe24dbd717479ee1ba4c0 100644 (file)
@@ -170,16 +170,16 @@ static DNS_RR *smtp_addr_one(DNS_RR *addr_list, char *host, unsigned pref,
            addr_list = dns_rr_append(addr_list, addr);
            return (addr_list);
        default:
-           dsn_vstring_update(why, "4.4.3", "");
+           dsn_vstring_update_dsn(why, "4.4.3");
            smtp_errno = SMTP_ERR_RETRY;
            return (addr_list);
        case DNS_FAIL:
-           dsn_vstring_update(why, "4.4.3", "");
+           dsn_vstring_update_dsn(why, "4.4.3");
            if (smtp_errno != SMTP_ERR_RETRY)
                smtp_errno = SMTP_ERR_FAIL;
            return (addr_list);
        case DNS_NOTFOUND:
-           dsn_vstring_update(why, "4.4.4", "");
+           dsn_vstring_update_dsn(why, "4.4.4");
            if (smtp_errno != SMTP_ERR_RETRY)
                smtp_errno = SMTP_ERR_FAIL;
            /* maybe native naming service will succeed */
@@ -415,13 +415,13 @@ DNS_RR *smtp_domain_addr(char *name, int misc_flags, DSN_VSTRING *why,
      */
     switch (dns_lookup(name, T_MX, 0, &mx_names, (VSTRING *) 0, why->vstring)) {
     default:
-       dsn_vstring_update(why, "4.4.3", "");
+       dsn_vstring_update_dsn(why, "4.4.3");
        smtp_errno = SMTP_ERR_RETRY;
        if (var_ign_mx_lookup_err)
            addr_list = smtp_host_addr(name, misc_flags, why);
        break;
     case DNS_FAIL:
-       dsn_vstring_update(why, "5.4.3", "");
+       dsn_vstring_update_dsn(why, "5.4.3");
        smtp_errno = SMTP_ERR_FAIL;
        if (var_ign_mx_lookup_err)
            addr_list = smtp_host_addr(name, misc_flags, why);
index 73fecccc2469b37afe58b2324659c9e761ee93c5..62c914207fef49c74a9c027a49067e5f679911d4 100644 (file)
@@ -594,7 +594,7 @@ int     smtp_connect(SMTP_STATE *state)
            addr_list = smtp_domain_addr(domain, misc_flags, why, &i_am_mx);
            /* If we're MX host, don't connect to non-MX backups. */
            if (i_am_mx)
-               cpp[1] = 0;
+               argv_truncate(sites, cpp - sites->argv + 1);
        }
        state->final_server = (cpp[1] == 0);
 
@@ -732,7 +732,7 @@ int     smtp_connect(SMTP_STATE *state)
             */
            if (IS_FALLBACK_RELAY(cpp, sites, non_fallback_sites)) {
                msg_warn("%s configuration problem", VAR_FALLBACK_RELAY);
-               dsn_vstring_update(why, "4.3.5", "");
+               dsn_vstring_update_dsn(why, "4.3.5");
                smtp_errno = SMTP_ERR_RETRY;
            }
 
@@ -742,7 +742,7 @@ int     smtp_connect(SMTP_STATE *state)
             */
            else if (strcmp(sites->argv[0], var_relayhost) == 0) {
                msg_warn("%s configuration problem", VAR_RELAYHOST);
-               dsn_vstring_update(why, "4.3.5", "");
+               dsn_vstring_update_dsn(why, "4.3.5");
                smtp_errno = SMTP_ERR_RETRY;
            }
 
index bf3fb84ce294b553189e4eab75e155ec41a55466..33f1843d1bcbf56a52667bc2f31f1a69ed3e8334 100644 (file)
 /*
 /*     void    argv_terminate(argvp);
 /*     ARGV    *argvp;
+/*
+/*     void    argv_truncate(argvp, len);
+/*     ARGV    *argvp;
+/*     int     len;
 /* DESCRIPTION
 /*     The functions in this module manipulate arrays of string
 /*     pointers. An ARGV structure contains the following members:
 /*     returns a null pointer.
 /*
 /*     argv_terminate() null-terminates its string array argument.
+/*
+/*     argv_truncate() trucates its argument to the specified
+/*     number of entries, but does not reallocate memory. The
+/*     result is null-terminated.
 /* SEE ALSO
 /*     msg(3) diagnostics interface
 /* DIAGNOSTICS
@@ -177,3 +185,23 @@ void    argv_terminate(ARGV *argvp)
      */
     argvp->argv[argvp->argc] = 0;
 }
+
+/* argv_truncate - truncate string array */
+
+void    argv_truncate(ARGV *argvp, int len)
+{
+    char  **cpp;
+
+    /*
+     * Sanity check.
+     */
+    if (len < 0)
+       msg_panic("argv_truncate: bad length %d", len);
+
+    if (len < argvp->argc) {
+       for (cpp = argvp->argv + len; cpp < argvp->argv + argvp->argc; cpp++)
+           myfree(*cpp);
+       argvp->argc = len;
+       argvp->argv[argvp->argc] = 0;
+    }
+}
index f490c703464245658c0510ac344dd16eeef3e47d..9c0e7585131b75f582a8a66d71a3e64669c94d92 100644 (file)
@@ -24,6 +24,7 @@ extern ARGV *argv_alloc(int);
 extern void argv_add(ARGV *,...);
 extern void argv_addn(ARGV *,...);
 extern void argv_terminate(ARGV *);
+extern void argv_truncate(ARGV *, int);
 extern ARGV *argv_free(ARGV *);
 
 extern ARGV *argv_split(const char *, const char *);