]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.5-20070511
authorWietse Venema <wietse@porcupine.org>
Fri, 11 May 2007 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:33:08 +0000 (06:33 +0000)
22 files changed:
postfix/.indent.pro
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/html/cidr_table.5.html
postfix/html/postconf.5.html
postfix/html/postsuper.1.html
postfix/makedefs
postfix/man/man1/postsuper.1
postfix/man/man5/cidr_table.5
postfix/man/man5/postconf.5
postfix/proto/cidr_table
postfix/proto/postconf.proto
postfix/src/cleanup/cleanup_message.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/global/resolve_clnt.c
postfix/src/global/rewrite_clnt.c
postfix/src/postsuper/postsuper.c
postfix/src/trivial-rewrite/trivial-rewrite.c
postfix/src/xsasl/xsasl_cyrus_client.c
postfix/src/xsasl/xsasl_cyrus_server.c
postfix/src/xsasl/xsasl_dovecot_server.c

index f590fce21a5770ca2e41082ddca4132ca5d6c6dd..7fde1b246cc3a0cd626111a95c8935fb7ab8652a 100644 (file)
 -TXSASL_CYRUS_CLIENT
 -TXSASL_CYRUS_ERROR_INFO
 -TXSASL_CYRUS_SERVER
+-TXSASL_DCSRV_MECH
 -TXSASL_DOVECOT_SERVER
 -TXSASL_DOVECOT_SERVER_IMPL
 -TXSASL_DOVECOT_SERVER_MECHS
index 528ce0fd3931e1dfcc8f63ed810ec796a3ae6055..ed883f525c1edc7637ef24e04c9cd7ce1f2d16dc 100644 (file)
@@ -13514,8 +13514,35 @@ Apologies for any names omitted.
        from localhost[127.0.0.1]. Files: smtpd/smtpd_peer.c,
        qmqpd/qmqpd_peer.c.
 
+20070502
+
+       Workaround: build without EPOLL support when an epoll-enabled
+       kernel sits underneath a retarded libc.  File: makedefs.
+
+       Cleanup: missing support for SASL security properties with
+       Dovecot SASL authentication. Based on an initial version
+       by Lev A. Serebryakov.  File: xsasl/xsasl_dovecot_server.c.
+
+20070503
+
+       Cleanup: changed the default address verification sender
+       from "postmaster" to "double-bounce", so that the Postfix
+       SMTP server no longer surprises unsuspecting people by
+       excluding "postmaster" from SMTPD access controls.  File:
+       global/mail_params.h.
+
+20070508
+
+       Bugfix: Content-Transfer-Encoding: attribute values are
+       case insensitive. File: src/cleanup/cleanup_message.c.
+
+
 Wish list:
 
+       Would there be a problem adding $smtpd_mumble_restrictions
+       and $smtpd_sender_login_maps to the default proxy_read_maps
+       settings?
+
        Remove defer(8) and trace(8) references and man pages. These
        are services not program names.
 
index 543da6e995b8ed613929a072c2f897c18ee7d0a0..0854006868f846794263e8376993f65a70f946ef 100644 (file)
@@ -17,6 +17,14 @@ Incompatibility with Postfix 2.3 and earlier
 If you upgrade from Postfix 2.3 or earlier, read RELEASE_NOTES-2.4
 before proceeding.
 
+Incompatibility with Postfix snapshot 2007XXXX
+==============================================
+
+The default sender address for address verification probes was
+changed from "postmaster" to "double-bounce", so that the Postfix
+SMTP server no longer causes surprising behavior by excluding
+"postmaster" from SMTP server access controls.
+
 Incompatibility with Postfix snapshot 20070422
 ==============================================
 
index fb721fd022dc0a6edd4160d131b1b93f8a46de41..09689d910f9f53aeb6dbedc10587e6e4ef64df67 100644 (file)
@@ -90,6 +90,9 @@ CIDR_TABLE(5)                                                    CIDR_TABLE(5)
 <b>README FILES</b>
        <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
 
+<b>HISTORY</b>
+       CIDR table support was introduced with Postfix version 2.1.
+
 <b>AUTHOR(S)</b>
        The CIDR table lookup code was originally written by:
        Jozsef Kadlecsik
index cd9cde3354c6e1da4f119a3f5c486e4903942702..c1fbb218bb756492acb285a02909477553f6e224 100644 (file)
@@ -344,9 +344,10 @@ This feature is available in Postfix 2.1 and later.
 </DD>
 
 <DT><b><a name="address_verify_sender">address_verify_sender</a>
-(default: postmaster)</b></DT><DD>
+(default: $<a href="postconf.5.html#double_bounce_sender">double_bounce_sender</a>)</b></DT><DD>
 
