]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.10-20120520
authorWietse Venema <wietse@porcupine.org>
Sun, 20 May 2012 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:38:10 +0000 (06:38 +0000)
24 files changed:
postfix/HISTORY
postfix/README_FILES/POSTSCREEN_README
postfix/README_FILES/STRESS_README
postfix/WISHLIST
postfix/html/POSTSCREEN_README.html
postfix/html/STRESS_README.html
postfix/proto/POSTSCREEN_README.html
postfix/proto/STRESS_README.html
postfix/src/dnsblog/dnsblog.c
postfix/src/global/mail_flush.c
postfix/src/global/mail_trigger.c
postfix/src/global/mail_version.h
postfix/src/postconf/Makefile.in
postfix/src/postconf/postconf_user.c
postfix/src/postqueue/Makefile.in
postfix/src/postqueue/postqueue.c
postfix/src/postscreen/postscreen_dnsbl.c
postfix/src/tls/tls_client.c
postfix/src/tls/tls_server.c
postfix/src/util/Makefile.in
postfix/src/util/dict.c
postfix/src/util/events.c
postfix/src/util/line_number.c [new file with mode: 0644]
postfix/src/util/line_number.h [new file with mode: 0644]

index d95e00ddb8c25ccde5aa5c38159cb75c61d8d77f..924820c92a6cbf0b8d969aa28f13469f55ad9cf9 100644 (file)
@@ -17741,8 +17741,61 @@ Apologies for any names omitted.
 
 20120426
 
-       Bugfix (introduced Postfix 2.9): postconf flagged parameters
-       defined in master.cf as "unused" when they were used only
-       in main.cf. Problem reported by Michael Tokarev. Files:
-       postconf/postconf_user.c, postconf/test4b.ref, postconf
-       Makefile.in.
+       Bugfix (introduced Postfix 2.9): the postconf command flagged
+       parameters defined in master.cf as "unused" when they were
+       used only in main.cf. Problem reported by Michael Tokarev.
+       Files: postconf/postconf_user.c, postconf/test4b.ref,
+       postconf Makefile.in.
+
+20120513
+
+       Cleanup: report both the first and last line number when a
+       malformed main.cf entry spans multiple lines, instead of
+       reporting the last line number only. File: util/dict.c,
+       util/line_number.[hc].
+
+20120516
+
+       Workaround: apparently, FreeBSD 8.3 kqueue notifications
+       sometimes break when a dnsblog(8) process loses an accept()
+       race on a shared socket, resulting in repeated "connect to
+       private/dnsblog service: Connection refused" warnings.  This
+       condition is unique to dnsblog(8). The postscreen(8) daemon
+       closes a postscreen-to-dnsblog connection as soon as it
+       receives a dnsblog(8) reply, resulting in hundreds or
+       thousands of connection requests per second.  All other
+       multi-server daemons such as anvil(8) or proxymap(8) have
+       connection lifetimes ranging from 5s to 1000s depending on
+       server load.  The workaround is for dnsblog to use the
+       single_server driver instead of the multi_server driver.
+       This one-line code change eliminates the accept() race
+       without any Postfix performance impact.  Problem reported
+       by Sahil Tandon.  File: dnsblog/dnsblog.c.
+
+       Logging: postscreen now logs a warning when a dnsblog(8)
+       request takes longer than the hard-coded time limit of 10s.
+       File: postscreen/postscreen_dnsbl.c.
+
+20120517
+
+       Workaround: to avoid crashes when the OpenSSL library is
+       updated without "postfix reload", the Postfix TLS session
+       cache ID now includes the OpenSSL library version number.
+       Note: this problem cannot be fixed in tlsmgr(8). Code by
+       Victor Duchovni. Files: tls/tls_server.c, tls_client.c.
+
+20120520
+
+       Bugfix (introduced Postfix 2.4): the event_drain() function
+       was comparing bitmasks incorrectly causing the program to
+       always wait for the full time limit. This error affected
+       the unused postkick command, but only after s/fifo/unix/
+       in master.cf.  File: util/events.c.
+
+       Cleanup: laptop users have always been able to avoid
+       unnecessary disk spin-up by doing s/fifo/unix/ in master.cf
+       (this is currently not supported on Solaris systems).
+       However, to make this work reliably, the "postqueue -f"
+       command must wait until its requests have reached the pickup
+       and qmgr servers before closing the UNIX-domain request
+       sockets.  Files: postqueue/postqueue.c, postqueue/Makefile.in.
index 650114a71da320ed3afc4609d8c1222f44ff54b9..4838b619d6b27fd388667dfa07ab3e479bede6d4 100644 (file)
@@ -162,15 +162,15 @@ whitelist. The temporary whitelist is not used for SMTP client addresses that
 appear on the permanent access list.
 
     NOTE: To share a postscreen(8) cache between multiple postscreen(8)
