]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.11-20131102
authorWietse Venema <wietse@porcupine.org>
Sat, 2 Nov 2013 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sat, 2 Nov 2013 17:07:15 +0000 (13:07 -0400)
postfix/HISTORY
postfix/README_FILES/SASL_README
postfix/html/SASL_README.html
postfix/proto/SASL_README.html
postfix/src/global/mail_version.h
postfix/src/util/dict_lmdb.c
postfix/src/util/slmdb.c

index 3e6a0bce76025e637a62296437cad6bbd4cff078..c84e536aa39ec9ac668e61f04f619b186bb084a3 100644 (file)
@@ -19029,3 +19029,8 @@ Apologies for any names omitted.
        Cleanup: restore ability to build without LMDB support;
        further slmdb API streamlining. Files: util/slmdb.[hc],
        util/dict_lmdb.c.
+
+       Bugfix: uninitialized variable. File: util/slmdb.c.
+
+       Documentation: added SASL_README example for check_sasl_access.
+       File: proto/SASL_README.html.
index ffd51132e05587e0ffdc7b1aa5da9efdefa1468b..da81b1e0e82711cea5a161fb48b1aaff83379df8 100644 (file)
@@ -907,6 +907,25 @@ Postfix provides a wide range of SASL authentication configuration options. The
 next section lists a few that are discussed frequently. See postconf(5) for a
 complete list.
 
+P\bPe\ber\br-\b-a\bac\bcc\bco\bou\bun\bnt\bt a\bac\bcc\bce\bes\bss\bs c\bco\bon\bnt\btr\bro\bol\bl
+
+Postfix can implement policies that depend on the SASL login name (Postfix 2.11
+and later). Typically this is used to HOLD or REJECT mail from accounts whose
+credentials have been compromised.
+
+    /etc/postfix/main.cf:
+        smtpd_recipient_restrictions =
+       permit_mynetworks
+       check_sasl_access hash:/etc/postfix/sasl_access
+       permit_sasl_authenticated
+       ...
+
+    /etc/postfix/sasl_access:
+         # Use this when smtpd_sasl_local_domain is empty.
+         username      HOLD
+         # Use this when smtpd_sasl_local_domain=example.com.
+         username@example.com HOLD
+
 D\bDe\bef\bfa\bau\bul\blt\bt a\bau\but\bth\bhe\ben\bnt\bti\bic\bca\bat\bti\bio\bon\bn d\bdo\bom\bma\bai\bin\bn
 
 Postfix can append a domain name (or any other string) to a SASL login name
index 408ad2e4fd3801c9b9c0b8c523f63dff200373cd..5c34030dae4a94208064fdd05e4b0aaf72893cf9 100644 (file)
@@ -1461,6 +1461,30 @@ control over the SASL login name and the envelope sender. </p>
 options.  The next section lists a few that are discussed frequently.
 See <a href="postconf.5.html">postconf(5)</a> for a complete list. </p>
 
+<h4><a name="sasl_access">Per-account access control</a></h4>
+
+<p> Postfix can implement policies that depend on the SASL login
+name (Postfix 2.11 and later).  Typically this is used to HOLD or
+REJECT mail from accounts whose credentials have been compromised.
+</p>
+
+<blockquote>
+<pre>
+/etc/postfix/<a href="postconf.5.html">main.cf</a>:
+    <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#check_sasl_access">check_sasl_access</a> hash:/etc/postfix/sasl_access
+       <a href="postconf.5.html#permit_sasl_authenticated">permit_sasl_authenticated</a>
+       ...
+
+/etc/postfix/sasl_access:
+     # Use this when <a href="postconf.5.html#smtpd_sasl_local_domain">smtpd_sasl_local_domain</a> is empty.
+     username  HOLD
+     # Use this when <a href="postconf.5.html#smtpd_sasl_local_domain">smtpd_sasl_local_domain</a>=example.com.
+     username@example.com HOLD
+</pre>
+</blockquote>
+
 <h4><a name="id397172">Default  authentication domain</a></h4>
 
 <p> Postfix can append a domain name (or any other string) to a
index b9104e2a9ad463ef9961918ef07c41925642f0a9..1b2511a624d69ff2cb96ef0e8f90d3b732dd4cf4 100644 (file)
@@ -1461,6 +1461,30 @@ control over the SASL login name and the envelope sender. </p>
 options.  The next section lists a few that are discussed frequently.
 See postconf(5) for a complete list. </p>
 
