2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-22 18:07:41 +00:00

postfix-2.12-20140508

This commit is contained in:
Wietse Venema 2014-05-08 00:00:00 -05:00 committed by Viktor Dukhovni
parent 542b0c899e
commit 65a3d49cf6
9 changed files with 39 additions and 21 deletions

View File

@ -19711,3 +19711,13 @@ Apologies for any names omitted.
reported by Sahil Tandon, predicate error found by Viktor, reported by Sahil Tandon, predicate error found by Viktor,
redundant connection restore request eliminated by Wietse. redundant connection restore request eliminated by Wietse.
File: smtp/smtp_connect.c. File: smtp/smtp_connect.c.
Cleanup: the macros that control SMTP connection reuse
poorly reflected their purpose. "DEAD" is replaced with
"FORBIDDEN" (no I/O allowed) and "BAD" is replaced with
"THROTTLED" (anything that causes the queue manager to back
off from some destination). Files: smtp.h, smtp_coonnect.c,
smtp_proto.c, smtp_trouble.c.
Cleanup: enable SMTP connection cache lookup by destination
while a surge of mail is drying up. File: smtp_connect.c.

View File

@ -73,6 +73,8 @@ a delegated SMTPD access policy request:
stress= stress=
PPoossttffiixx vveerrssiioonn 22..99 aanndd llaatteerr:: PPoossttffiixx vveerrssiioonn 22..99 aanndd llaatteerr::
ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40 ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40
PPoossttffiixx vveerrssiioonn 22..1122 aanndd llaatteerr::
client_port=1234
[empty line] [empty line]
Notes: Notes:

View File

@ -104,6 +104,8 @@ etrn_domain=
stress= stress=
<b>Postfix version 2.9 and later:</b> <b>Postfix version 2.9 and later:</b>
ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40 ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40
<b>Postfix version 2.12 and later:</b>
client_port=1234
[empty line] [empty line]
</pre> </pre>
</blockquote> </blockquote>

View File

@ -104,6 +104,8 @@ etrn_domain=
stress= stress=
<b>Postfix version 2.9 and later:</b> <b>Postfix version 2.9 and later:</b>
ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40 ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40
<b>Postfix version 2.12 and later:</b>
client_port=1234
[empty line] [empty line]
</pre> </pre>
</blockquote> </blockquote>

View File

@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no * Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only. * patchlevel; they change the release date only.
*/ */
#define MAIL_RELEASE_DATE "20140507" #define MAIL_RELEASE_DATE "20140508"
#define MAIL_VERSION_NUMBER "2.12" #define MAIL_VERSION_NUMBER "2.12"
#ifdef SNAPSHOT #ifdef SNAPSHOT

View File

@ -322,7 +322,7 @@ typedef struct SMTP_SESSION {
time_t expire_time; /* session reuse expiration time */ time_t expire_time; /* session reuse expiration time */
int reuse_count; /* # of times reused (for logging) */ int reuse_count; /* # of times reused (for logging) */
int dead; /* No further I/O allowed */ int forbidden; /* No further I/O allowed */
#ifdef USE_SASL_AUTH #ifdef USE_SASL_AUTH
char *sasl_mechanism_list; /* server mechanism list */ char *sasl_mechanism_list; /* server mechanism list */
@ -416,7 +416,7 @@ extern HBC_CALL_BACKS smtp_hbc_callbacks[];
* connections and other reasons why connections cannot be cached. * connections and other reasons why connections cannot be cached.
*/ */
#define THIS_SESSION_IS_CACHED \ #define THIS_SESSION_IS_CACHED \
(!THIS_SESSION_IS_DEAD && session->expire_time > 0) (!THIS_SESSION_IS_FORBIDDEN && session->expire_time > 0)
#define THIS_SESSION_IS_EXPIRED \ #define THIS_SESSION_IS_EXPIRED \
(THIS_SESSION_IS_CACHED \ (THIS_SESSION_IS_CACHED \
@ -424,27 +424,27 @@ extern HBC_CALL_BACKS smtp_hbc_callbacks[];
|| (var_smtp_reuse_count > 0 \ || (var_smtp_reuse_count > 0 \
&& session->reuse_count >= var_smtp_reuse_count))) && session->reuse_count >= var_smtp_reuse_count)))
#define THIS_SESSION_IS_BAD \ #define THIS_SESSION_IS_THROTTLED \
(!THIS_SESSION_IS_DEAD && session->expire_time < 0) (!THIS_SESSION_IS_FORBIDDEN && session->expire_time < 0)
#define THIS_SESSION_IS_DEAD \ #define THIS_SESSION_IS_FORBIDDEN \
(session->dead != 0) (session->forbidden != 0)
/* Bring the bad news. */ /* Bring the bad news. */
#define DONT_CACHE_THIS_SESSION \ #define DONT_CACHE_THIS_SESSION \
(session->expire_time = 0) (session->expire_time = 0)
#define DONT_CACHE_BAD_SESSION \ #define DONT_CACHE_THROTTLED_SESSION \
(session->expire_time = -1) (session->expire_time = -1)
#define DONT_USE_DEAD_SESSION \ #define DONT_USE_FORBIDDEN_SESSION \
(session->dead = 1) (session->forbidden = 1)
/* Initialization. */ /* Initialization. */
#define USE_NEWBORN_SESSION \ #define USE_NEWBORN_SESSION \
(session->dead = 0) (session->forbidden = 0)
#define CACHE_THIS_SESSION_UNTIL(when) \ #define CACHE_THIS_SESSION_UNTIL(when) \
(session->expire_time = (when)) (session->expire_time = (when))

View File

