2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 13:48:06 +00:00

postfix-2.0.8-20030415

This commit is contained in:
Wietse Venema 2003-04-15 00:00:00 -05:00 committed by Viktor Dukhovni
parent 5a69a3ff2c
commit dd091f0976
10 changed files with 97 additions and 64 deletions

9
postfix/.indent.pro vendored
View File

@ -1,7 +1,3 @@
-THOST
-TPLPGSQL
-TPGSQL_NAME
-TDICT_PGSQL
-TABOUNCE -TABOUNCE
-TALIAS_TOKEN -TALIAS_TOKEN
-TARGV -TARGV
@ -50,6 +46,7 @@
-TDICT_PCRE_PRESCAN_CONTEXT -TDICT_PCRE_PRESCAN_CONTEXT
-TDICT_PCRE_REGEXP -TDICT_PCRE_REGEXP
-TDICT_PCRE_RULE -TDICT_PCRE_RULE
-TDICT_PGSQL
-TDICT_PROXY -TDICT_PROXY
-TDICT_REGEXP -TDICT_REGEXP
-TDICT_REGEXP_EXPAND_CONTEXT -TDICT_REGEXP_EXPAND_CONTEXT
@ -70,6 +67,7 @@
-THEADER_OPTS -THEADER_OPTS
-THEADER_TOKEN -THEADER_TOKEN
-THOST -THOST
-THOST
-THTABLE -THTABLE
-THTABLE_INFO -THTABLE_INFO
-TINET_ADDR_LIST -TINET_ADDR_LIST
@ -87,6 +85,7 @@
-TMAC_PARSE -TMAC_PARSE
-TMAIL_PRINT -TMAIL_PRINT
-TMAIL_SCAN -TMAIL_SCAN
-TMAIL_STREAM
-TMAPS -TMAPS
-TMASTER_PROC -TMASTER_PROC
-TMASTER_SERV -TMASTER_SERV
@ -109,10 +108,12 @@
-TNAMADR_LIST -TNAMADR_LIST
-TNAME_MASK -TNAME_MASK
-TPEER_NAME -TPEER_NAME
-TPGSQL_NAME
-TPICKUP_INFO -TPICKUP_INFO
-TPIPE_ATTR -TPIPE_ATTR
-TPIPE_PARAMS -TPIPE_PARAMS
-TPLMYSQL -TPLMYSQL
-TPLPGSQL
-TPOST_MAIL_STATE -TPOST_MAIL_STATE
-TQMGR_ENTRY -TQMGR_ENTRY
-TQMGR_JOB -TQMGR_JOB

View File

@ -7959,14 +7959,19 @@ Apologies for any names omitted.
now has an explicit flush operation, and the smtp-source/sink now has an explicit flush operation, and the smtp-source/sink
programs are updated to take advantage of this. programs are updated to take advantage of this.
Cleanup: the file system clock drift detection code now runs Cleanup: the file system clock drift detection code now
only once per process instance, to minimize the performance runs only once per process instance, to minimize the
impact. File: global/mail_stream.c. performance impact. File: global/mail_stream.c.
Robustness: avoid TIME_WAIT state with smtp/qmqp-source Robustness: avoid TIME_WAIT state with smtp/qmqp-source
client sockets. This puts less strain on local system client sockets. This puts less strain on local system
resources. resources.
10030415
Cleanup: the file system clock drift detection code now
runs only for incoming mail. File: global/mail_stream.c.
Open problems: Open problems:
Low: smtp-source may block when sending large test messages. Low: smtp-source may block when sending large test messages.

View File

@ -26,9 +26,11 @@ Building Postfix with PostgreSQL support
To use pgsql with Postfix on Debian GNU/Linux, you must install To use pgsql with Postfix on Debian GNU/Linux, you must install
the postfix-pgsql package. the postfix-pgsql package.
In order to build Postfix with pgsql map support, you will need to In order to build Postfix with pgsql map support, you specify
add -DHAS_PGSQL and -I for the directory containing the PostgreSQL -DHAS_PGSQL, the directory with the PostgreSQL header files, and
header files and the libpq library to AUXLIBS, for example: the location of the libpq library file.
For example:
make tidy make tidy
make -f Makefile.init makefiles \ make -f Makefile.init makefiles \
@ -103,17 +105,19 @@ hosts = host1.some.domain host2.some.domain unix:/file/name
# end pgsql config file # end pgsql config file
Eliminating single points of failure Using mirrored databases
==================================== ========================
Since sites that have a need for multiple mail exchangers may enjoy Sites that have a need for multiple mail exchangers may enjoy the
the convenience of using a networked mailer database, but do not convenience of using a networked mailer database, but do not want
want to introduce a single point of failure to their system, we've to introduce a single point of failure to their system.
included the ability to have postfix reference multiple hosts for
access to a single pgsql map. This will work if sites set up For this reason we've included the ability to have Postfix reference
mirrored pgsql databases on two or more hosts. Whenever queries multiple hosts for access to a single pgsql map. This will work
fail with an error at one host, the rest of the hosts will be tried if sites set up mirrored pgsql databases on two or more hosts.
in order. Each host that is in an error state will undergo a
reconnection attempt every so often, and if no pgsql server hosts Whenever queries fail with an error at one host, the rest of the
are reachable, then mail will be deferred until at least one of hosts will be tried in order. Each host that is in an error state
those hosts is reachable. 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.

