]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.0.8-20030415
authorWietse Venema <wietse@porcupine.org>
Tue, 15 Apr 2003 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:28:48 +0000 (06:28 +0000)
postfix/.indent.pro
postfix/HISTORY
postfix/README_FILES/PGSQL_README
postfix/README_FILES/SASL_README
postfix/RELEASE_NOTES
postfix/src/global/mail_stream.c
postfix/src/global/mail_stream.h
postfix/src/global/mail_version.h
postfix/src/smtpstone/smtp-sink.c
postfix/src/util/dict_pgsql.c

index de1515131c26cbcf4457e605f64e74fbd0e7fb54..cd42b54bb96e2aef0a8c7c463b812b9155ea4a07 100644 (file)
@@ -1,7 +1,3 @@
--THOST
--TPLPGSQL
--TPGSQL_NAME
--TDICT_PGSQL
 -TABOUNCE
 -TALIAS_TOKEN
 -TARGV
@@ -50,6 +46,7 @@
 -TDICT_PCRE_PRESCAN_CONTEXT
 -TDICT_PCRE_REGEXP
 -TDICT_PCRE_RULE
+-TDICT_PGSQL
 -TDICT_PROXY
 -TDICT_REGEXP
 -TDICT_REGEXP_EXPAND_CONTEXT
@@ -70,6 +67,7 @@
 -THEADER_OPTS
 -THEADER_TOKEN
 -THOST
+-THOST
 -THTABLE
 -THTABLE_INFO
 -TINET_ADDR_LIST
@@ -87,6 +85,7 @@
 -TMAC_PARSE
 -TMAIL_PRINT
 -TMAIL_SCAN
+-TMAIL_STREAM
 -TMAPS
 -TMASTER_PROC
 -TMASTER_SERV
 -TNAMADR_LIST
 -TNAME_MASK
 -TPEER_NAME
+-TPGSQL_NAME
 -TPICKUP_INFO
 -TPIPE_ATTR
 -TPIPE_PARAMS
 -TPLMYSQL
+-TPLPGSQL
 -TPOST_MAIL_STATE
 -TQMGR_ENTRY
 -TQMGR_JOB
index 8439d67f8bd9d0e16ba98677dfca68270fcfebfb..6f05456013929ea107462f011120c7a92662b4f3 100644 (file)
@@ -7959,14 +7959,19 @@ Apologies for any names omitted.
        now has an explicit flush operation, and the smtp-source/sink
        programs are updated to take advantage of this.
 
-       Cleanup: the file system clock drift detection code now runs
-       only once per process instance, to minimize the performance
-       impact. File: global/mail_stream.c.
+       Cleanup: the file system clock drift detection code now
+       runs only once per process instance, to minimize the
+       performance impact. File: global/mail_stream.c.
 
        Robustness: avoid TIME_WAIT state with smtp/qmqp-source
        client sockets.  This puts less strain on local system
        resources.
 
+10030415
+
+       Cleanup: the file system clock drift detection code now
+       runs only for incoming mail. File: global/mail_stream.c.
+
 Open problems:
 
        Low: smtp-source may block when sending large test messages.
index 78675cee69502e31b371d5e05cf8f96a2be7a81e..623ca382055e89c5267f13c374694b28cedbd104 100644 (file)
@@ -26,9 +26,11 @@ Building Postfix with PostgreSQL support
 To use pgsql with Postfix on Debian GNU/Linux, you must install
 the postfix-pgsql package.
 
-In order to build Postfix with pgsql map support, you will need to
-add -DHAS_PGSQL and -I for the directory containing the PostgreSQL
-header files and the libpq library to AUXLIBS, for example:
+In order to build Postfix with pgsql map support, you specify
+-DHAS_PGSQL, the directory with the PostgreSQL header files, and
+the location of the libpq library file.
+
+For example:
 
     make tidy
     make -f Makefile.init makefiles \
@@ -103,17 +105,19 @@ hosts = host1.some.domain host2.some.domain unix:/file/name
 
 # end pgsql config file
 
-Eliminating single points of failure
-====================================
+Using mirrored databases
+========================
+
+Sites that have a need for multiple mail exchangers may enjoy the
+convenience of using a networked mailer database, but do not want
+to introduce a single point of failure to their system.  
+
+For this reason we've included the ability to have Postfix reference
+multiple hosts for access to a single pgsql map.  This will work
+if sites set up mirrored pgsql databases on two or more hosts.
 