-    instances, use "postscreen_cache_map = proxy:btree:$data_directory/
-    postscreen_cache", and disable cache cleanup
+    instances under the same master(8) daemon, use "postscreen_cache_map =
+    proxy:btree:$data_directory/postscreen_cache", and disable cache cleanup
     (postscreen_cache_cleanup_interval = 0) in all postscreen(8) instances
     except one that is responsible for cache cleanup.
 
     postscreen(8) cache sharing requires Postfix 2.9 or later; earlier proxymap
     (8) implementations don't support cache cleanup.
 
-    For an alternative postscreen(8) cache sharing approach see the
+    For an alternative postscreen(8) cache sharing approach, see the
     memcache_table(5) manpage.
 
 When the SMTP client address appears on the temporary whitelist, postscreen(8)
index 1e4c3e432c098141570fa070a2677256668049bf..03cc9952eff908384f52ba6a3c31874b42840b76 100644 (file)
@@ -383,15 +383,12 @@ accept remote connections.
 
 O\bOt\bth\bhe\ber\br m\bme\bea\bas\bsu\bur\bre\bes\bs t\bto\bo o\bof\bff\bf-\b-l\blo\boa\bad\bd z\bzo\bom\bmb\bbi\bie\bes\bs
 
-OpenBSD spamd implements a daemon that handles all connections from "new"
-clients. Only well-behaved mail clients are allowed to talk to the mail server.
-Other clients are tarpitted, and will never get a chance to affect mail server
-performance.
-
-At some point in the future, Postfix may come with a simple front-end daemon
-that does basic greylisting and pipelining detection to keep zombies and other
-ratware away from Postfix itself. This would use the "pass" service type which
-has been available in stable Postfix releases since Postfix 2.5.
+The postscreen(8) daemon, introduced with Postfix 2.8, provides additional
+protection against mail server overload. One postscreen(8) process handles all
+connections from "new" SMTP clients, and allows only well-behaved clients to
+talk to a Postfix SMTP server process. By keeping spambots away, postscreen(8)
+leaves more SMTP server processes available for legitimate clients, and delays
+the onset of server overload conditions.
 
 C\bCr\bre\bed\bdi\bit\bts\bs
 
index 8e98f53488e834cf9203c03ec774edd9904e15b6..4bfb30700b2c5209777f14d9cd6e01a90444d05c 100644 (file)
@@ -9,6 +9,17 @@ Wish list:
        Don't forget Apple's code donation for fetching mail from
        IMAP server.
 
+       Make "rename" the default when postmapping a DB file
+       (later: use copy+rename for postmap -i, postmap -d).
+
+       Make the "trigger" service endpoint type configurable.  On
+       non-Solaris systems, switching from fifo to unix can avoid
+       disk spin-up due to mtime changes (Postfix on Solaris
+       emulates UNIX-domain sockets by sending a file handle through
+       a FIFO).
+
+       Service-name parameters aren't documented in daemon manpages.
+
        When faking up the DSN ORCPT, don't send bare usernames
        from local command-line submission.
 
index d60f5aeff42b67f97141f6255e21fc88e1c939e8..44959e8bec1ed96dbf0511be10e5409362c356e3 100644 (file)
@@ -218,15 +218,24 @@ specifies the location of the temporary whitelist.  The
 temporary whitelist is not used for SMTP client addresses
 that appear on the <i>permanent</i> access list. </p>
 