@ -368,7 +368,7 @@ static void smtp_cleanup_session(SMTP_STATE *state)
{ {
DELIVER_REQUEST *request = state->request; DELIVER_REQUEST *request = state->request;
SMTP_SESSION *session = state->session; SMTP_SESSION *session = state->session;
int bad_session; int throttled;
/* /*
* Inform the postmaster of trouble. * Inform the postmaster of trouble.
@ -397,7 +397,7 @@ static void smtp_cleanup_session(SMTP_STATE *state)
* physical bindings; caching a session under its own hostname provides * physical bindings; caching a session under its own hostname provides
* no performance benefit, given the way smtp_connect() works. * no performance benefit, given the way smtp_connect() works.
*/ */
bad_session = THIS_SESSION_IS_BAD; /* smtp_quit() may fail */ throttled = THIS_SESSION_IS_THROTTLED; /* smtp_quit() may fail */
if (THIS_SESSION_IS_EXPIRED) if (THIS_SESSION_IS_EXPIRED)
smtp_quit(state); /* also disables caching */ smtp_quit(state); /* also disables caching */
if (THIS_SESSION_IS_CACHED if (THIS_SESSION_IS_CACHED
@ -417,7 +417,7 @@ static void smtp_cleanup_session(SMTP_STATE *state)
* next-hop destination. Otherwise we could end up skipping over the * next-hop destination. Otherwise we could end up skipping over the
* available and more preferred servers. * available and more preferred servers.
*/ */
if (HAVE_NEXTHOP_STATE(state) && !bad_session) if (HAVE_NEXTHOP_STATE(state) && !throttled)
FREE_NEXTHOP_STATE(state); FREE_NEXTHOP_STATE(state);
/* /*
@ -539,7 +539,7 @@ static void smtp_connect_local(SMTP_STATE *state, const char *path)
*/ */
if ((session->features & SMTP_FEATURE_FROM_CACHE) == 0 if ((session->features & SMTP_FEATURE_FROM_CACHE) == 0
&& smtp_helo(state) != 0) { && smtp_helo(state) != 0) {
if (!THIS_SESSION_IS_DEAD if (!THIS_SESSION_IS_FORBIDDEN
&& vstream_ferror(session->stream) == 0 && vstream_ferror(session->stream) == 0
&& vstream_feof(session->stream) == 0) && vstream_feof(session->stream) == 0)
smtp_quit(state); smtp_quit(state);
@ -889,11 +889,13 @@ static void smtp_connect_inet(SMTP_STATE *state, const char *nexthop,
* *
* Opportunistic (a.k.a. on-demand) session caching on request by the * Opportunistic (a.k.a. on-demand) session caching on request by the
* queue manager. This is turned temporarily when a destination has a * queue manager. This is turned temporarily when a destination has a
* high volume of mail in the active queue. * high volume of mail in the active queue. When the surge reaches
* its end, the queue manager requests that connections be retrieved
* but not stored.
*/ */
if (addr_list && (state->misc_flags & SMTP_MISC_FLAG_FIRST_NEXTHOP)) { if (addr_list && (state->misc_flags & SMTP_MISC_FLAG_FIRST_NEXTHOP)) {
smtp_cache_policy(state, domain); smtp_cache_policy(state, domain);
if (state->misc_flags & SMTP_MISC_FLAG_CONN_STORE) if (state->misc_flags & SMTP_MISC_FLAG_CONN_CACHE_MASK)
SET_NEXTHOP_STATE(state, dest); SET_NEXTHOP_STATE(state, dest);
} }
@ -1004,7 +1006,7 @@ static void smtp_connect_inet(SMTP_STATE *state, const char *nexthop,
* When a TLS handshake fails, the stream is marked * When a TLS handshake fails, the stream is marked
* "dead" to avoid further I/O over a broken channel. * "dead" to avoid further I/O over a broken channel.
*/ */
if (!THIS_SESSION_IS_DEAD if (!THIS_SESSION_IS_FORBIDDEN
&& vstream_ferror(session->stream) == 0 && vstream_ferror(session->stream) == 0
&& vstream_feof(session->stream) == 0) && vstream_feof(session->stream) == 0)
smtp_quit(state); smtp_quit(state);

View File

@ -826,7 +826,7 @@ static int smtp_start_tls(SMTP_STATE *state)
* We must avoid further I/O, the peer is in an undefined state. * We must avoid further I/O, the peer is in an undefined state.
*/ */
(void) vstream_fpurge(session->stream, VSTREAM_PURGE_BOTH); (void) vstream_fpurge(session->stream, VSTREAM_PURGE_BOTH);
DONT_USE_DEAD_SESSION; DONT_USE_FORBIDDEN_SESSION;
/* /*
* If TLS is optional, try delivery to the same server over a * If TLS is optional, try delivery to the same server over a
@ -2002,7 +2002,7 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state,
"unreadable mail queue entry"); "unreadable mail queue entry");
/* Bailing out, abort stream with prejudice */ /* Bailing out, abort stream with prejudice */
(void) vstream_fpurge(session->stream, VSTREAM_PURGE_BOTH); (void) vstream_fpurge(session->stream, VSTREAM_PURGE_BOTH);
DONT_USE_DEAD_SESSION; DONT_USE_FORBIDDEN_SESSION;
/* If bounce_append() succeeded, status is still 0 */ /* If bounce_append() succeeded, status is still 0 */
if (state->status == 0) if (state->status == 0)
(void) mark_corrupt(state->src); (void) mark_corrupt(state->src);

View File

@ -265,7 +265,7 @@ static int smtp_bulk_fail(SMTP_STATE *state, int throttle_queue)
* Don't cache this session. We can't talk to this server. * Don't cache this session. We can't talk to this server.
*/ */
if (throttle_queue && session) if (throttle_queue && session)
DONT_CACHE_BAD_SESSION; DONT_CACHE_THROTTLED_SESSION;
return (-1); return (-1);
} }