+<h4><a name="sasl_access">Per-account access control</a></h4>
+
+<p> Postfix can implement policies that depend on the SASL login
+name (Postfix 2.11 and later).  Typically this is used to HOLD or
+REJECT mail from accounts whose credentials have been compromised.
+</p>
+
+<blockquote>
+<pre>
+/etc/postfix/main.cf:
+    smtpd_recipient_restrictions = 
+       permit_mynetworks 
+       check_sasl_access hash:/etc/postfix/sasl_access
+       permit_sasl_authenticated
+       ...
+
+/etc/postfix/sasl_access:
+     # Use this when smtpd_sasl_local_domain is empty.
+     username  HOLD
+     # Use this when smtpd_sasl_local_domain=example.com.
+     username@example.com HOLD
+</pre>
+</blockquote>
+
 <h4><a name="id397172">Default  authentication domain</a></h4>
 
 <p> Postfix can append a domain name (or any other string) to a
index f153424454e6683090bfae2bb812eecaaea1ce98..90692516beb576c0b2be81f837c91ca02a4b26a9 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      "20131101"
+#define MAIL_RELEASE_DATE      "20131102"
 #define MAIL_VERSION_NUMBER    "2.11"
 
 #ifdef SNAPSHOT
index dcacd6efada48a2e6491ffdbabfe4abb368a359a..1aa8412b6420cb6aac8363ae5679d6763ce2e898 100644 (file)
 #include <dict_lmdb.h>
 #include <warn_stat.h>
 