-<p> The sender address to use in address verification probes. To
+<p> The sender address to use in address verification probes; prior
+to Postfix 2.5 the default was "postmaster". To
 avoid problems with address probes that are sent in response to
 address probes, the Postfix SMTP server excludes the probe sender
 address from all SMTPD access blocks. </p>
@@ -10566,10 +10567,15 @@ Specify zero or more of the following:
 
 <dd>Disallow methods that allow anonymous authentication. </dd>
 
+<dt><b>forward_secrecy</b></dt>
+
+<dd>Only allow methods that support forward secrecy (Dovecot only).
+</dd>
+
 <dt><b>mutual_auth</b></dt>
 
 <dd>Only allow methods that provide mutual authentication (not available
-with SASL version 1). </dd>
+with Cyrus SASL version 1). </dd>
 
 </dl>
 
index 44c6e6e460c74862df8f08881c42047580fc8a52..2445c48651b8319896fab337aa7f47dbf2015deb 100644 (file)
@@ -101,23 +101,27 @@ POSTSUPER(1)                                                      POSTSUPER(1)
               ting.  It becomes subject to expiration after it is
               released from "hold".
 
+              This feature is available in Postfix 2.0 and later.
+
        <b>-H</b> <i>queue</i><b>_</b><i>id</i>
               Release mail that was put "on hold".  Move one mes-
-              sage  with  the  named queue ID from the named mail
+              sage with the named queue ID from  the  named  mail
               queue(s) (default: <b>hold</b>) to the <b>deferred</b> queue.
 
-              If a <i>queue</i><b>_</b><i>id</i> of <b>-</b> is specified, the program  reads
+              If  a <i>queue</i><b>_</b><i>id</i> of <b>-</b> is specified, the program reads
               queue IDs from standard input.
 
-              Note:  specify  "<b>postsuper -r</b>" to release mail that
-              was kept on hold  for  a  significant  fraction  of
-              <b>$<a href="postconf.5.html#maximal_queue_lifetime">maximal_queue_lifetime</a></b>  or <b>$<a href="postconf.5.html#bounce_queue_lifetime">bounce_queue_lifetime</a></b>,
+              Note: specify "<b>postsuper -r</b>" to release  mail  that
+              was  kept  on  hold  for  a significant fraction of
+              <b>$<a href="postconf.5.html#maximal_queue_lifetime">maximal_queue_lifetime</a></b> or  <b>$<a href="postconf.5.html#bounce_queue_lifetime">bounce_queue_lifetime</a></b>,
               or longer.
 
-              Specify "<b>-H ALL</b>" to release all mail  that  is  "on
-              hold".   As  a safety measure, the word <b>ALL</b> must be
+              Specify  "<b>-H  ALL</b>"  to release all mail that is "on
+              hold".  As a safety measure, the word <b>ALL</b>  must  be
               specified in upper case.
 
+              This feature is available in Postfix 2.0 and later.
+
        <b>-p</b>     Purge old temporary files that are left over  after
               system or software crashes.
 
@@ -168,33 +172,35 @@ POSTSUPER(1)                                                      POSTSUPER(1)
               the Postfix mail system is  running,  but  no  harm
               should be done.
 
-       <b>-s</b>     Structure  check and structure repair.  This should
+              This feature is available in Postfix 1.1 and later.
+
+       <b>-s</b>     Structure check and structure repair.  This  should
               be done once before Postfix startup.
 
-              <b>o</b>      Rename files whose name does not  match  the
+              <b>o</b>      Rename  files  whose name does not match the
                      message file inode number. This operation is
-                     necessary after restoring a mail queue  from
+                     necessary  after restoring a mail queue from
                      a different machine, or from backup media.
 
               <b>o</b>      Move queue files that are in the wrong place
                      in the file system hierarchy and remove sub-
                      directories that are no longer needed.  File
-                     position rearrangements are necessary  after
+                     position  rearrangements are necessary after
                      a  change  in  the  <b><a href="postconf.5.html#hash_queue_names">hash_queue_names</a></b>  and/or
                      <b><a href="postconf.5.html#hash_queue_depth">hash_queue_depth</a></b> configuration parameters.
 
        <b>-v</b>     Enable verbose logging for debugging purposes. Mul-
-              tiple  <b>-v</b>  options  make  the software increasingly
+              tiple <b>-v</b> options  make  the  software  increasingly
               verbose.
 
 <b>DIAGNOSTICS</b>
-       Problems are reported to the standard error stream and  to
+       Problems  are reported to the standard error stream and to
        <b>syslogd</b>(8).
 
-       <a href="postsuper.1.html"><b>postsuper</b>(1)</a>  reports  the number of messages deleted with
-       <b>-d</b>, the number of messages requeued with <b>-r</b>, and the  num-
-       ber  of  messages whose queue file name was fixed with <b>-s</b>.
-       The report is written to the standard error stream and  to
+       <a href="postsuper.1.html"><b>postsuper</b>(1)</a> reports the number of messages  deleted  with
+       <b>-d</b>,  the number of messages requeued with <b>-r</b>, and the num-
+       ber of messages whose queue file name was fixed  with  <b>-s</b>.
+       The  report is written to the standard error stream and to
        <b>syslogd</b>(8).
 
 <b>ENVIRONMENT</b>
