From b83fa5fa89071dab0637c0e58ba8e5c1b829149b Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 24 Feb 2017 15:00:40 +0000 Subject: [PATCH] Memory management: drop $acl_m_ variables explicitly as they go out-of-scope between message receptions in an SMTP connection --- src/src/daemon.c | 1 + test/log/0372 | 4 ++++ test/scripts/0000-Basic/0372 | 18 ++++++++++++++++++ test/stderr/0372 | 30 ++++++++++++++++++++++++++++++ test/stdout/0372 | 23 +++++++++++++++++++++++ 5 files changed, 76 insertions(+) diff --git a/src/src/daemon.c b/src/src/daemon.c index d4fe7759c..ea0c22262 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -573,6 +573,7 @@ if (pid == 0) #ifndef DISABLE_DKIM dkim_cur_signer = NULL; #endif + acl_var_m = NULL; store_reset(reset_point); /* If queue_only is set or if there are too many incoming connections in diff --git a/test/log/0372 b/test/log/0372 index 3830932ef..741559dff 100644 --- a/test/log/0372 +++ b/test/log/0372 @@ -6,3 +6,7 @@ 1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed 1999-03-02 09:44:33 10HmaX-0005vi-00 <= <> H=host2.name [4.3.2.1] U=CALLER P=smtp S=sss 1999-03-02 09:44:33 10HmaX-0005vi-00 Error in system filter: failed to expand " acl_c0="$acl_c0"\n acl_c1="$acl_c1"\n acl_c2="$acl_c2"\n acl_c3="$acl_c3"\n acl_c4="$acl_c4"\n acl_c5="$acl_c5"\n acl_c6="$acl_c6"\n acl_c7="$acl_c7"\n acl_c8="$acl_c8"\n acl_c9="$acl_c9"\n acl_m0="$acl_m0"\n acl_m1="$acl_m1"\n acl_m2="$acl_m2"\n acl_m3="$acl_m3"\n acl_m4="$acl_m4"\n acl_m5="$acl_m5"\n acl_m6="$acl_m6"\n acl_m7="$acl_m7"\n acl_m8="$acl_m8"\n acl_m9="$acl_m9"\n acl_m_foo="$acl_m_foo"\n acl_m_bar="$acl_m_bar"\n acl_c_foo="$acl_c_foo"\n acl_c_bar="$acl_c_bar"\n" in logwrite command: unknown variable name "acl_c1" (strict_acl_vars is set) + +******** SERVER ******** +1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 +1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> H=localhost (test) [127.0.0.1] P=smtp S=sss diff --git a/test/scripts/0000-Basic/0372 b/test/scripts/0000-Basic/0372 index 246c9bbda..b7e402263 100644 --- a/test/scripts/0000-Basic/0372 +++ b/test/scripts/0000-Basic/0372 @@ -17,4 +17,22 @@ data . quit **** +# +exim -DSERVER=server -bd -oX PORT_D +**** +client 127.0.0.1 PORT_D +??? 220 +HELO test +??? 250 +MAIL FROM:<> +??? 250 +RCPT TO: +??? 250 +DATA +??? 354 +. +??? 250 +QUIT +*** +killdaemon no_msglog_check diff --git a/test/stderr/0372 b/test/stderr/0372 index c30c476b2..6513fc2b6 100644 --- a/test/stderr/0372 +++ b/test/stderr/0372 @@ -124,3 +124,33 @@ LOG: smtp_connection MAIN SMTP connection from CALLER closed by QUIT ----- System filter ----- 1999-03-02 09:44:33 10HmaX-0005vi-00 Error in system filter: failed to expand " acl_c0="$acl_c0"\n acl_c1="$acl_c1"\n acl_c2="$acl_c2"\n acl_c3="$acl_c3"\n acl_c4="$acl_c4"\n acl_c5="$acl_c5"\n acl_c6="$acl_c6"\n acl_c7="$acl_c7"\n acl_c8="$acl_c8"\n acl_c9="$acl_c9"\n acl_m0="$acl_m0"\n acl_m1="$acl_m1"\n acl_m2="$acl_m2"\n acl_m3="$acl_m3"\n acl_m4="$acl_m4"\n acl_m5="$acl_m5"\n acl_m6="$acl_m6"\n acl_m7="$acl_m7"\n acl_m8="$acl_m8"\n acl_m9="$acl_m9"\n acl_m_foo="$acl_m_foo"\n acl_m_bar="$acl_m_bar"\n acl_c_foo="$acl_c_foo"\n acl_c_bar="$acl_c_bar"\n" in logwrite command: unknown variable name "acl_c1" (strict_acl_vars is set) +----- System filter ----- + acl_c0="value for c0 is ip: 127.0.0.1" + acl_c1="" + acl_c2="" + acl_c3="" + acl_c4="" + acl_c5="c5 has a newline +there!" + acl_c6="" + acl_c7="" + acl_c8="" + acl_c9="value for c9 is name: localhost" + acl_m0="value for m0 is local_part: x" + acl_m1="" + acl_m2="" + acl_m3="" + acl_m4="" + acl_m5="value for m5 contains newline +there!" + acl_m6="" + acl_m7="" + acl_m8="" + acl_m9="value for m9 is domain: y" + acl_m_foo="value for mfoo is local_part: x" + acl_m_bar="value for mbar is domain: y" + acl_c_foo="value for c_foo is ip: 127.0.0.1" + acl_c_bar="value for c_bar is name: localhost" +------------------------- + +******** SERVER ******** diff --git a/test/stdout/0372 b/test/stdout/0372 index d5a6b438b..381d1a6ef 100644 --- a/test/stdout/0372 +++ b/test/stdout/0372 @@ -14,3 +14,26 @@ 354 Enter message, ending with "." on a line by itself 250 OK id=10HmaX-0005vi-00 221 myhost.test.ex closing connection +Connecting to 127.0.0.1 port 1225 ... connected +??? 220 +<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +>>> HELO test +??? 250 +<<< 250 myhost.test.ex Hello localhost [127.0.0.1] +>>> MAIL FROM:<> +??? 250 +<<< 250 OK +>>> RCPT TO: +??? 250 +<<< 250 Accepted +>>> DATA +??? 354 +<<< 354 Enter message, ending with "." on a line by itself +>>> . +??? 250 +<<< 250 OK id=10HmbA-0005vi-00 +>>> QUIT +>>> *** +>>> killdaemon +>>> no_msglog_check +End of script -- 2.30.2