-<blockquote> <p> NOTE: To share a <a href="postscreen.8.html">postscreen(8)</a> cache between
-multiple <a href="postscreen.8.html">postscreen(8)</a> instances, use "<tt><a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> =
-<a href="proxymap.8.html">proxy</a>:btree:$<a href="postconf.5.html#data_directory">data_directory</a>/postscreen_cache</tt>", and disable
-cache cleanup (<a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a> = 0) in all
-<a href="postscreen.8.html">postscreen(8)</a> instances except one that is responsible for cache
-cleanup. </p> <p> <a href="postscreen.8.html">postscreen(8)</a> cache sharing requires Postfix 2.9
-or later; earlier <a href="proxymap.8.html">proxymap(8)</a> implementations don't support cache
-cleanup. </p> <p>  For an alternative <a href="postscreen.8.html">postscreen(8)</a> cache sharing
-approach see the <a href="memcache_table.5.html">memcache_table(5)</a> manpage.  </p> </blockquote>
+<blockquote> 
+
+    <p> NOTE: To share a <a href="postscreen.8.html">postscreen(8)</a> cache between multiple
+    <a href="postscreen.8.html">postscreen(8)</a> instances under the same <a href="master.8.html">master(8)</a> daemon, use
+    "<tt><a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> =
+    <a href="proxymap.8.html">proxy</a>:btree:$<a href="postconf.5.html#data_directory">data_directory</a>/postscreen_cache</tt>", and disable
+    cache cleanup (<a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a> = 0) in all
+    <a href="postscreen.8.html">postscreen(8)</a> instances except one that is responsible for cache
+    cleanup. </p>
+
+    <p> <a href="postscreen.8.html">postscreen(8)</a> cache sharing requires Postfix 2.9 or later;
+    earlier <a href="proxymap.8.html">proxymap(8)</a> implementations don't support cache cleanup.
+    </p>
+
+    <p>  For an alternative <a href="postscreen.8.html">postscreen(8)</a> cache sharing approach,
+    see the <a href="memcache_table.5.html">memcache_table(5)</a> manpage. </p>
+
+</blockquote>
 
 <p> When the SMTP client address appears on the temporary
 whitelist, <a href="postscreen.8.html">postscreen(8)</a> logs this with the client address and port
index 3288936395c6e093b9c366ae2c9d9953b0dda6e9..114d882c3ddb623d3564bbc7e3e482ea8061b8cd 100644 (file)
@@ -514,17 +514,13 @@ services that accept remote connections. </p>
 
 <h2><a name="other"> Other measures to off-load zombies </a> </h2>
 
-<p> OpenBSD <a href="http://www.openbsd.org/spamd/">spamd</a>
-implements a daemon that handles all connections from "new" clients.
-Only well-behaved mail clients are allowed to talk to the mail
-server. Other clients are tarpitted, and will never get a chance
-to affect mail server performance. </p>
-
-<p> At some point in the future, Postfix may come with a simple
-front-end daemon that does basic greylisting and pipelining detection
-to keep zombies and other ratware away from Postfix itself. This
-would use the "pass" service type which has been available in
-stable Postfix releases since Postfix 2.5. </p>
+<p> The <a href="postscreen.8.html">postscreen(8)</a> daemon, introduced with Postfix 2.8, provides
+additional protection against mail server overload. One <a href="postscreen.8.html">postscreen(8)</a>
+process handles all connections from "new" SMTP clients, and allows
+only well-behaved clients to talk to a Postfix SMTP server process.
+By keeping spambots away, <a href="postscreen.8.html">postscreen(8)</a> leaves more SMTP server
+processes available for legitimate clients, and delays the onset
+of server overload conditions. </p>
 
 <h2><a name="credits"> Credits </a></h2>
 
index a3fb9d025795e0762869c248a03a4013b9209cbb..e5b960183b74d89b27e6be2a0e9ff771b20a06d3 100644 (file)
@@ -218,15 +218,24 @@ specifies the location of the temporary whitelist.  The
 temporary whitelist is not used for SMTP client addresses
 that appear on the <i>permanent</i> access list. </p>
 
-<blockquote> <p> NOTE: To share a postscreen(8) cache between
-multiple postscreen(8) instances, use "<tt>postscreen_cache_map =
-proxy:btree:$data_directory/postscreen_cache</tt>", and disable
-cache cleanup (postscreen_cache_cleanup_interval = 0) in all
-postscreen(8) instances except one that is responsible for cache
-cleanup. </p> <p> postscreen(8) cache sharing requires Postfix 2.9
-or later; earlier proxymap(8) implementations don't support cache
-cleanup. </p> <p>  For an alternative postscreen(8) cache sharing
-approach see the memcache_table(5) manpage.  </p> </blockquote>
+<blockquote> 
+
+    <p> NOTE: To share a postscreen(8) cache between multiple
+    postscreen(8) instances under the same master(8) daemon, use
+    "<tt>postscreen_cache_map =
+    proxy:btree:$data_directory/postscreen_cache</tt>", and disable
+    cache cleanup (postscreen_cache_cleanup_interval = 0) in all
+    postscreen(8) instances except one that is responsible for cache
+    cleanup. </p>
+
+    <p> postscreen(8) cache sharing requires Postfix 2.9 or later;
+    earlier proxymap(8) implementations don't support cache cleanup.
+    </p>
+
+    <p>  For an alternative postscreen(8) cache sharing approach,
+    see the memcache_table(5) manpage. </p>
+
+</blockquote>
 
 <p> When the SMTP client address appears on the temporary
 whitelist, postscreen(8) logs this with the client address and port