+ /*
+  * Supported LMDB versions.
+  * 
+  * LMDB 0.9.9 allows the application to manage locks. This elimimates multiple
+  * problems:
+  * 
+  * - The need for a (world-)writable lockfile, which was a show-stopper for
+  * multiprogrammed applications such as Postfix that consist of privileged
+  * writer processes and unprivileged reader processes.
+  * 
+  * - Hard-coded inode numbers (from ftok() output) in lockfile content that
+  * could prevent automatic crash recovery, and related to that, sub-optimal
+  * semaphore performance on BSD systems.
+  */
+#if MDB_VERSION_FULL < MDB_VERINT(0, 9, 9)
+#error "Build with LMDB version 0.9.9 or later"
+#endif
+
 /* Application-specific. */
 
 typedef struct {
@@ -100,7 +118,7 @@ typedef struct {
   * transactions the number of retries is proportional to the size of the
   * address space.
   * 
-  * We do not expise these details to the Postfix user interface. The purpose of
+  * We do not expose these details to the Postfix user interface. The purpose of
   * Postfix is to solve problems, not punt them to the user.
   */
 #ifndef SSIZE_T_MAX                    /* The maximum map size */
index c022d7870074d4d396e3661494b864adee5c4c65..a471c5c0b898b14c3ad21dfb74141555daaf5140 100644 (file)
 /*     The start of a list of (name, value) pairs, terminated with
 /*     SLMDB_CTL_END.  The following text enumerates the symbolic
 /*     request names and the corresponding value types.
-/* .RS .IP "SLMDB_CTL_LONGJMP_FN (void (*)(void *, int))
+/* .RS
+/* .IP "SLMDB_CTL_LONGJMP_FN (void (*)(void *, int))
 /*     Application long-jump call-back function pointer. The
 /*     function must not return and is called to repeat a failed
 /*     bulk-mode transaction from the start. The arguments are the
 #include <slmdb.h>
 
  /*
-  * LMDB 0.9.8 allows the application to update the database size limit
-  * on-the-fly (typically after an MDB_MAP_FULL error). The only limit that
-  * remains is imposed by the hardware address space. The implementation is
-  * supposed to handle databases larger than physical memory. However, at
-  * some point in time there was no such guarantee for (bulk) transactions
-  * larger than physical memory.
-  * 
-  * LMDB 0.9.9 allows the application to manage locks. This elimimates multiple
-  * problems:
-  * 
-  * - The need for a (world-)writable lockfile, which is a show-stopper for
-  * multiprogrammed applications that have privileged writers and
-  * unprivileged readers.
+  * Supported LMDB versions.
   * 
-  * - Hard-coded inode numbers (in ftok() output) in lockfile content that can
-  * prevent automatic crash recovery, and related to that, sub-optimal
-  * semaphore performance on BSD systems.
+  * LMDB 0.9.8 allows the application to update the database size limit
+  * on-the-fly, so that it can recover from an MDB_MAP_FULL error; it also
+  * allows an application to "pick up" a new database size limit on-the-fly,
+  * so that it can recover from an MDB_MAP_RESIZED error. The database size
+  * limit that remains is imposed by the hardware address space. The
+  * implementation is supposed to handle databases larger than physical
+  * memory. However, this is not necessarily guaranteed for (bulk)
+  * transactions larger than physical memory.
   */
-#if MDB_VERSION_FULL < MDB_VERINT(0, 9, 9)
-#error "Build with LMDB version 0.9.9 or later"
+#if MDB_VERSION_FULL < MDB_VERINT(0, 9, 8)
+#error "Build with LMDB version 0.9.8 or later"
 #endif
 
-#define SLMDB_DEF_API_RETRY_LIMIT 2    /* Retries per dict(3) API call */
-#define SLMDB_DEF_BULK_RETRY_LIMIT \
-        (2 * sizeof(size_t) * CHAR_BIT)        /* Retries per bulk-mode transaction */
-
  /*
-  * The purpose of the error-recovering functions below is to hide LMDB
-  * quirks (MAP_FULL, MAP_RESIZED, MDB_READERS_FULL), so that the caller can
-  * pretend that those quirks don't exist, and focus on its own job.
+  * Error recovery.
+  * 
+  * The purpose of the slmdb(3) API is to hide LMDB quirks (recoverable
+  * MAP_FULL, MAP_RESIZED, or MDB_READERS_FULL errors). With these out of the
+  * way, applications can pretend that those quirks don't exist, and focus on
+  * their own job.
   * 
   * - To recover from a single-transaction LMDB error, each wrapper function
   * uses tail recursion instead of goto. Since LMDB errors are rare, code
   * clarity is more important than speed.
   * 
   * - To recover from a bulk-transaction LMDB error, the error-recovery code
-  * jumps back into the caller to some pre-arranged point (the closest thing
-  * that C has to exception handling). The application is then expected to
-  * repeat the bulk transaction from scratch.
+  * triggers a long jump back into the caller to some pre-arranged point (the
+  * closest thing that C has to exception handling). The application is then
+  * expected to repeat the bulk transaction from scratch.
+  */
+
+ /*
+  * Our default retry attempt limits. We allow a few retries per slmdb(3) API
+  * call for non-bulk transactions. We allow a number of bulk-transaction
+  * retries that is proportional to the memory address space.
   */
+#define SLMDB_DEF_API_RETRY_LIMIT 2    /* Retries per slmdb(3) API call */
+#define SLMDB_DEF_BULK_RETRY_LIMIT \
+        (2 * sizeof(size_t) * CHAR_BIT)        /* Retries per bulk-mode transaction */
 
  /*
   * We increment the recursion counter each time we try to recover from
   * error, and reset the recursion counter when returning to the application
-  * from the slmdb API.
+  * from the slmdb(3) API.
   */
 #define SLMDB_API_RETURN(slmdb, status) do { \
        (slmdb)->api_retry_count = 0; \
 
 static int slmdb_prepare(SLMDB *slmdb)
 {
-    int     status;
+    int     status = 0;
 
     /*
      * This is called before accessing the database, or after recovery from
@@ -273,7 +275,7 @@ static int slmdb_prepare(SLMDB *slmdb)
        if ((status = mdb_drop(slmdb->txn, slmdb->dbi, 0)) != 0)
            return (status);
        if ((slmdb->slmdb_flags & SLMDB_FLAG_BULK) == 0) {
-           if ((status = mdb_txn_commit(slmdb->txn)))
+           if ((status = mdb_txn_commit(slmdb->txn)) != 0)
                return (status);
            slmdb->txn = 0;
        }
@@ -564,7 +566,7 @@ int     slmdb_control(SLMDB *slmdb, int first,...)
     int     reqno;
 
     va_start(ap, first);
-    for (reqno = first; reqno != SLMDB_CTL_END; reqno = va_arg(ap, int)) {
+    for (reqno = first; status == 0 && reqno != SLMDB_CTL_END; reqno = va_arg(ap, int)) {
        switch (reqno) {
        case SLMDB_CTL_LONGJMP_FN:
            slmdb->longjmp_fn = va_arg(ap, SLMDB_LONGJMP_FN);