From 05b70ebcdceb3d0b2eadd39b84782d22b63ed9a2 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 22 Nov 2021 18:02:34 +0000 Subject: [PATCH 1/1] Fix shutdown=no in ${readsocket}. Bug 2784 Broken-by: 1950cf85b4 --- doc/doc-txt/ChangeLog | 4 ++++ src/src/lookups/readsock.c | 2 +- test/scripts/0000-Basic/0373 | 10 +++++++--- test/stdout/0373 | 12 ++++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 4ca9323f0..1d4b3c1c5 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -811,6 +811,10 @@ JH/47 ARC: fix crash in signing, triggered when a configuration error failed to do ARC verification. The Authentication-Results: header line added by the configuration then had no ARC item. +JH/48 Bug 2784: fix shutdown=no in the ${readsocket) expansion item. Previously + an incorrect mode was used for reading the result, resulting in it being + ignored. + Exim version 4.92 ----------------- diff --git a/src/src/lookups/readsock.c b/src/src/lookups/readsock.c index 7bb3b9ab5..06058ed17 100644 --- a/src/src/lookups/readsock.c +++ b/src/src/lookups/readsock.c @@ -255,7 +255,7 @@ if (TRUE) if (!cctx->tls_ctx) #endif { - FILE * fp = fdopen(cctx->sock, lf.do_shutdown ? "rb" : "wb"); + FILE * fp = fdopen(cctx->sock, "rb"); ALARM(timeout); yield = cat_file(fp, NULL, eol); } diff --git a/test/scripts/0000-Basic/0373 b/test/scripts/0000-Basic/0373 index 37c98e0ab..cb3e00608 100644 --- a/test/scripts/0000-Basic/0373 +++ b/test/scripts/0000-Basic/0373 @@ -60,7 +60,7 @@ quit # # Tests of IPv4 sockets # -server PORT_S 17 +server PORT_S 18 QUERY-1 >LF>ANSWER-1 >*eof @@ -87,7 +87,10 @@ QUERY-9 QUERY-10 >LF>ANSWER-10 >*eof ->LF>ANSWER-11 +>LF>ANSWER-11a +>*eof +QUERY-11 +>LF>ANSWER-11b >*eof QUERY-12 >>ANSWER-12\x0d\x0aANSWER-12\x0d\x0a @@ -121,7 +124,8 @@ ipv4 cases 8 read timed out >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-8\n}{1s}}<< 9 sock error >>${readsocket{inet:127.0.0.1:PORT_S}{QUERY-9\n}{1s}{}{sock error}}<< 10 ANSWER-10\\n >>${readsocket{inet:badloop:PORT_S}{QUERY-10\n}}<< -11 ANSWER-11 >>${readsocket{inet:thisloop:PORT_S}{QUERY-11\n}{2s:shutdown=no}}<< +11 ANSWER-11a >>${readsocket{inet:thisloop:PORT_S}{QUERY-11\n}{2s:shutdown=no}}<< +11 ANSWER-11b >>${readsocket{inet:thisloop:PORT_S}{QUERY-11\n}{2s:shutdown=no}}<< eol-replacement arg 12 ANSWER-12x2 (no arg) >>${escape:${readsocket{inet:127.0.0.1:PORT_S}{QUERY-12\n}{2s}}}<< diff --git a/test/stdout/0373 b/test/stdout/0373 index 1e97d0dec..2bd1fe67a 100644 --- a/test/stdout/0373 +++ b/test/stdout/0373 @@ -28,7 +28,10 @@ > 9 sock error >>sock error<< > 10 ANSWER-10\n >>ANSWER-10 << -> 11 ANSWER-11 >><< +> 11 ANSWER-11a >>ANSWER-11a +<< +> 11 ANSWER-11b >>ANSWER-11b +<< > > eol-replacement arg > 12 ANSWER-12x2 (no arg) >>ANSWER-12\r\nANSWER-12\r\n<< @@ -150,7 +153,12 @@ QUERY-10 >*eof Listening on port 1224 ... Connection request from [ip4.ip4.ip4.ip4] ->LF>ANSWER-11 +>LF>ANSWER-11a +>*eof +Listening on port 1224 ... +Connection request from [ip4.ip4.ip4.ip4] +QUERY-11 +>LF>ANSWER-11b >*eof Listening on port 1224 ... Connection request from [127.0.0.1] -- 2.30.2