index 6d6acf52cce145fbbbaaefb25e1bb5adfa87443c..d8aed37aa36ae7e1809cbd59e68d7406f0460b73 100644 (file)
@@ -514,17 +514,13 @@ services that accept remote connections. </p>
 
 <h2><a name="other"> Other measures to off-load zombies </a> </h2>
 
-<p> OpenBSD <a href="http://www.openbsd.org/spamd/">spamd</a>
-implements a daemon that handles all connections from "new" clients.
-Only well-behaved mail clients are allowed to talk to the mail
-server. Other clients are tarpitted, and will never get a chance
-to affect mail server performance. </p>
-
-<p> At some point in the future, Postfix may come with a simple
-front-end daemon that does basic greylisting and pipelining detection
-to keep zombies and other ratware away from Postfix itself. This
-would use the "pass" service type which has been available in
-stable Postfix releases since Postfix 2.5. </p>
+<p> The postscreen(8) daemon, introduced with Postfix 2.8, provides
+additional protection against mail server overload. One postscreen(8)
+process handles all connections from "new" SMTP clients, and allows
+only well-behaved clients to talk to a Postfix SMTP server process.
+By keeping spambots away, postscreen(8) leaves more SMTP server
+processes available for legitimate clients, and delays the onset
+of server overload conditions. </p>
 
 <h2><a name="credits"> Credits </a></h2>
 
index 977a683476c415bf0550e888f8935d282ffac061..d2f6843a880ea61cb9326b6e110b23ee6443d561 100644 (file)
@@ -257,6 +257,7 @@ static void post_jail_init(char *unused_name, char **unused_argv)
     query = vstring_alloc(100);
     why = vstring_alloc(100);
     result = vstring_alloc(100);
+    var_use_limit = 0;
 }
 
 MAIL_VERSION_STAMP_DECLARE;
@@ -275,9 +276,9 @@ int     main(int argc, char **argv)
      */
     MAIL_VERSION_STAMP_ALLOCATE;
 
-    multi_server_main(argc, argv, dnsblog_service,
-                     MAIL_SERVER_TIME_TABLE, time_table,
-                     MAIL_SERVER_POST_INIT, post_jail_init,
-                     MAIL_SERVER_UNLIMITED,
-                     0);
+    single_server_main(argc, argv, dnsblog_service,
+                      MAIL_SERVER_TIME_TABLE, time_table,
+                      MAIL_SERVER_POST_INIT, post_jail_init,
+                      MAIL_SERVER_UNLIMITED,
+                      0);
 }