-Since sites that have a need for multiple mail exchangers may enjoy
-the convenience of using a networked mailer database, but do not
-want to introduce a single point of failure to their system, we've
-included the ability to have postfix reference multiple hosts for
-access to a single pgsql map.  This will work if sites set up
-mirrored pgsql databases on two or more hosts.  Whenever queries
-fail with an error at one host, the rest of the hosts will be tried
-in order.  Each host that is in an error state will undergo a
-reconnection attempt every so often, and if no pgsql server hosts
-are reachable, then mail will be deferred until at least one of
-those hosts is reachable.
+Whenever queries fail with an error at one host, the rest of the
+hosts will be tried in order.  Each host that is in an error state
+will undergo a reconnection attempt every so often, and if no pgsql
+server hosts are reachable, then mail will be deferred until at
+least one of those hosts is reachable.
index e2d1d39df6ceda4e11ff1b693888070e0d457c54..f5dbdcca4888ca234c9f7b4c40d8710d09008880 100644 (file)
@@ -227,6 +227,19 @@ can use one of the following commands:
 mmencode is part of the metamail software.
 MIME::Base64 is available from www.cpan.org.
 
+Trouble shooting the SASL internals
+===================================
+
+[based on text by Liviu Daia]
+
+In the Cyrus SASL sources you'll find a subdirectory named "sample".
+Run make there, then run the resulting sample server and client in
+separate terminals.  Strace / ktrace / truss the server to see what
+makes it unhappy, fix the problem, then write the authors thanking
+them for providing such useful logging.  Repeat the previous step
+until you can successfully authenticate with the sample client.
+Only then get back to Postfix.
+
 Enabling SASL authentication in the Postfix SMTP client
 =======================================================
 
index 72b7e1905477f79333fd7114df303e78f31bd5a7..55fab1989fae4c20a1fccc630e87c4d7347bd3b2 100644 (file)
@@ -38,10 +38,10 @@ PostgreSQL table lookups. Specify "pgsql:/file/name" where "/file/name"
 defines the database. See the sample-pgsql-aliases.cf file for
 examples, and the PGSQL_README file for general information.
 
-Workarounds for file systems whose clock runs ahead of the local
-clock (this can happen with remote file systems). Postfix now logs
-a warning and proceeds with reduced performance, instead of ignoring
-new mail completely.
+Workaround for file system clock drift that caused Postfix to ignore
+new mail (this could happen with file systems mounted from a server).
+Postfix now logs a warning and proceeds with only slightly reduced
+performance, instead of ignoring new mail.
 
 Incompatible changes with Postfix snapshot 2.0.6-20030305
 =========================================================
index e07e37d592b4c9cd5eb85f648e73909d4409bc74..094cb00b05c1ba3c37b84836b83ba425af4038d7 100644 (file)
@@ -111,9 +111,10 @@ static VSTRING *id_buf;
 
 /* mail_stream_cleanup - clean up after success or failure */
 