View File

@ -227,6 +227,19 @@ can use one of the following commands:
mmencode is part of the metamail software. mmencode is part of the metamail software.
MIME::Base64 is available from www.cpan.org. 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 Enabling SASL authentication in the Postfix SMTP client
======================================================= =======================================================

View 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 defines the database. See the sample-pgsql-aliases.cf file for
examples, and the PGSQL_README file for general information. examples, and the PGSQL_README file for general information.
Workarounds for file systems whose clock runs ahead of the local Workaround for file system clock drift that caused Postfix to ignore
clock (this can happen with remote file systems). Postfix now logs new mail (this could happen with file systems mounted from a server).
a warning and proceeds with reduced performance, instead of ignoring Postfix now logs a warning and proceeds with only slightly reduced
new mail completely. performance, instead of ignoring new mail.
Incompatible changes with Postfix snapshot 2.0.6-20030305 Incompatible changes with Postfix snapshot 2.0.6-20030305
========================================================= =========================================================

View File

@ -111,9 +111,10 @@ static VSTRING *id_buf;
/* mail_stream_cleanup - clean up after success or failure */ /* 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(info->close, info->stream);
FREE_AND_WIPE(myfree, info->queue);
FREE_AND_WIPE(myfree, info->id); FREE_AND_WIPE(myfree, info->id);
FREE_AND_WIPE(myfree, info->class); FREE_AND_WIPE(myfree, info->class);
FREE_AND_WIPE(myfree, info->service); 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 */ /* 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; int status = 0;
static char wakeup[] = {TRIGGER_REQ_WAKEUP}; static char wakeup[] = {TRIGGER_REQ_WAKEUP};
struct stat st; struct stat st;
time_t now; time_t now;
struct utimbuf tbuf; struct utimbuf tbuf;
char *queue_file_path = 0; char *path_to_reset = 0;
static int fs_clock_ok = 0; static int incoming_fs_clock_ok = 0;
static int fs_clock_warned = 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 * 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 * must end with an explicit END record. Postfix queue files without END
* record are discarded. * record are discarded.
* *
* Attempt to detect file system clocks that are ahead of local time. the * Attempt to detect file system clocks that are ahead of local time, but
* effect can be difficult to understand (mail is enqueued but Postfix * don't check the file system clock all the time. The effect of file
* ignores it). This clock drift detection may not work with file systems * system clock drift can be difficult to understand (Postfix ignores new
* that work on a local copy of the file and that update the server only * mail until the next queue run).
* after the file is closed. *
* 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) if (vstream_fflush(info->stream)
|| fchmod(vstream_fileno(info->stream), 0700 | info->mode) || fchmod(vstream_fileno(info->stream), 0700 | info->mode)
#ifdef HAS_FSYNC #ifdef HAS_FSYNC
|| fsync(vstream_fileno(info->stream)) || fsync(vstream_fileno(info->stream))
#endif #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); 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; st.st_mtime += 10;
#endif #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. * Work around file system clocks that are ahead of local time.
*/ */
if (status == CLEANUP_STAT_OK && fs_clock_ok == 0) { if (status == CLEANUP_STAT_OK && check_incoming_fs_clock) {
if (fs_clock_warned == 0) { if (st.st_mtime <= time(&now)) {
msg_warn("%s: file system clock is %d seconds ahead of local clock", incoming_fs_clock_ok = 1;
info->id, (int) (st.st_mtime - now)); } else {
msg_warn("%s: resetting file time stamps - this hurts performance", path_to_reset = mystrdup(VSTREAM_PATH(info->stream));
info->id); if (incoming_clock_warned == 0) {
fs_clock_warned = 1; 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. * 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; 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); 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 */ /* 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; 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 */ /* 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)); return (info->finish(info, why));
} }
@ -268,6 +274,7 @@ MAIL_STREAM *mail_stream_file(const char *queue, const char *class,
info->stream = stream; info->stream = stream;
info->finish = mail_stream_finish_file; info->finish = mail_stream_finish_file;
info->close = vstream_fclose; info->close = vstream_fclose;
info->queue = mystrdup(queue);
info->id = mystrdup(basename(VSTREAM_PATH(stream))); info->id = mystrdup(basename(VSTREAM_PATH(stream)));
info->class = mystrdup(class); info->class = mystrdup(class);
info->service = mystrdup(service); info->service = mystrdup(service);
@ -295,6 +302,7 @@ MAIL_STREAM *mail_stream_service(const char *class, const char *name)
info->stream = stream; info->stream = stream;
info->finish = mail_stream_finish_ipc; info->finish = mail_stream_finish_ipc;
info->close = vstream_fclose; info->close = vstream_fclose;
info->queue = 0;
info->id = mystrdup(vstring_str(id_buf)); info->id = mystrdup(vstring_str(id_buf));
info->class = 0; info->class = 0;
info->service = 0; info->service = 0;
@ -345,6 +353,7 @@ MAIL_STREAM *mail_stream_command(const char *command)
info->stream = stream; info->stream = stream;
info->finish = mail_stream_finish_ipc; info->finish = mail_stream_finish_ipc;
info->close = vstream_pclose; info->close = vstream_pclose;
info->queue = 0;
info->id = mystrdup(vstring_str(id_buf)); info->id = mystrdup(vstring_str(id_buf));
info->class = 0; info->class = 0;
info->service = 0; info->service = 0;

View File

@ -27,6 +27,7 @@ typedef int (*MAIL_STREAM_CLOSE_FN) (VSTREAM *);
struct MAIL_STREAM { struct MAIL_STREAM {
VSTREAM *stream; /* file or pipe or socket */ VSTREAM *stream; /* file or pipe or socket */
char *queue; /* (initial) queue name */
char *id; /* queue id */ char *id; /* queue id */
MAIL_STREAM_FINISH_FN finish; /* finish code */ MAIL_STREAM_FINISH_FN finish; /* finish code */
MAIL_STREAM_CLOSE_FN close; /* close stream */ MAIL_STREAM_CLOSE_FN close; /* close stream */

View File

@ -20,7 +20,7 @@
* Patches change the patchlevel and the release date. Snapshots change the * Patches change the patchlevel and the release date. Snapshots change the
* release date only, unless they include the same bugfix as a patch release. * 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 VAR_MAIL_VERSION "mail_version"
#define DEF_MAIL_VERSION "2.0.8-" MAIL_RELEASE_DATE #define DEF_MAIL_VERSION "2.0.8-" MAIL_RELEASE_DATE

View File

@ -205,8 +205,8 @@ static void data_event(int unused_event, char *context)
static void dot_response(SINK_STATE *state) static void dot_response(SINK_STATE *state)
{ {
if (enable_lmtp) { if (enable_lmtp) {
while (state->rcpts-- > 0) /* XXX this could block */ while (state->rcpts-- > 0) /* XXX this could block */
ok_response(state); ok_response(state); /* XXX this flushes too often */
} else { } else {
ok_response(state); ok_response(state);
} }

View File

@ -6,9 +6,9 @@
/* SYNOPSIS /* SYNOPSIS
/* #include <dict_pgsql.h> /* #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; /* const char *name;
/* int dummy; /* int unused_open_flags;
/* int unused_dict_flags; /* int unused_dict_flags;
/* DESCRIPTION /* DESCRIPTION
/* dict_pgsql_open() creates a dictionary of type 'pgsql'. This /* dict_pgsql_open() creates a dictionary of type 'pgsql'. This
@ -17,8 +17,8 @@
/* or a null pointer in case of problems. /* or a null pointer in case of problems.
/* /*
/* The pgsql dictionary can manage multiple connections to /* The pgsql dictionary can manage multiple connections to
/* different sql servers on different hosts. It assumes that /* different sql servers for the same database. It assumes that
/* the underlying data on each host is identical (mirrored) and /* the underlying data on each server is identical (mirrored) and
/* maintains one connection at any given time. If any connection /* maintains one connection at any given time. If any connection
/* fails, any other available ones will be opened and used. /* fails, any other available ones will be opened and used.
/* The intent of this feature is to eliminate a single point of /* The intent of this feature is to eliminate a single point of