index cfa9c3254d8a71724f172f75dfc1c8389de58d67..6faa14d9540b06be60cc3cd8a20ad990f7e82646 100644 (file)
 /*     service.
 /* DIAGNOSTICS
 /*     The result is 0 in case of success, -1 in case of failure.
+/* FILES
+/*     $queue_directory/public/pickup, server endpoint
+/*     $queue_directory/public/qmgr, server endpoint
+/* SEE ALSO
+/*     mail_trigger(3), see note about event_drain() usage
 /* LICENSE
 /* .ad
 /* .fi
index 188f10bc446d746e902023d8633df4881f17bdb4..d9f74a56bde15e09df09a43afb934efa823baad5 100644 (file)
@@ -13,7 +13,9 @@
 /*     ssize_t length;
 /* DESCRIPTION
 /*     mail_trigger() wakes up the specified mail subsystem, by
-/*     sending it the specified request.
+/*     sending it the specified request. In the case of non-FIFO
+/*     server endpoints, a short-running program should invoke
+/*     event_drain() to ensure proper request delivery.
 /*
 /*     Arguments:
 /* .IP class
index 1a8f59b2d9794854f692329c6856e5efb87eab3d..b0489e3dc4adbcdc0dfa4fbcfd010d74e6f34a7c 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      "20120426"
+#define MAIL_RELEASE_DATE      "20120520"
 #define MAIL_VERSION_NUMBER    "2.10"
 
 #ifdef SNAPSHOT
index 6fb859340fddca64098780e3d6e3375fdbc5e1c7..25e2985c219fe34b56be3e634d50658c1f098723 100644 (file)
@@ -115,7 +115,7 @@ test4b:     $(PROG) test4b.ref
        echo 'bar = aaa' >> main.cf
        echo smtpd1 unix - n n - 0 smtpd >> master.cf
        echo ' -o foo=xxx -o bar=yyy -o baz=zzz' >> master.cf
-       echo '#smtpd1 unix - n n - 0 smtpd' >> master.cf
+       echo '#smtpd2 unix - n n - 0 smtpd' >> master.cf
        ./$(PROG) -nc . >test4b.tmp 2>&1
        diff test4b.ref test4b.tmp
        rm -f main.cf master.cf test4b.tmp
index 1ad955869c855bb29965e6f6e142919654f32def..c72406587b6a6d8a4cab26b8699b8f90785e996a 100644 (file)
@@ -127,25 +127,50 @@ static const char *flag_user_parameter(const char *mac_name,
      */
     if (local_scope && dict_get(local_scope->all_params, mac_name)) {
        /* $name in master.cf references name=value in master.cf. */
-       if (PC_PARAM_TABLE_LOCATE(local_scope->valid_names, mac_name) == 0)
+       if (PC_PARAM_TABLE_LOCATE(local_scope->valid_names, mac_name) == 0) {
            PC_PARAM_TABLE_ENTER(local_scope->valid_names, mac_name,
                                 PC_PARAM_FLAG_USER, PC_PARAM_NO_DATA,
                                 convert_user_parameter);
+           if (msg_verbose)
+               msg_info("$%s in %s:%s validates %s=value in %s:%s",
+                        mac_name, MASTER_CONF_FILE,
+                        local_scope->name_space,
+                        mac_name, MASTER_CONF_FILE,
+                        local_scope->name_space);
+       }
     } else if (mail_conf_lookup(mac_name) != 0) {
        /* $name in main/master.cf references name=value in main.cf. */
-       if (PC_PARAM_TABLE_LOCATE(param_table, mac_name) == 0)
+       if (PC_PARAM_TABLE_LOCATE(param_table, mac_name) == 0) {
            PC_PARAM_TABLE_ENTER(param_table, mac_name, PC_PARAM_FLAG_USER,
                                 PC_PARAM_NO_DATA, convert_user_parameter);
+           if (msg_verbose) {
+               if (local_scope)
+                   msg_info("$%s in %s:%s validates %s=value in %s",
+                            mac_name, MASTER_CONF_FILE,
+                            local_scope->name_space,
+                            mac_name, MAIN_CONF_FILE);
+               else
+                   msg_info("$%s in %s validates %s=value in %s",
+                            mac_name, MAIN_CONF_FILE,
+                            mac_name, MAIN_CONF_FILE);
+           }
+       }
     }
     if (local_scope == 0) {
        for (local_scope = master_table; local_scope->argv; local_scope++) {
            if (local_scope->all_params != 0
                && dict_get(local_scope->all_params, mac_name) != 0
            /* $name in main.cf references name=value in master.cf. */
-               && PC_PARAM_TABLE_LOCATE(local_scope->valid_names, mac_name) == 0)
+               && PC_PARAM_TABLE_LOCATE(local_scope->valid_names, mac_name) == 0) {
                PC_PARAM_TABLE_ENTER(local_scope->valid_names, mac_name,
                                     PC_PARAM_FLAG_USER, PC_PARAM_NO_DATA,
                                     convert_user_parameter);
+               if (msg_verbose)
+                   msg_info("$%s in %s validates %s=value in %s:%s",
+                            mac_name, MAIN_CONF_FILE,
+                            mac_name, MASTER_CONF_FILE,
+                            local_scope->name_space);
+           }
        }
     }
     return (0);
@@ -311,6 +336,13 @@ void    register_user_parameters(void)
        }
     }
 
+    /*
+     * Scan the "-o parameter=value" instances in each master.cf name space.
+     */
+    for (masterp = master_table; masterp->argv != 0; masterp++)
+       if (masterp->all_params != 0)
+           scan_user_parameter_namespace(masterp->name_space, masterp);
+
     /*
      * Scan parameter values that are left at their defaults in the global
      * name space. Some defaults contain the $name of an obsolete parameter
@@ -324,11 +356,4 @@ void    register_user_parameters(void)
      * Scan the explicit name=value entries in the global name space.
      */
     scan_user_parameter_namespace(CONFIG_DICT, (PC_MASTER_ENT *) 0);
