diff --git a/postfix/HISTORY b/postfix/HISTORY
index 706d83359..41b21d70f 100644
--- a/postfix/HISTORY
+++ b/postfix/HISTORY
@@ -19711,3 +19711,13 @@ Apologies for any names omitted.
reported by Sahil Tandon, predicate error found by Viktor,
redundant connection restore request eliminated by Wietse.
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.
diff --git a/postfix/README_FILES/SMTPD_POLICY_README b/postfix/README_FILES/SMTPD_POLICY_README
index 70c6bd0a6..17d816f43 100644
--- a/postfix/README_FILES/SMTPD_POLICY_README
+++ b/postfix/README_FILES/SMTPD_POLICY_README
@@ -73,6 +73,8 @@ a delegated SMTPD access policy request:
stress=
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
+ PPoossttffiixx vveerrssiioonn 22..1122 aanndd llaatteerr::
+ client_port=1234
[empty line]
Notes:
diff --git a/postfix/html/SMTPD_POLICY_README.html b/postfix/html/SMTPD_POLICY_README.html
index 5770535b4..aaccc22f5 100644
--- a/postfix/html/SMTPD_POLICY_README.html
+++ b/postfix/html/SMTPD_POLICY_README.html
@@ -104,6 +104,8 @@ etrn_domain=
stress=
Postfix version 2.9 and later:
ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40
+Postfix version 2.12 and later:
+client_port=1234
[empty line]
diff --git a/postfix/proto/SMTPD_POLICY_README.html b/postfix/proto/SMTPD_POLICY_README.html
index 8a38c0ee1..37e8cc02b 100644
--- a/postfix/proto/SMTPD_POLICY_README.html
+++ b/postfix/proto/SMTPD_POLICY_README.html
@@ -104,6 +104,8 @@ etrn_domain=
stress=
Postfix version 2.9 and later:
ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40
+Postfix version 2.12 and later:
+client_port=1234
[empty line]
diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h
index 0f5cb367e..73c31170a 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 "20140507"
+#define MAIL_RELEASE_DATE "20140508"
#define MAIL_VERSION_NUMBER "2.12"
#ifdef SNAPSHOT
diff --git a/postfix/src/smtp/smtp.h b/postfix/src/smtp/smtp.h
index e966ff6b1..70f8dbe67 100644
--- a/postfix/src/smtp/smtp.h
+++ b/postfix/src/smtp/smtp.h
@@ -322,7 +322,7 @@ typedef struct SMTP_SESSION {
time_t expire_time; /* session reuse expiration time */
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
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.
*/
#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 \
(THIS_SESSION_IS_CACHED \
@@ -424,27 +424,27 @@ extern HBC_CALL_BACKS smtp_hbc_callbacks[];
|| (var_smtp_reuse_count > 0 \
&& session->reuse_count >= var_smtp_reuse_count)))
-#define THIS_SESSION_IS_BAD \
- (!THIS_SESSION_IS_DEAD && session->expire_time < 0)
+#define THIS_SESSION_IS_THROTTLED \
+ (!THIS_SESSION_IS_FORBIDDEN && session->expire_time < 0)
-#define THIS_SESSION_IS_DEAD \
- (session->dead != 0)
+#define THIS_SESSION_IS_FORBIDDEN \
+ (session->forbidden != 0)
/* Bring the bad news. */
#define DONT_CACHE_THIS_SESSION \
(session->expire_time = 0)
-#define DONT_CACHE_BAD_SESSION \
+#define DONT_CACHE_THROTTLED_SESSION \
(session->expire_time = -1)
-#define DONT_USE_DEAD_SESSION \
- (session->dead = 1)
+#define DONT_USE_FORBIDDEN_SESSION \
+ (session->forbidden = 1)
/* Initialization. */
#define USE_NEWBORN_SESSION \
- (session->dead = 0)
+ (session->forbidden = 0)
#define CACHE_THIS_SESSION_UNTIL(when) \
(session->expire_time = (when))
diff --git a/postfix/src/smtp/smtp_connect.c b/postfix/src/smtp/smtp_connect.c
index 3ae3af90b..19c374fa6 100644
--- a/postfix/src/smtp/smtp_connect.c
+++ b/postfix/src/smtp/smtp_connect.c
@@ -368,7 +368,7 @@ static void smtp_cleanup_session(SMTP_STATE *state)
{
DELIVER_REQUEST *request = state->request;
SMTP_SESSION *session = state->session;
- int bad_session;
+ int throttled;
/*
* 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
* 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)
smtp_quit(state); /* also disables caching */
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
* available and more preferred servers.
*/
- if (HAVE_NEXTHOP_STATE(state) && !bad_session)
+ if (HAVE_NEXTHOP_STATE(state) && !throttled)
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
&& smtp_helo(state) != 0) {
- if (!THIS_SESSION_IS_DEAD
+ if (!THIS_SESSION_IS_FORBIDDEN
&& vstream_ferror(session->stream) == 0
&& vstream_feof(session->stream) == 0)
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
* 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)) {
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);
}
@@ -1004,7 +1006,7 @@ static void smtp_connect_inet(SMTP_STATE *state, const char *nexthop,
* When a TLS handshake fails, the stream is marked
* "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_feof(session->stream) == 0)
smtp_quit(state);
diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c
index fbae51f2d..1661eee83 100644
--- a/postfix/src/smtp/smtp_proto.c
+++ b/postfix/src/smtp/smtp_proto.c
@@ -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.
*/
(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
@@ -2002,7 +2002,7 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state,
"unreadable mail queue entry");
/* Bailing out, abort stream with prejudice */
(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 (state->status == 0)
(void) mark_corrupt(state->src);
diff --git a/postfix/src/smtp/smtp_trouble.c b/postfix/src/smtp/smtp_trouble.c
index b3b4aacc5..2262e6cf0 100644
--- a/postfix/src/smtp/smtp_trouble.c
+++ b/postfix/src/smtp/smtp_trouble.c
@@ -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.
*/
if (throttle_queue && session)
- DONT_CACHE_BAD_SESSION;
+ DONT_CACHE_THROTTLED_SESSION;
return (-1);
}