-void    mail_stream_cleanup(MAIL_STREAM * info)
+void    mail_stream_cleanup(MAIL_STREAM *info)
 {
     FREE_AND_WIPE(info->close, info->stream);
+    FREE_AND_WIPE(myfree, info->queue);
     FREE_AND_WIPE(myfree, info->id);
     FREE_AND_WIPE(myfree, info->class);
     FREE_AND_WIPE(myfree, info->service);
@@ -122,16 +123,17 @@ void    mail_stream_cleanup(MAIL_STREAM * info)
 
 /* mail_stream_finish_file - finish file mail stream */
 
-static int mail_stream_finish_file(MAIL_STREAM * info, VSTRING *unused_why)
+static int mail_stream_finish_file(MAIL_STREAM *info, VSTRING *unused_why)
 {
     int     status = 0;
     static char wakeup[] = {TRIGGER_REQ_WAKEUP};
     struct stat st;
     time_t  now;
     struct utimbuf tbuf;
-    char   *queue_file_path = 0;
-    static int fs_clock_ok = 0;
-    static int fs_clock_warned = 0;
+    char   *path_to_reset = 0;
+    static int incoming_fs_clock_ok = 0;
+    static int incoming_clock_warned = 0;
+    int     check_incoming_fs_clock;
 
     /*
      * Make sure the message makes it to file. Set the execute bit when no
@@ -145,18 +147,25 @@ static int mail_stream_finish_file(MAIL_STREAM * info, VSTRING *unused_why)
      * must end with an explicit END record. Postfix queue files without END
      * record are discarded.
      * 
-     * Attempt to detect file system clocks that are ahead of local time. the
-     * effect can be difficult to understand (mail is enqueued but Postfix
-     * ignores it). This clock drift detection may not work with file systems
-     * that work on a local copy of the file and that update the server only
-     * after the file is closed.
+     * Attempt to detect file system clocks that are ahead of local time, but
+     * don't check the file system clock all the time. The effect of file
+     * system clock drift can be difficult to understand (Postfix ignores new
+     * mail until the next queue run).
+     * 
+     * This clock drift detection code may not work with file systems that work
+     * on a local copy of the file and that update the server only after the
+     * file is closed.
      */
+    check_incoming_fs_clock =
+       (!incoming_fs_clock_ok && !strcmp(info->queue, MAIL_QUEUE_INCOMING));
+
     if (vstream_fflush(info->stream)
        || fchmod(vstream_fileno(info->stream), 0700 | info->mode)
 #ifdef HAS_FSYNC
        || fsync(vstream_fileno(info->stream))
 #endif
-       || (fs_clock_ok == 0 && fstat(vstream_fileno(info->stream), &st) < 0)
+       || (check_incoming_fs_clock
+           && fstat(vstream_fileno(info->stream), &st) < 0)
        )
        status = (errno == EFBIG ? CLEANUP_STAT_SIZE : CLEANUP_STAT_WRITE);
 
@@ -164,24 +173,21 @@ static int mail_stream_finish_file(MAIL_STREAM * info, VSTRING *unused_why)
     st.st_mtime += 10;
 #endif
 
-    /*
-     * Don't check the file system clock all the time.
-     */
-    if (fs_clock_ok == 0 && st.st_mtime <= time(&now))
-       fs_clock_ok = 1;
-
     /*
      * Work around file system clocks that are ahead of local time.
      */
-    if (status == CLEANUP_STAT_OK && fs_clock_ok == 0) {
-       if (fs_clock_warned == 0) {
-           msg_warn("%s: file system clock is %d seconds ahead of local clock",
-                    info->id, (int) (st.st_mtime - now));
-           msg_warn("%s: resetting file time stamps - this hurts performance",
-                    info->id);
-           fs_clock_warned = 1;
+    if (status == CLEANUP_STAT_OK && check_incoming_fs_clock) {
+       if (st.st_mtime <= time(&now)) {
+           incoming_fs_clock_ok = 1;
+       } else {
+           path_to_reset = mystrdup(VSTREAM_PATH(info->stream));
+           if (incoming_clock_warned == 0) {
+               msg_warn("file system clock is %d seconds ahead of local clock",
+                        (int) (st.st_mtime - now));
+               msg_warn("resetting file time stamps - this hurts performance");
+               incoming_clock_warned = 1;
+           }
        }
-       queue_file_path = mystrdup(VSTREAM_PATH(info->stream));
     }
 
     /*
@@ -199,11 +205,11 @@ static int mail_stream_finish_file(MAIL_STREAM * info, VSTRING *unused_why)
     /*
      * Work around file system clocks that are ahead of local time.
      */
-    if (queue_file_path != 0) {
+    if (path_to_reset != 0) {
        tbuf.actime = tbuf.modtime = now;
-       if (utime(queue_file_path, &tbuf) < 0 && errno != ENOENT)
+       if (utime(path_to_reset, &tbuf) < 0 && errno != ENOENT)
            msg_fatal("%s: update file time stamps: %m", info->id);
-       myfree(queue_file_path);
+       myfree(path_to_reset);
     }
 
     /*
@@ -222,7 +228,7 @@ static int mail_stream_finish_file(MAIL_STREAM * info, VSTRING *unused_why)
 
 /* mail_stream_finish_ipc - finish IPC mail stream */
 
-static int mail_stream_finish_ipc(MAIL_STREAM * info, VSTRING *why)
+static int mail_stream_finish_ipc(MAIL_STREAM *info, VSTRING *why)
 {
     int     status = CLEANUP_STAT_WRITE;
 
@@ -247,7 +253,7 @@ static int mail_stream_finish_ipc(MAIL_STREAM * info, VSTRING *why)
 
 /* mail_stream_finish - finish action */
 
-int     mail_stream_finish(MAIL_STREAM * info, VSTRING *why)
+int     mail_stream_finish(MAIL_STREAM *info, VSTRING *why)
 {
     return (info->finish(info, why));
 }
@@ -268,6 +274,7 @@ MAIL_STREAM *mail_stream_file(const char *queue, const char *class,
     info->stream = stream;
     info->finish = mail_stream_finish_file;
     info->close = vstream_fclose;
+    info->queue = mystrdup(queue);
     info->id = mystrdup(basename(VSTREAM_PATH(stream)));
     info->class = mystrdup(class);
     info->service = mystrdup(service);
@@ -295,6 +302,7 @@ MAIL_STREAM *mail_stream_service(const char *class, const char *name)
        info->stream = stream;
        info->finish = mail_stream_finish_ipc;
        info->close = vstream_fclose;
+       info->queue = 0;
        info->id = mystrdup(vstring_str(id_buf));
        info->class = 0;
        info->service = 0;
@@ -345,6 +353,7 @@ MAIL_STREAM *mail_stream_command(const char *command)
        info->stream = stream;
        info->finish = mail_stream_finish_ipc;
        info->close = vstream_pclose;
+       info->queue = 0;
        info->id = mystrdup(vstring_str(id_buf));
        info->class = 0;
        info->service = 0;
index c9fbfd97a78a2ba46f0f821e8d990711a72f6cde..a1e64f13ec7df2b0eb8480f189c67f5cdfba0e98 100644 (file)
@@ -27,6 +27,7 @@ typedef int (*MAIL_STREAM_CLOSE_FN) (VSTREAM *);
 
 struct MAIL_STREAM {
     VSTREAM *stream;                   /* file or pipe or socket */
+    char   *queue;                     /* (initial) queue name */
     char   *id;                                /* queue id */
     MAIL_STREAM_FINISH_FN finish;      /* finish code */
     MAIL_STREAM_CLOSE_FN close;                /* close stream */
index 4a74a4f8b791f897ae21f4d705f3951a1ef68725..f6665ddc13114d64e9f7776b495acea905719cd7 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change the patchlevel and the release date. Snapshots change the
   * release date only, unless they include the same bugfix as a patch release.
   */
-#define MAIL_RELEASE_DATE      "20030414"
+#define MAIL_RELEASE_DATE      "20030415"
 
 #define VAR_MAIL_VERSION       "mail_version"
 #define DEF_MAIL_VERSION       "2.0.8-" MAIL_RELEASE_DATE
index cdcd1cd053012620da82689c4f337b5c8f338d98..2f3f7af046dc12e2f9e9287df91a20202d252d36 100644 (file)
@@ -205,8 +205,8 @@ static void data_event(int unused_event, char *context)
 static void dot_response(SINK_STATE *state)
 {
     if (enable_lmtp) {
-       while (state->rcpts-- > 0)      /* XXX this could block */
-           ok_response(state);
+       while (state->rcpts-- > 0)              /* XXX this could block */
+           ok_response(state);                 /* XXX this flushes too often */
     } else {
        ok_response(state);
     }
index 0fc350f67f9dfe16b1c570745d931f86fe973a73..7968168e183e83368bb1319de8c2baf040b50d08 100644 (file)
@@ -6,9 +6,9 @@
 /* SYNOPSIS
 /*     #include <dict_pgsql.h>
 /*
-/*     DICT    *dict_pgsql_open(name, dummy, unused_dict_flags)
+/*     DICT    *dict_pgsql_open(name, unused_open_flags, unused_dict_flags)
 /*     const char *name;
-/*     int     dummy;
+/*     int     unused_open_flags;
 /*     int     unused_dict_flags;
 /* DESCRIPTION
 /*     dict_pgsql_open() creates a dictionary of type 'pgsql'.  This
@@ -17,8 +17,8 @@
 /*     or a null pointer in case of problems.
 /*
 /*     The pgsql dictionary can manage multiple connections to
-/*     different sql servers on different hosts.  It assumes that
-/*     the underlying data on each host is identical (mirrored) and
+/*     different sql servers for the same database.  It assumes that
+/*     the underlying data on each server is identical (mirrored) and
 /*     maintains one connection at any given time.  If any connection
 /*     fails,  any other available ones will be opened and used.
 /*     The intent of this feature is to eliminate a single point of