-
-    /*
-     * Scan the "-o parameter=value" instances in each master.cf name space.
-     */
-    for (masterp = master_table; masterp->argv != 0; masterp++)
-       if (masterp->all_params != 0)
-           scan_user_parameter_namespace(masterp->name_space, masterp);
 }
index c7ebd3c74a85ee1b97ea3d8237b17304f754127a..396ab97c6e1d4dbb3c4c44683ea4845d3ac40718 100644 (file)
@@ -61,6 +61,7 @@ postqueue.o: ../../include/argv.h
 postqueue.o: ../../include/attr.h
 postqueue.o: ../../include/clean_env.h
 postqueue.o: ../../include/connect.h
+postqueue.o: ../../include/events.h
 postqueue.o: ../../include/flush_clnt.h
 postqueue.o: ../../include/iostuff.h
 postqueue.o: ../../include/mail_conf.h
index 6ea91f90be262e5e83ea598bc38169f1f92e8220..ade5af9eefa2060431019943c1bd2612f83ec90f 100644 (file)
 #include <connect.h>
 #include <valid_hostname.h>
 #include <warn_stat.h>
+#include <events.h>
 
 /* Global library. */
 
@@ -352,6 +353,7 @@ static void flush_queue(void)
     if (mail_flush_maildrop() < 0)
        msg_fatal_status(EX_UNAVAILABLE,
                         "Cannot flush mail queue - mail system is down");
+    event_drain(2);
 }
 
 /* flush_site - flush mail for site */
index 82f88240c19dff2c5bb185fb3cad7ba598637c74..ef3140b6e90af0792d0642124fb35fd700c6ab77 100644 (file)
@@ -423,6 +423,9 @@ static void psc_dnsbl_receive(int event, char *context)
        score->pending_lookups -= 1;
        if (score->pending_lookups == 0)
            PSC_CALL_BACK_NOTIFY(score, PSC_NULL_EVENT);
+    } else if (event == EVENT_TIME) {
+       msg_warn("dnsblog reply timeout %ds for %s",
+                DNSBLOG_TIMEOUT, (char *) vstream_context(stream));
     }
     /* Here, score may be a null pointer. */
     vstream_fclose(stream);
@@ -503,6 +506,9 @@ int     psc_dnsbl_request(const char *client_addr,
            continue;
        }
        stream = vstream_fdopen(fd, O_RDWR);
