From: Wietse Venema Date: Wed, 26 Jan 2011 05:00:00 +0000 (-0500) Subject: postfix-2.9-20110126 X-Git-Tag: v2.9.0-RC1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9515d551de7e1293a20abe7fe5aaa564edbb7c18;p=thirdparty%2Fpostfix.git postfix-2.9-20110126 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 4f44458f3..673009776 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -16528,8 +16528,10 @@ Apologies for any names omitted. Cleanup: remove #ifdef MIGRATION_WARNING transitional code from postscreen. File: postscreen/postscreen.c. -20110124 +20110125 - 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. + Cleaned up and finalized read/write deadline support. Once + this code has been fielded it can go into Postfix 2.8.1, + and made available as optional patch for earlier releases. + Further refinements have only dimishing returns and can + evolve in the 2.9 release cycle. File: util/vstream.c. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 58c4b5156..f45300011 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 "20110125" +#define MAIL_RELEASE_DATE "20110126" #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 4978514a2..b404244dd 100644 --- a/postfix/src/global/smtp_stream.c +++ b/postfix/src/global/smtp_stream.c @@ -10,9 +10,6 @@ /* VSTREAM *stream; /* int timeout; /* -/* void smtp_timeout_reset(stream) -/* VSTREAM *stream; -/* /* void smtp_printf(stream, format, ...) /* VSTREAM *stream; /* const char *format; @@ -61,12 +58,6 @@ /* .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. @@ -155,9 +146,9 @@ #include "smtp_stream.h" -/* smtp_timeout_reset - reset per-stream error flags and read/write deadline */ +/* smtp_timeout_reset - reset per-stream error flags, restart deadline timer */ -void smtp_timeout_reset(VSTREAM *stream) +static void smtp_timeout_reset(VSTREAM *stream) { vstream_clearerr(stream); @@ -348,7 +339,7 @@ int smtp_get(VSTRING *vp, VSTREAM *stream, ssize_t bound) void smtp_fputs(const char *cp, ssize_t todo, VSTREAM *stream) { - ssize_t err; + ssize_t err; if (todo < 0) msg_panic("smtp_fputs: negative todo %ld", (long) todo); @@ -375,7 +366,7 @@ void smtp_fputs(const char *cp, ssize_t todo, VSTREAM *stream) void smtp_fwrite(const char *cp, ssize_t todo, VSTREAM *stream) { - ssize_t err; + ssize_t err; if (todo < 0) msg_panic("smtp_fwrite: negative todo %ld", (long) todo); diff --git a/postfix/src/global/smtp_stream.h b/postfix/src/global/smtp_stream.h index c481d0b9b..559392216 100644 --- a/postfix/src/global/smtp_stream.h +++ b/postfix/src/global/smtp_stream.h @@ -33,7 +33,6 @@ #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 c37c1523e..3dd9367b9 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -4667,7 +4667,6 @@ 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 41c1884f1..da6e80ce6 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) - smtp_flush(state->client); /* fix 20110124 */ + vstream_fflush(state->client); /* * Abort immediately if the connection is broken. diff --git a/postfix/src/util/vstream.c b/postfix/src/util/vstream.c index 9ee143a81..2c45683af 100644 --- a/postfix/src/util/vstream.c +++ b/postfix/src/util/vstream.c @@ -669,8 +669,10 @@ static int vstream_fflush_some(VSTREAM *stream, ssize_t to_flush) timeout = stream->timeout; if ((n = stream->write_fn(stream->fd, data, len, timeout, stream->context)) <= 0) { bp->flags |= VSTREAM_FLAG_ERR; - if (errno == ETIMEDOUT) + if (errno == ETIMEDOUT) { bp->flags |= VSTREAM_FLAG_TIMEOUT; + stream->time_limit.tv_sec = stream->time_limit.tv_usec = 0; + } return (VSTREAM_EOF); } if (timeout) @@ -816,8 +818,10 @@ static int vstream_buf_get_ready(VBUF *bp) switch (n = stream->read_fn(stream->fd, bp->data, bp->len, timeout, stream->context)) { case -1: bp->flags |= VSTREAM_FLAG_ERR; - if (errno == ETIMEDOUT) + if (errno == ETIMEDOUT) { bp->flags |= VSTREAM_FLAG_TIMEOUT; + stream->time_limit.tv_sec = stream->time_limit.tv_usec = 0; + } return (VSTREAM_EOF); case 0: bp->flags |= VSTREAM_FLAG_EOF;