@@ -202,37 +208,37 @@ POSTSUPER(1)                                                      POSTSUPER(1)
               Directory with the <a href="postconf.5.html"><b>main.cf</b></a> file.
 
 <b>BUGS</b>
-       Mail  that  is  not sanitized by Postfix (i.e. mail in the
+       Mail that is not sanitized by Postfix (i.e.  mail  in  the
        <b>maildrop</b> queue) cannot be placed "on hold".
 
 <b>CONFIGURATION PARAMETERS</b>
-       The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are  especially  relevant
+       The  following  <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant
        to this program.  The text below provides only a parameter
-       summary. See <a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including  exam-
+       summary.  See <a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including exam-
        ples.
 
        <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The  default  location  of  the Postfix <a href="postconf.5.html">main.cf</a> and
+              The default location of  the  Postfix  <a href="postconf.5.html">main.cf</a>  and
               <a href="master.5.html">master.cf</a> configuration files.
 
        <b><a href="postconf.5.html#hash_queue_depth">hash_queue_depth</a> (1)</b>
-              The number of subdirectory levels for queue  direc-
-              tories  listed with the <a href="postconf.5.html#hash_queue_names">hash_queue_names</a> parameter.
+              The  number of subdirectory levels for queue direc-
+              tories listed with the <a href="postconf.5.html#hash_queue_names">hash_queue_names</a>  parameter.
 
        <b><a href="postconf.5.html#hash_queue_names">hash_queue_names</a> (deferred, defer)</b>
-              The names  of  queue  directories  that  are  split
+              The  names  of  queue  directories  that  are split
               across multiple subdirectory levels.
 
        <b><a href="postconf.5.html#queue_directory">queue_directory</a> (see 'postconf -d' output)</b>
-              The  location of the Postfix top-level queue direc-
+              The location of the Postfix top-level queue  direc-
               tory.
 
        <b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
               The syslog facility of Postfix logging.
 
        <b><a href="postconf.5.html#syslog_name">syslog_name</a> (postfix)</b>
-              The mail system  name  that  is  prepended  to  the
-              process  name  in  syslog  records, so that "smtpd"
+              The  mail  system  name  that  is  prepended to the
+              process name in syslog  records,  so  that  "smtpd"
               becomes, for example, "postfix/smtpd".
 
 <b>SEE ALSO</b>
@@ -240,7 +246,7 @@ POSTSUPER(1)                                                      POSTSUPER(1)
        <a href="postqueue.1.html">postqueue(1)</a>, unprivileged queue operations
 
 <b>LICENSE</b>
-       The Secure Mailer license must be  distributed  with  this
+       The  Secure  Mailer  license must be distributed with this
        software.
 
 <b>AUTHOR(S)</b>
index 3a6842861ba88fd45abe474898173128333f432f..befbbd600146690784fd309ee8fcba7a030426eb 100644 (file)
@@ -282,6 +282,32 @@ case "$SYSTEM.$RELEASE" in
                case "$RELEASE" in
                2.[0-5].*) CCARGS="$CCARGS -DNO_EPOLL";;
                esac
+               # Workaround for retarded libc 
+               case "$RELEASE" in
+               2.6.*)
+               trap 'rm -f makedefs.tmp makedefs.tmp.o makedefs.tmp.c' 1 2 3 15
+               cat >makedefs.tmp.c <<EOF
+#include <sys/types.h>
+#include <sys/epoll.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int     main(int argc, char **argv)
+{
+    int     epoll_handle;
+
+    if ((epoll_handle = epoll_create(1)) < 0) {
+       perror("epoll_create");
+       exit(1);
+    }
+    exit(0);
+}
+EOF
+               ${CC-gcc} -o makedefs.tmp makedefs.tmp.c || exit 1
+               ./makedefs.tmp 2>/dev/null || CCARGS="$CCARGS -DNO_EPOLL"
+               rm -f makedefs.tmp makedefs.tmp.o makedefs.tmp.c;;
+               esac
                ;;
      GNU.0*|GNU/kFreeBSD.[56]*)
                SYSTYPE=GNU0
index 2564d60d8ea613664aacb4731e41961dbd20280d..c38dc8f9d8df53dff3d79dc8ab6592d388e1fc32 100644 (file)
@@ -94,6 +94,8 @@ Note: while mail is "on hold" it will not expire when its
 time in the queue exceeds the \fBmaximal_queue_lifetime\fR
 or \fBbounce_queue_lifetime\fR setting. It becomes subject to
 expiration after it is released from "hold".
