summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2019-03-19 15:33:31 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2019-03-19 15:33:31 +0000
commitc09dbcfb71f4b9a42cbfd8a20e0be6bfa1b12488 (patch)
treefbfe02daeab9d4b577194acbb9b171c48236a587 /src
parent254f38d1c5ada5e4df0bccb385dc466549620c71 (diff)
OpenSSL: Fix aggregation of messages.
Broken-by: a5ffa9b475
Diffstat (limited to 'src')
-rw-r--r--src/src/tls-openssl.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c
index d37c78970..5a5e1464b 100644
--- a/src/src/tls-openssl.c
+++ b/src/src/tls-openssl.c
@@ -289,6 +289,7 @@ Server:
typedef struct {
SSL_CTX * ctx;
SSL * ssl;
+ gstring * corked;
} exim_openssl_client_tls_ctx;
static SSL_CTX *server_ctx = NULL;
@@ -2523,6 +2524,7 @@ BOOL require_ocsp = FALSE;
rc = store_pool;
store_pool = POOL_PERM;
exim_client_ctx = store_get(sizeof(exim_openssl_client_tls_ctx));
+exim_client_ctx->corked = NULL;
store_pool = rc;
#ifdef SUPPORT_DANE
@@ -2979,8 +2981,12 @@ tls_write(void * ct_ctx, const uschar *buff, size_t len, BOOL more)
{
size_t olen = len;
int outbytes, error;
-SSL * ssl = ct_ctx ? ((exim_openssl_client_tls_ctx *)ct_ctx)->ssl : server_ssl;
-static gstring * corked = NULL;
+SSL * ssl = ct_ctx
+ ? ((exim_openssl_client_tls_ctx *)ct_ctx)->ssl : server_ssl;
+static gstring * server_corked = NULL;
+gstring ** corkedp = ct_ctx
+ ? &((exim_openssl_client_tls_ctx *)ct_ctx)->corked : &server_corked;
+gstring * corked = *corkedp;
DEBUG(D_tls) debug_printf("%s(%p, %lu%s)\n", __FUNCTION__,
buff, (unsigned long)len, more ? ", more" : "");
@@ -2988,7 +2994,9 @@ DEBUG(D_tls) debug_printf("%s(%p, %lu%s)\n", __FUNCTION__,
/* Lacking a CORK or MSG_MORE facility (such as GnuTLS has) we copy data when
"more" is notified. This hack is only ok if small amounts are involved AND only
one stream does it, in one context (i.e. no store reset). Currently it is used
-for the responses to the received SMTP MAIL , RCPT, DATA sequence, only. */
+for the responses to the received SMTP MAIL , RCPT, DATA sequence, only.
+We support callouts done by the server process by using a separate client
+context for the stashed information. */
/* + if PIPE_COMMAND, banner & ehlo-resp for smmtp-on-connect. Suspect there's
a store reset there, so use POOL_PERM. */
/* + if CHUNKING, cmds EHLO,MAIL,RCPT(s),BDAT */
@@ -3007,10 +3015,13 @@ if ((more || corked))
#endif
if (more)
+ {
+ *corkedp = corked;
return len;
+ }
buff = CUS corked->s;
len = corked->ptr;
- corked = NULL;
+ *corkedp = NULL;
}
for (int left = len; left > 0;)