From e815d33b74773984f3a8677146cfee8572a232cd Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Tue, 25 Jan 2011 00:00:00 -0500 Subject: [PATCH] postfix-2.9-20110125 --- postfix/HISTORY | 6 ++++++ postfix/src/global/mail_version.h | 2 +- postfix/src/global/smtp_stream.c | 13 +++++++++++-- postfix/src/global/smtp_stream.h | 1 + postfix/src/smtpd/smtpd.c | 1 + postfix/src/smtpd/smtpd_chat.c | 2 +- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index 7b1195fbc..4f44458f3 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -16527,3 +16527,9 @@ Apologies for any names omitted. Cleanup: remove #ifdef MIGRATION_WARNING transitional code from postscreen. File: postscreen/postscreen.c. + +20110124 + + Cleanup: use the right primitive to flush responses when + the Postfix SMTP server is taking an excessive amount of + time to process client requests. File: smtpd/smtpd_chat.c. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 77e8821a0..58c4b5156 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -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 "20110124" +#define MAIL_RELEASE_DATE "20110125" #define MAIL_VERSION_NUMBER "2.9" #ifdef SNAPSHOT diff --git a/postfix/src/global/smtp_stream.c b/postfix/src/global/smtp_stream.c index 73ad87054..4978514a2 100644 --- a/postfix/src/global/smtp_stream.c +++ b/postfix/src/global/smtp_stream.c @@ -10,6 +10,9 @@ /* VSTREAM *stream; /* int timeout; /* +/* void smtp_timeout_reset(stream) +/* VSTREAM *stream; +/* /* void smtp_printf(stream, format, ...) /* VSTREAM *stream; /* const char *format; @@ -58,6 +61,12 @@ /* .IP \f(bu /* The stream is configured to enable exception handling. /* .PP +/* smtp_timeout_reset() clears the error flags and restarts +/* the deadline timer for the named stream. This leaves the +/* stream in a state that is suitable for the final "flush +/* before close" operation, without depending on any other +/* primitives provided by this module. +/* /* smtp_printf() formats its arguments and writes the result to /* the named stream, followed by a CR LF pair. The stream is NOT flushed. /* Long lines of text are not broken. @@ -146,9 +155,9 @@ #include "smtp_stream.h" -/* smtp_timeout_reset - reset per-stream timeout flag */ +/* smtp_timeout_reset - reset per-stream error flags and read/write deadline */ -static void smtp_timeout_reset(VSTREAM *stream) +void smtp_timeout_reset(VSTREAM *stream) { vstream_clearerr(stream); diff --git a/postfix/src/global/smtp_stream.h b/postfix/src/global/smtp_stream.h index 559392216..c481d0b9b 100644 --- a/postfix/src/global/smtp_stream.h +++ b/postfix/src/global/smtp_stream.h @@ -33,6 +33,7 @@ #define SMTP_ERR_NONE 4 /* non-error case */ extern void smtp_timeout_setup(VSTREAM *, int); +extern void smtp_timeout_reset(VSTREAM *); extern void PRINTFLIKE(2, 3) smtp_printf(VSTREAM *, const char *,...); extern void smtp_flush(VSTREAM *); extern int smtp_fgetc(VSTREAM *); diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 3dd9367b9..c37c1523e 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -4667,6 +4667,7 @@ static void smtpd_proto(SMTPD_STATE *state) } break; } + smtp_timeout_reset(state->client); /* * XXX The client connection count/rate control must be consistent in its diff --git a/postfix/src/smtpd/smtpd_chat.c b/postfix/src/smtpd/smtpd_chat.c index da6e80ce6..41c1884f1 100644 --- a/postfix/src/smtpd/smtpd_chat.c +++ b/postfix/src/smtpd/smtpd_chat.c @@ -199,7 +199,7 @@ void smtpd_chat_reply(SMTPD_STATE *state, const char *format,...) * delays (tarpit delays or DNS lookups for UCE restrictions). */ if (delay || time((time_t *) 0) - vstream_ftime(state->client) > 10) - vstream_fflush(state->client); + smtp_flush(state->client); /* fix 20110124 */ /* * Abort immediately if the connection is broken.