+.sp
+This feature is available in Postfix 2.0 and later.
 .IP "\fB-H \fIqueue_id\fR"
 Release mail that was put "on hold".
 Move one message with the named queue ID from the named
@@ -109,6 +111,8 @@ or \fB$bounce_queue_lifetime\fR, or longer.
 Specify "\fB-H ALL\fR" to release all mail that is "on hold".
 As a safety measure, the word \fBALL\fR must be specified in upper
 case.
+.sp
+This feature is available in Postfix 2.0 and later.
 .IP \fB-p\fR
 Purge old temporary files that are left over after system or
 software crashes.
@@ -154,6 +158,8 @@ Warning: Postfix queue IDs are reused.
 There is a very small possibility that \fBpostsuper\fR(1) requeues
 the wrong message file when it is executed while the Postfix mail
 system is running, but no harm should be done.
+.sp
+This feature is available in Postfix 1.1 and later.
 .IP \fB-s\fR
 Structure check and structure repair.  This should be done once
 before Postfix startup.
index 8790e4725f73c0d9d4d635d7675e88ca4c124a46..f25ab45cd791caf47645ed5f41a1cade24a6d92e 100644 (file)
@@ -96,6 +96,10 @@ Use "\fBpostconf readme_directory\fR" or
 .na
 .nf
 DATABASE_README, Postfix lookup table overview
+.SH "HISTORY"
+.na
+.nf
+CIDR table support was introduced with Postfix version 2.1.
 .SH "AUTHOR(S)"
 .na
 .nf
index 62a6d11a7f3c4c3cb91e0eef9ab24f71bd4216a3..1d3dfac0a988cc15b85cc2b6ed73f940bad8124f 100644 (file)
@@ -175,8 +175,9 @@ Overrides the relayhost parameter setting for address verification
 probes. This information can be overruled with the \fBtransport\fR(5) table.
 .PP
 This feature is available in Postfix 2.1 and later.
-.SH address_verify_sender (default: postmaster)
-The sender address to use in address verification probes. To
+.SH address_verify_sender (default: $double_bounce_sender)
+The sender address to use in address verification probes; prior
+to Postfix 2.5 the default was "postmaster". To
 avoid problems with address probes that are sent in response to
 address probes, the Postfix SMTP server excludes the probe sender
 address from all SMTPD access blocks.
@@ -6312,9 +6313,11 @@ Disallow methods subject to active (non-dictionary) attack.
 Disallow methods subject to passive (dictionary) attack.
 .IP "\fBnoanonymous\fR"
 Disallow methods that allow anonymous authentication.
+.IP "\fBforward_secrecy\fR"
+Only allow methods that support forward secrecy (Dovecot only).
 .IP "\fBmutual_auth\fR"
 Only allow methods that provide mutual authentication (not available
-with SASL version 1).
+with Cyrus SASL version 1).
 .PP
 By default, the Postfix SMTP server accepts plaintext passwords but
 not anonymous logins.
index 20df979e9219e2334ef1225181876b4e6ac33c44..4a24d05311cb823e6af519695faf3df8ef4a6296 100644 (file)
@@ -80,6 +80,8 @@
 # .na
 # .nf
 #      DATABASE_README, Postfix lookup table overview
+# HISTORY
+#      CIDR table support was introduced with Postfix version 2.1.
 # AUTHOR(S)
 #      The CIDR table lookup code was originally written by:
 #      Jozsef Kadlecsik
index 7054b31812f5878ca19b3a1f53796a5aff546288..1f613d6f45fa4d45ccc4d442a549ef4ace7f0bfb 100644 (file)
@@ -340,9 +340,10 @@ probes. This information can be overruled with the transport(5) table.
 This feature is available in Postfix 2.1 and later.
 </p>
 
-%PARAM address_verify_sender postmaster
+%PARAM address_verify_sender $double_bounce_sender
 
-<p> The sender address to use in address verification probes. To
+<p> The sender address to use in address verification probes; prior
+to Postfix 2.5 the default was "postmaster". To
 avoid problems with address probes that are sent in response to
 address probes, the Postfix SMTP server excludes the probe sender
 address from all SMTPD access blocks. </p>
@@ -5561,10 +5562,15 @@ Specify zero or more of the following:
 
 <dd>Disallow methods that allow anonymous authentication. </dd>
 
+<dt><b>forward_secrecy</b></dt>
+
+<dd>Only allow methods that support forward secrecy (Dovecot only).
+</dd>
+
 <dt><b>mutual_auth</b></dt>
 
 <dd>Only allow methods that provide mutual authentication (not available
-with SASL version 1). </dd>
+with Cyrus SASL version 1). </dd>
 
 </dl>
 