+       vstream_control(stream,
+                       VSTREAM_CTL_CONTEXT, ht[0]->key,
+                       VSTREAM_CTL_END);
        attr_print(stream, ATTR_FLAG_NONE,
                   ATTR_TYPE_STR, MAIL_ATTR_RBL_DOMAIN, ht[0]->key,
                   ATTR_TYPE_STR, MAIL_ATTR_ACT_CLIENT_ADDR, client_addr,
index 18c08cf47ff9f9d98c295524ddf6645bbaef037e..fc2684944a30112f8ec1c64204b121dcbf69c4d0 100644 (file)
@@ -826,6 +826,12 @@ TLS_SESS_STATE *tls_client_start(const TLS_CLIENT_START_PROPS *props)
        msg_info("%s: TLS cipher list \"%s\"", props->namaddr, cipher_list);
     vstring_sprintf_append(myserverid, "&c=%s", cipher_list);
 
+    /*
+     * Finally, salt the session key with the OpenSSL library version,
+     * (run-time, rather than compile-time, just in case that matters).
+     */
+    vstring_sprintf_append(myserverid, "&l=%ld", (long) SSLeay());
+
     /*
      * Allocate a new TLScontext for the new connection and get an SSL
      * structure. Add the location of TLScontext to the SSL to later retrieve
index 73e58c08d8917404b01b300d0066ca4f95fca62b..f0ebf669c5046a2fbe299ca562f4ea4c8cb3b654 100644 (file)
@@ -181,9 +181,10 @@ static SSL_SESSION *get_server_session_cb(SSL *ssl, unsigned char *session_id,
 
 #define GEN_CACHE_ID(buf, id, len, service) \
     do { \
-       buf = vstring_alloc(2 * (len) + 1 + strlen(service) + 3); \
+       buf = vstring_alloc(2 * (len + strlen(service))); \
        hex_encode(buf, (char *) (id), (len)); \
        vstring_sprintf_append(buf, "&s=%s", (service)); \
+       vstring_sprintf_append(buf, "&l=%ld", (long) SSLeay()); \
     } while (0)
 
 
index 41fe422a3d1e07b9afa63c24e46e5a5918cf7bd2..f5119a32c0e52c9f66e7a321b07747dce5b07e5e 100644 (file)
@@ -35,7 +35,7 @@ SRCS  = alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \
        unix_pass_fd_fix.c dict_cache.c valid_utf_8.c dict_thash.c \
        ip_match.c nbbio.c stream_pass_connect.c base32_code.c dict_test.c \
        dict_fail.c msg_rate_delay.c dict_surrogate.c warn_stat.c \
-       dict_sockmap.c
+       dict_sockmap.c line_number.c
 OBJS   = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
        attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \
        attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \
@@ -72,7 +72,7 @@ OBJS  = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
        unix_pass_fd_fix.o dict_cache.o valid_utf_8.o dict_thash.o \
        ip_match.o nbbio.o stream_pass_connect.o base32_code.o dict_test.o \
        dict_fail.o msg_rate_delay.o dict_surrogate.o warn_stat.o \
-       dict_sockmap.o
+       dict_sockmap.o line_number.o
 HDRS   = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
        chroot_uid.h cidr_match.h clean_env.h connect.h ctable.h dict.h \
        dict_cdb.h dict_cidr.h dict_db.h dict_dbm.h dict_env.h dict_ht.h \
@@ -93,7 +93,7 @@ HDRS  = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
        username.h valid_hostname.h vbuf.h vbuf_print.h vstream.h vstring.h \
        vstring_vstream.h watchdog.h format_tv.h load_file.h killme_after.h \
        edit_file.h dict_cache.h dict_thash.h ip_match.h nbbio.h base32_code.h \
-       dict_fail.h warn_stat.h dict_sockmap.h
+       dict_fail.h warn_stat.h dict_sockmap.h line_number.h
 TESTSRC        = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
        stream_test.c dup2_pass_on_exec.c
 DEFS   = -I. -D$(SYSTYPE)
@@ -849,6 +849,7 @@ dict.o: dict.h
 dict.o: dict_ht.h
 dict.o: htable.h
 dict.o: iostuff.h
+dict.o: line_number.h
 dict.o: mac_expand.h
 dict.o: mac_parse.h
 dict.o: msg.h
@@ -1369,6 +1370,11 @@ ip_match.o: vstring.h
 killme_after.o: killme_after.c
 killme_after.o: killme_after.h
 killme_after.o: sys_defs.h
+line_number.o: line_number.c
+line_number.o: line_number.h
+line_number.o: sys_defs.h
+line_number.o: vbuf.h
+line_number.o: vstring.h
 line_wrap.o: line_wrap.c
 line_wrap.o: line_wrap.h
 line_wrap.o: sys_defs.h
index 3ef835b8987366281ce32008e0599c5152246c7d..173544c37edf28aaa3a71c267c08238741a66a04 100644 (file)
 #include "dict.h"
 #include "dict_ht.h"
 #include "warn_stat.h"
+#include "line_number.h"
 
 static HTABLE *dict_table;
 
@@ -424,6 +425,7 @@ void    dict_load_fp(const char *dict_name, VSTREAM *fp)
     VSTRING *buf;
     char   *member;
     char   *val;
+    int     old_lineno;
     int     lineno;
     const char *err;
     struct stat st;
@@ -434,14 +436,17 @@ void    dict_load_fp(const char *dict_name, VSTREAM *fp)
      */
     DICT_FIND_FOR_UPDATE(dict, dict_name);
     buf = vstring_alloc(100);
-    lineno = 0;
+    old_lineno = lineno = 0;
 
     if (fstat(vstream_fileno(fp), &st) < 0)
        msg_fatal("fstat %s: %m", VSTREAM_PATH(fp));
-    while (readlline(buf, fp, &lineno)) {
+    for ( /* void */ ; readlline(buf, fp, &lineno); old_lineno = lineno) {
        if ((err = split_nameval(STR(buf), &member, &val)) != 0)
-           msg_fatal("%s, line %d: %s: \"%s\"",
-                     VSTREAM_PATH(fp), lineno, err, STR(buf));
+           msg_fatal("%s, line %s: %s: \"%s\"",
+                     VSTREAM_PATH(fp),
+                     format_line_number((VSTRING *) 0,
+                                        old_lineno + 1, lineno),
+                     err, STR(buf));
        if (msg_verbose > 1)
            msg_info("%s: %s = %s", myname, member, val);
        if (dict->update(dict, member, val) != 0)
index d79596f57bf3184835745761ebce3efc66bee033..5dcfe5d553fc9bf48bab970e1b04378565d860e0 100644 (file)
@@ -180,6 +180,7 @@ typedef fd_set EVENT_MASK;
 #define EVENT_MASK_SET(fd, mask)       FD_SET((fd), (mask))
 #define EVENT_MASK_ISSET(fd, mask)     FD_ISSET((fd), (mask))
 #define EVENT_MASK_CLR(fd, mask)       FD_CLR((fd), (mask))
+#define EVENT_MASK_CMP(m1, m2) memcmp((m1), (m2), EVENT_MASK_BYTE_COUNT(m1))
 #else
 
  /*
@@ -226,6 +227,8 @@ typedef struct {
        (EVENT_MASK_FD_BYTE((fd), (mask)) & EVENT_MASK_FD_BIT(fd))
 #define EVENT_MASK_CLR(fd, mask) \
        (EVENT_MASK_FD_BYTE((fd), (mask)) &= ~EVENT_MASK_FD_BIT(fd))
+#define EVENT_MASK_CMP(m1, m2) \
+       memcmp((m1)->data, (m2)->data, EVENT_MASK_BYTE_COUNT(m1))
 #endif
 
  /*
@@ -664,8 +667,7 @@ void    event_drain(int time_limit)
     max_time = event_present + time_limit;
     while (event_present < max_time
           && (event_timer_head.pred != &event_timer_head
-              || memcmp(&zero_mask, &event_xmask,
-                        EVENT_MASK_BYTE_COUNT(&zero_mask)) != 0)) {
+              || EVENT_MASK_CMP(&zero_mask, &event_xmask) != 0)) {
        event_loop(1);
 #if (EVENTS_STYLE != EVENTS_STYLE_SELECT)
        if (EVENT_MASK_BYTE_COUNT(&zero_mask)
diff --git a/postfix/src/util/line_number.c b/postfix/src/util/line_number.c
new file mode 100644 (file)
index 0000000..253b3e2
--- /dev/null
@@ -0,0 +1,70 @@
+/*++
+/* NAME
+/*     line_number 3
+/* SUMMARY
+/*     line number utilities
+/* SYNOPSIS
+/*     #include <line_number.h>
+/*
+/*     char    *format_line_number(result, first, last)
+/*     VSTRING *buffer;
+/*     ssize_t first;
+/*     ssize_t lastl
+/* DESCRIPTION
+/*     format_line_number() formats a line number or number range.
+/*     The output is <first-number>-<last-number> when the numbers
+/*     differ, <first-number> when the numbers are identical.
+/* .IP result
+/*     Result buffer, or null-pointer. In the latter case the
+/*     result is stored in a static buffer that is overwritten
+/*     with subsequent calls. The function result value is a
+/*     pointer into the result buffer.
+/* .IP first
+/*     First line number.
+/* .IP last
+/*     Last line number.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+ /*
+  * System library.
+  */
+#include <sys_defs.h>
+
+ /*
+  * Utility library.
+  */
+#include <vstring.h>
+#include <line_number.h>
+
+/* format_line_number - pretty-print line number or number range */
+
+char   *format_line_number(VSTRING *result, ssize_t first, ssize_t last)
+{
+    static VSTRING *buf;
+
+    /*
+     * Your buffer or mine?
+     */
+    if (result == 0) {
+       if (buf == 0)
+           buf = vstring_alloc(10);
+       result = buf;
+    }
+
+    /*
+     * Print a range only when the numbers differ.
+     */
+    vstring_sprintf(result, first == last ? "%ld" : "%ld-%ld",
+                   (long) first, (long) last);
+
+    return (vstring_str(result));
+}
diff --git a/postfix/src/util/line_number.h b/postfix/src/util/line_number.h
new file mode 100644 (file)
index 0000000..0a53d15
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _LINE_NUMBER_H_INCLUDED_
+#define _LINE_NUMBER_H_INCLUDED_
+
+/*++
+/* NAME
+/*     line_number 3h
+/* SUMMARY
+/*     line number utilities
+/* SYNOPSIS
+/*     #include <line_number.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * Utility library.
+  */
+#include <vstring.h>
+
+ /*
+  * External interface.
+  */
+extern char *format_line_number(VSTRING *, ssize_t, ssize_t);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif