[exim-cvs] Remove ACL-config skip so that ${acl } expansions…

Góra strony
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
Dla: exim-cvs
Temat: [exim-cvs] Remove ACL-config skip so that ${acl } expansions work from queue-runs.
Gitweb: http://git.exim.org/exim.git/commitdiff/cb46fd2b91514ce49ad0e13788127d756ed35145
Commit:     cb46fd2b91514ce49ad0e13788127d756ed35145
Parent:     ada4d84efd985590d24a988912b8b38cd91c6e59
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Jul 21 12:50:53 2013 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sun Jul 21 16:57:18 2013 +0100


    Remove ACL-config skip so that ${acl } expansions work from queue-runs.


    Previously we skipped parsing the ACL section when not needed.  Now it is
    potentially needed in all cases.  The skip was ~5% faster than a full parse
    so probably not a large part of the exim process startup.


    Fix up testsuite output files affected by the removal and add a regression test.
---
 src/src/exim.c      |   11 +++++------
 src/src/functions.h |    2 +-
 src/src/readconf.c  |   18 +++---------------
 test/confs/0218     |   10 ++++++++++
 test/stderr/0021    |    1 -
 test/stderr/0218    |   25 +++++++++++++++++++++++++
 test/stderr/2600    |    1 -
 test/stderr/5400    |    1 -
 8 files changed, 44 insertions(+), 25 deletions(-)


diff --git a/src/src/exim.c b/src/src/exim.c
index a27e391..8ab0456 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -4270,13 +4270,12 @@ if (msg_action_arg > 0 && msg_action != MSG_DELIVER && msg_action != MSG_LOAD)
exit(yield);
}

-/* All the modes below here require the remaining configuration sections
-to be read, except that we can skip over the ACL setting when delivering
-specific messages, or doing a queue run. (For various testing cases we could
-skip too, but as they are rare, it doesn't really matter.) The argument is TRUE
-for skipping. */
+/* We used to set up here to skip reading the ACL section, on
+ (msg_action_arg > 0 || (queue_interval == 0 && !daemon_listen)
+Now, since the intro of the ${acl } expansion, ACL definitions may be
+needed in transports so we lost the optimisation. */

-readconf_rest(msg_action_arg > 0 || (queue_interval == 0 && !daemon_listen));
+readconf_rest();

 /* The configuration data will have been read into POOL_PERM because we won't
 ever want to reset back past it. Change the current pool to POOL_MAIN. In fact,
diff --git a/src/src/functions.h b/src/src/functions.h
index e76cd14..d381b56 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -255,7 +255,7 @@ extern void    readconf_print(uschar *, uschar *, BOOL);
 extern uschar *readconf_printtime(int);
 extern uschar *readconf_readname(uschar *, int, uschar *);
 extern int     readconf_readtime(uschar *, int, BOOL);
-extern void    readconf_rest(BOOL);
+extern void    readconf_rest();
 extern uschar *readconf_retry_error(uschar *, uschar *, int *, int *);
 extern void    read_message_body(BOOL);
 extern void    receive_bomb_out(uschar *, uschar *);
diff --git a/src/src/readconf.c b/src/src/readconf.c
index 7f42bb7..207b369 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -3972,27 +3972,15 @@ return acl_line;


/* Now the main function:

-Arguments:
-  skip        TRUE when this Exim process is doing something that will
-              not need the ACL data
-
+Arguments:    none
 Returns:      nothing
 */


static void
-readconf_acl(BOOL skip)
+readconf_acl(void)
{
uschar *p;

-/* Not receiving messages, don't need to parse the ACL data */
-
-if (skip)
- {
- DEBUG(D_acl) debug_printf("skipping ACL configuration - not needed\n");
- while ((p = get_config_line()) != NULL);
- return;
- }
-
/* Read each ACL and add it into the tree. Macro (re)definitions are allowed
between ACLs. */

@@ -4126,7 +4114,7 @@ while(next_section[0] != 0)

   switch(mid)
     {
-    case 0: readconf_acl(skip_acl); break;
+    case 0: readconf_acl(); break;
     case 1: auths_init(); break;
     case 2: local_scan_init(); break;
     case 3: readconf_retries(); break;
diff --git a/test/confs/0218 b/test/confs/0218
index a585870..4458e18 100644
--- a/test/confs/0218
+++ b/test/confs/0218
@@ -19,6 +19,13 @@ queue_run_in_order
 queue_only



+# ----- ACLs ----
+
+begin acl
+
+expand_check:
+ accept message = ACL
+
# ----- Routers -----

begin routers
@@ -30,11 +37,13 @@ bounce:
data = :fail: just discard
retry_use_local_part
senders = :
+ debug_print = R: $router_name (${acl {expand_check}})

client:
driver = accept
retry_use_local_part
transport = send_to_server
+ debug_print = R: $router_name (${acl {expand_check}})


# ----- Transports -----
@@ -47,6 +56,7 @@ send_to_server:
command_timeout = 1s
hosts = 127.0.0.1
port = PORT_S
+ debug_print = T: $transport_name (${acl {expand_check}})


# ----- Retry -----
diff --git a/test/stderr/0021 b/test/stderr/0021
index 4f43e05..64c72d2 100644
--- a/test/stderr/0021
+++ b/test/stderr/0021
@@ -176,7 +176,6 @@ Exim version x.yz ....
configuration file is TESTSUITE/test-config
trusted user
admin user
-skipping ACL configuration - not needed
x in "!bad"? yes (end of list)
LOG: MAIN
=> x <x@y> R=accept T=appendfile
diff --git a/test/stderr/0218 b/test/stderr/0218
index 67ae81e..bf01762 100644
--- a/test/stderr/0218
+++ b/test/stderr/0218
@@ -6,9 +6,15 @@ LOG: queue_run MAIN
Start queue run: pid=pppp -qq
queue running combined directories
delivering 10HmaX-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
delivering 10HmaY-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
queue running combined directories
delivering 10HmaX-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
SMTP<< 220 Server ready
SMTP>> EHLO myhost.test.ex
@@ -31,6 +37,8 @@ configuration file is TESTSUITE/test-config
trusted user
admin user
delivering 10HmaY-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
SMTP>> MAIL FROM:<CALLER@???>
SMTP>> RCPT TO:<b@???>
SMTP>> DATA
@@ -56,9 +64,15 @@ LOG: queue_run MAIN
Start queue run: pid=pppp -qq
queue running combined directories
delivering 10HmaZ-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
delivering 10HmbA-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
queue running combined directories
delivering 10HmaZ-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
SMTP<< 220 Server ready
SMTP>> EHLO myhost.test.ex
@@ -83,6 +97,8 @@ LOG: MAIN
LOG: MAIN
Completed
delivering 10HmbA-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
Connecting to 127.0.0.1 [127.0.0.1]:1224 ... failed: Connection refused
LOG: MAIN
127.0.0.1 [127.0.0.1] Connection refused
@@ -97,7 +113,10 @@ admin user
LOG: queue_run MAIN
Start queue run: pid=pppp -qqf
delivering 10HmbA-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
delivering 10HmbB-0005vi-00 (queue run pid ppppp)
+R: bounce (ACL)
LOG: MAIN
** CALLER@??? F=<> R=bounce: just discard
LOG: MAIN
@@ -105,7 +124,11 @@ LOG: MAIN
LOG: MAIN
Completed
delivering 10HmbC-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
delivering 10HmbA-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
SMTP<< 220 Server ready
SMTP>> EHLO myhost.test.ex
@@ -135,6 +158,8 @@ configuration file is TESTSUITE/test-config
trusted user
admin user
delivering 10HmbC-0005vi-00 (queue run pid ppppp)
+R: client (ACL)
+T: send_to_server (ACL)
SMTP>> MAIL FROM:<CALLER@???>
SMTP>> RCPT TO:<c@???>
SMTP>> DATA
diff --git a/test/stderr/2600 b/test/stderr/2600
index 2df9844..5702602 100644
--- a/test/stderr/2600
+++ b/test/stderr/2600
@@ -319,7 +319,6 @@ changed uid/gid: forcing real = effective
configuration file is TESTSUITE/test-config
trusted user
admin user
-skipping ACL configuration - not needed
seeking password data for user "CALLER": cache not available
getpwnam() succeeded uid=CALLER_UID gid=CALLER_GID
set_process_info: pppp delivering specified messages
diff --git a/test/stderr/5400 b/test/stderr/5400
index bc3dba5..73934dd 100644
--- a/test/stderr/5400
+++ b/test/stderr/5400
@@ -125,7 +125,6 @@ Exim version x.yz ....
configuration file is TESTSUITE/test-config
trusted user
admin user
-skipping ACL configuration - not needed
>>>>>>>>>>>>>>>> Remote deliveries >>>>>>>>>>>>>>>>

--------> usery@??? <--------
smtp transport entered