index 61ac634253f4ae78c7e8e6e044381ed1c4ea2d84..fee73bbe95d1da313b2316ba313e236f69593683 100644 (file)
@@ -512,11 +512,11 @@ static void cleanup_header_callback(void *context, int header_class,
     while (ISSPACE(*hdrval))
        hdrval++;
     /* trimblanks(hdrval, 0)[0] = 0; */
-    if (var_auto_8bit_enc_hdr 
+    if (var_auto_8bit_enc_hdr
        && hdr_opts->type == HDR_CONTENT_TRANSFER_ENCODING) {
        for (cmp = code_map; cmp->name != 0; cmp++) {
            if (strcasecmp(hdrval, cmp->name) == 0) {
-               if (strcmp(cmp->encoding, MAIL_ATTR_ENC_8BIT) == 0)
+               if (strcasecmp(cmp->encoding, MAIL_ATTR_ENC_8BIT) == 0)
                    nvtable_update(state->attr, MAIL_ATTR_ENCODING,
                                   cmp->encoding);
                break;
index 9c70bfd854c411f66abb6e3b2d5baf1ab499e20e..54995c2e437c45e733ab55765e68dd0640c76da9 100644 (file)
@@ -2363,7 +2363,7 @@ extern int var_verify_neg_try;
 extern bool var_verify_neg_cache;
 
 #define VAR_VERIFY_SENDER              "address_verify_sender"
-#define DEF_VERIFY_SENDER              "postmaster"
+#define DEF_VERIFY_SENDER              "$" VAR_DOUBLE_BOUNCE
 extern char *var_verify_sender;
 
 #define VAR_VERIFY_POLL_COUNT          "address_verify_poll_count"
index bf2c5a49752d80095b5e2fc8146daeb844244dfc..b54eb587943f0222a2460839d39e0f5d5dc190c6 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20070501"
+#define MAIL_RELEASE_DATE      "20070511"
 #define MAIL_VERSION_NUMBER    "2.5"
 
 #ifdef SNAPSHOT
index 4668deadda97c782da4e9d28bbe043ff57e5a212..bbd1b9b3a6755c6aa7b7617b5805757002edfaf4 100644 (file)
@@ -191,7 +191,7 @@ void    resolve_clnt(const char *class, const char *sender,
      */
 #define IFSET(flag, text) ((reply->flags & (flag)) ? (text) : "")
 
-    if (event_time() < last_expire
+    if (time((time_t *) 0) < last_expire
        && *addr && strcmp(addr, STR(last_addr)) == 0
        && strcmp(class, STR(last_class)) == 0
        && strcmp(sender, STR(last_sender)) == 0) {
@@ -284,7 +284,7 @@ void    resolve_clnt(const char *class, const char *sender,
     vstring_strcpy(last_reply.nexthop, STR(reply->nexthop));
     vstring_strcpy(last_reply.recipient, STR(reply->recipient));
     last_reply.flags = reply->flags;
-    last_expire = event_time() + 30;           /* XXX make configurable */
+    last_expire = time((time_t *) 0) + 30;     /* XXX make configurable */
 }
 
 /* resolve_clnt_free - destroy reply */
index 6d110bf5986af02b7d3d5a945d9fe61cbd4bd39f..43b892a258a99db13bd9ce6731553a36f3f52800 100644 (file)
@@ -108,7 +108,7 @@ VSTRING *rewrite_clnt(const char *rule, const char *addr, VSTRING *result)
     /*
      * Peek at the cache.
      */
-    if (event_time() < last_expire
+    if (time((time_t *) 0) < last_expire
        && strcmp(addr, STR(last_addr)) == 0
        && strcmp(rule, STR(last_rule)) == 0) {
        vstring_strcpy(result, STR(last_result));
@@ -165,7 +165,7 @@ VSTRING *rewrite_clnt(const char *rule, const char *addr, VSTRING *result)
     vstring_strcpy(last_rule, rule);
     vstring_strcpy(last_addr, addr);
     vstring_strcpy(last_result, STR(result));
-    last_expire = event_time() + 30;           /* XXX make configurable */
+    last_expire = time((time_t *) 0) + 30;     /* XXX make configurable */
 
     return (result);
 }
index 65172d08a639a1222e8da4c2a779716996e49db2..48f390909ade23b3131ebb9dd41670d109a287c8 100644 (file)
@@ -88,6 +88,8 @@
 /*     time in the queue exceeds the \fBmaximal_queue_lifetime\fR
 /*     or \fBbounce_queue_lifetime\fR setting. It becomes subject to
 /*     expiration after it is released from "hold".
+/* .sp
+/*     This feature is available in Postfix 2.0 and later.
 /* .IP "\fB-H \fIqueue_id\fR"
 /*     Release mail that was put "on hold".
 /*     Move one message with the named queue ID from the named
 /*     Specify "\fB-H ALL\fR" to release all mail that is "on hold".
 /*     As a safety measure, the word \fBALL\fR must be specified in upper
 /*     case.
+/* .sp
+/*     This feature is available in Postfix 2.0 and later.
 /* .IP \fB-p\fR
 /*     Purge old temporary files that are left over after system or
 /*     software crashes.
 /*     There is a very small possibility that \fBpostsuper\fR(1) requeues
 /*     the wrong message file when it is executed while the Postfix mail
 /*     system is running, but no harm should be done.
+/* .sp
+/*     This feature is available in Postfix 1.1 and later.
 /* .IP \fB-s\fR
 /*     Structure check and structure repair.  This should be done once
 /*     before Postfix startup.
index d539a5d2a5de66c7927297d0ff91a01ed45e2a8e..fd315a201b4fe8d02713c4624223d9a822c15e84 100644 (file)
@@ -364,7 +364,7 @@ RES_CONTEXT resolve_verify = {
   * This code detaches the trivial-rewrite process from the master, stops
   * accepting new clients, and handles established clients in the background,
   * asking them to reconnect the next time they send a request. The master
-  * create a new process that accepts connections. This is reasonably safe
+  * creates a new process that accepts connections. This is reasonably safe
   * because the number of trivial-rewrite server processes is small compared
   * to the number of trivial-rewrite client processes. The few extra
   * background processes should not make a difference in Postfix's footprint.
index 4e525e0317729ee0ebb0fa91cdaee339824758b3..e38ab380d7b87f4310cef1832382ba916113f7d4 100644 (file)
@@ -337,7 +337,7 @@ XSASL_CLIENT *xsasl_cyrus_client_create(XSASL_CLIENT_IMPL *unused_impl,
     }
 
     /*
-     * Extend XSASL_CLIENT_IMPL object with our own state. We use long-lived
+     * Extend the XSASL_CLIENT object with our own state. We use long-lived
      * conversion buffers rather than local variables to avoid memory leaks
      * in case of read/write timeout or I/O error.
      * 
index 3a2db98f459432184ed654690cfeb79a8e88946b..69f2fba0d7f121da272c9035e1f560c89fc42895 100644 (file)
@@ -311,9 +311,9 @@ static XSASL_SERVER *xsasl_cyrus_server_create(XSASL_SERVER_IMPL *unused_impl,
     }
 
     /*
-     * Extend the XSASL_SERVER_IMPL object with our own data. We use
-     * long-lived conversion buffers rather than local variables to avoid
-     * memory leaks in case of read/write timeout or I/O error.
+     * Extend the XSASL_SERVER object with our own data. We use long-lived
+     * conversion buffers rather than local variables to avoid memory leaks
+     * in case of read/write timeout or I/O error.
      */
     server = (XSASL_CYRUS_SERVER *) mymalloc(sizeof(*server));
     server->xsasl.free = xsasl_cyrus_server_free;
index c20e3da47067b2f64a4244c0835f3ed59a3bd82f..fa59fa7227d0adafe3cfb3e64d2f97bff7bab150 100644 (file)
@@ -59,6 +59,7 @@
 #include <stringops.h>
 #include <vstream.h>
 #include <vstring_vstream.h>
+#include <name_mask.h>
 
 /* Global library. */
 
   */
 #define AUTH_TIMEOUT   10
 
+ /*
+  * Security property bitmasks.
+  */
+#define SEC_PROPS_NOPLAINTEXT  (1 << 0)
+#define SEC_PROPS_NOACTIVE     (1 << 1)
+#define SEC_PROPS_NODICTIONARY (1 << 2)
+#define SEC_PROPS_NOANONYMOUS  (1 << 3)
+#define SEC_PROPS_FWD_SECRECY  (1 << 4)
+#define SEC_PROPS_MUTUAL_AUTH  (1 << 5)
+#define SEC_PROPS_PRIVATE      (1 << 6)
+
+#define SEC_PROPS_POS_MASK     (SEC_PROPS_MUTUAL_AUTH | SEC_PROPS_FWD_SECRECY)
+#define SEC_PROPS_NEG_MASK     (SEC_PROPS_NOPLAINTEXT | SEC_PROPS_NOACTIVE | \
+                               SEC_PROPS_NODICTIONARY | SEC_PROPS_NOANONYMOUS)
+
+ /*
+  * Security properties as specified in the Postfix main.cf file.
+  */
+static NAME_MASK xsasl_dovecot_conf_sec_props[] = {
+    "noplaintext", SEC_PROPS_NOPLAINTEXT,
+    "noactive", SEC_PROPS_NOACTIVE,
+    "nodictionary", SEC_PROPS_NODICTIONARY,
+    "noanonymous", SEC_PROPS_NOANONYMOUS,
+    "forward_secrecy", SEC_PROPS_FWD_SECRECY,
+    "mutual_auth", SEC_PROPS_MUTUAL_AUTH,
+    0, 0,
+};
+
+ /*
+  * Security properties as specified in the Dovecot protocol. See
+  * http://wiki.dovecot.org/Authentication_Protocol.
+  */
+static NAME_MASK xsasl_dovecot_serv_sec_props[] = {
+    "plaintext", SEC_PROPS_NOPLAINTEXT,
+    "active", SEC_PROPS_NOACTIVE,
+    "dictionary", SEC_PROPS_NODICTIONARY,
+    "anonymous", SEC_PROPS_NOANONYMOUS,
+    "forward-secrecy", SEC_PROPS_FWD_SECRECY,
+    "mutual-auth", SEC_PROPS_MUTUAL_AUTH,
+    "private", SEC_PROPS_PRIVATE,
+    0, 0,
+};
+
  /*
   * Class variables.
   */
+typedef struct XSASL_DCSRV_MECH {
+    char   *mech_name;                 /* mechanism name */
+    int     sec_props;                 /* mechanism properties */
+    struct XSASL_DCSRV_MECH *next;
+} XSASL_DCSRV_MECH;
+
 typedef struct {
     XSASL_SERVER_IMPL xsasl;
     VSTREAM *sasl_stream;
     char   *socket_path;
-    char   *mechanism_list;            /* applicable mechanisms */
+    XSASL_DCSRV_MECH *mechanism_list;  /* unfiltered mechanism list */
     unsigned int request_id_counter;
 } XSASL_DOVECOT_SERVER_IMPL;
 
@@ -104,6 +154,8 @@ typedef struct {
     char   *service;
     char   *username;                  /* authenticated user */
     VSTRING *sasl_line;
+    unsigned int sec_props;            /* Postfix mechanism filter */
+    char   *mechanism_list;            /* filtered mechanism list */
 } XSASL_DOVECOT_SERVER;
 
  /*
@@ -122,16 +174,79 @@ static int xsasl_dovecot_server_next(XSASL_SERVER *, const char *, VSTRING *);
 static const char *xsasl_dovecot_server_get_mechanism_list(XSASL_SERVER *);
 static const char *xsasl_dovecot_server_get_username(XSASL_SERVER *);
 
+/* xsasl_dovecot_server_mech_append - append server mechanism entry */
+
+static void xsasl_dovecot_server_mech_append(XSASL_DCSRV_MECH **mech_list,
+                                      const char *mech_name, int sec_props)
+{
+    XSASL_DCSRV_MECH **mpp;
+    XSASL_DCSRV_MECH *mp;
+
+    for (mpp = mech_list; *mpp != 0; mpp = &mpp[0]->next)
+        /* void */ ;
+
+    mp = (XSASL_DCSRV_MECH *) mymalloc(sizeof(*mp));
+    mp->mech_name = mystrdup(mech_name);
+    mp->sec_props = sec_props;
+    mp->next = 0;
+    *mpp = mp;
+}
+
+/* xsasl_dovecot_server_mech_free - destroy server mechanism list */
+
+static void xsasl_dovecot_server_mech_free(XSASL_DCSRV_MECH *mech_list)
+{
+    XSASL_DCSRV_MECH *mp;
+    XSASL_DCSRV_MECH *next;
+
+    for (mp = mech_list; mp != 0; mp = next) {
+       myfree(mp->mech_name);
+       next = mp->next;
+       myfree((char *) mp);
+    }
+}
+
+/* xsasl_dovecot_server_mech_filter - filter server mechanism list */
+
+static char *xsasl_dovecot_server_mech_filter(XSASL_DCSRV_MECH *mechanism_list,
+                                                   unsigned int conf_props)
+{
+    const char *myname = "xsasl_dovecot_server_mech_filter";
+    unsigned int pos_conf_props = (conf_props & SEC_PROPS_POS_MASK);
+    unsigned int neg_conf_props = (conf_props & SEC_PROPS_NEG_MASK);
+    VSTRING *mechanisms_str = vstring_alloc(10);
+    XSASL_DCSRV_MECH *mp;
+
+    /*
+     * Match Postfix properties against Dovecot server properties.
+     */
+    for (mp = mechanism_list; mp != 0; mp = mp->next) {
+       if ((mp->sec_props & pos_conf_props) == pos_conf_props
+           && (mp->sec_props & neg_conf_props) == 0) {
+           if (VSTRING_LEN(mechanisms_str) > 0)
+               VSTRING_ADDCH(mechanisms_str, ' ');
+           vstring_strcat(mechanisms_str, mp->mech_name);
+           if (msg_verbose)
+               msg_info("%s: keep mechanism: %s", myname, mp->mech_name);
+       } else {
+           if (msg_verbose)
+               msg_info("%s: skip mechanism: %s", myname, mp->mech_name);
+       }
+    }
+    return (vstring_export(mechanisms_str));
+}
+
 /* xsasl_dovecot_server_connect - initial auth server handshake */
 
 static int xsasl_dovecot_server_connect(XSASL_DOVECOT_SERVER_IMPL *xp)
 {
     const char *myname = "xsasl_dovecot_server_connect";
-    VSTRING *line_str, *mechanisms_str;
+    VSTRING *line_str;
     VSTREAM *sasl_stream;
     char   *line, *cmd, *mech_name;
     unsigned int major_version, minor_version;
     int     fd, success;
+    int     sec_props;
 
     if (msg_verbose)
        msg_info("%s: Connecting", myname);
@@ -158,7 +273,6 @@ static int xsasl_dovecot_server_connect(XSASL_DOVECOT_SERVER_IMPL *xp)
     }
     success = 0;
     line_str = vstring_alloc(256);
-    mechanisms_str = vstring_alloc(128);
     while (vstring_get_nonl(line_str, sasl_stream) != VSTREAM_EOF) {
        line = vstring_str(line_str);
 
@@ -182,10 +296,17 @@ static int xsasl_dovecot_server_connect(XSASL_DOVECOT_SERVER_IMPL *xp)
        } else if (strcmp(cmd, "MECH") == 0 && line != NULL) {
            mech_name = line;
            line = split_at(line, '\t');
-
-           if (VSTRING_LEN(mechanisms_str) > 0)
-               VSTRING_ADDCH(mechanisms_str, ' ');
-           vstring_strcat(mechanisms_str, mech_name);
+           if (line != 0) {
+               sec_props =
+                   name_mask_delim_opt(myname,
+                                       xsasl_dovecot_serv_sec_props,
+                                       line, "\t", NAME_MASK_ANY_CASE);
+               if ((sec_props & SEC_PROPS_PRIVATE) != 0)
+                   continue;
+           } else
+               sec_props = 0;
+           xsasl_dovecot_server_mech_append(&xp->mechanism_list, mech_name,
+                                            sec_props);
        } else if (strcmp(cmd, "DONE") == 0) {
            /* Handshake finished. */
            success = 1;
@@ -198,15 +319,10 @@ static int xsasl_dovecot_server_connect(XSASL_DOVECOT_SERVER_IMPL *xp)
 
     if (!success) {
        /* handshake failed */
-       vstring_free(mechanisms_str);
        (void) vstream_fclose(sasl_stream);
        return (-1);
     }
     xp->sasl_stream = sasl_stream;
-    xp->mechanism_list =
-       translit(vstring_export(mechanisms_str), "\t", " ");
-    if (msg_verbose)
-       msg_info("%s: Mechanisms: %s", myname, xp->mechanism_list);
     return (0);
 }
 
@@ -219,7 +335,7 @@ static void xsasl_dovecot_server_disconnect(XSASL_DOVECOT_SERVER_IMPL *xp)
        xp->sasl_stream = 0;
     }
     if (xp->mechanism_list) {
-       myfree(xp->mechanism_list);
+       xsasl_dovecot_server_mech_free(xp->mechanism_list);
        xp->mechanism_list = 0;
     }
 }
@@ -258,7 +374,7 @@ static XSASL_SERVER *xsasl_dovecot_server_create(XSASL_SERVER_IMPL *impl,
                                                     VSTREAM *unused_stream,
                                                         const char *service,
                                                         const char *realm,
-                                              const char *unused_sec_props)
+                                                     const char *sec_props)
 {
     const char *myname = "xsasl_dovecot_server_create";
     XSASL_DOVECOT_SERVER *server;
@@ -283,6 +399,10 @@ static XSASL_SERVER *xsasl_dovecot_server_create(XSASL_SERVER_IMPL *impl,
     server->username = 0;
     server->service = mystrdup(service);
     server->last_request_id = 0;
+    server->mechanism_list = 0;
+    server->sec_props =
+       name_mask_opt(myname, xsasl_dovecot_conf_sec_props,
+                     sec_props, NAME_MASK_ANY_CASE | NAME_MASK_FATAL);
 
     return (&server->xsasl);
 }
@@ -297,7 +417,11 @@ static const char *xsasl_dovecot_server_get_mechanism_list(XSASL_SERVER *xp)
        if (xsasl_dovecot_server_connect(server->impl) < 0)
            return (0);
     }
-    return (server->impl->mechanism_list);
+    if (server->mechanism_list == 0)
+       server->mechanism_list =
+           xsasl_dovecot_server_mech_filter(server->impl->mechanism_list,
+                                            server->sec_props);
+    return (server->mechanism_list[0] ? server->mechanism_list : 0);
 }
 
 /* xsasl_dovecot_server_free - destroy server instance */
@@ -309,6 +433,8 @@ static void xsasl_dovecot_server_free(XSASL_SERVER *xp)
     vstring_free(server->sasl_line);
     if (server->username)
        myfree(server->username);
+    if (server->mechanism_list)
+       myfree(server->mechanism_list);
     myfree(server->service);
     myfree((char *) server);
 }