summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2005-12-12 15:58:53 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2005-12-12 15:58:53 +0000
commit47ca6d6cc2fd470063e3f2c36b57ee8960410b7a (patch)
tree37bfb40fd44ce06c7eba98c677632e0dc9c09f30 /src
parent6979240a55cd50ee3e002b5924b405b81fa947ff (diff)
Go to 20 ACL variables of each type, and make the numbers changeable at
compile time.
Diffstat (limited to 'src')
-rw-r--r--src/ACKNOWLEDGMENTS5
-rw-r--r--src/README.UPDATING12
-rw-r--r--src/exim_monitor/em_globals.c4
-rw-r--r--src/src/acl.c38
-rw-r--r--src/src/config.h.defaults5
-rw-r--r--src/src/expand.c51
-rw-r--r--src/src/globals.c4
-rw-r--r--src/src/globals.h4
-rw-r--r--src/src/macros.h7
-rw-r--r--src/src/smtp_in.c8
-rw-r--r--src/src/spool_in.c44
-rw-r--r--src/src/spool_out.c13
12 files changed, 134 insertions, 61 deletions
diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS
index e4b9ee1b7..54b7da044 100644
--- a/src/ACKNOWLEDGMENTS
+++ b/src/ACKNOWLEDGMENTS
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.38 2005/11/15 10:08:25 ph10 Exp $
+$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.39 2005/12/12 15:58:53 ph10 Exp $
EXIM ACKNOWLEDGEMENTS
@@ -20,7 +20,7 @@ relatively small patches.
Philip Hazel
Lists created: 20 November 2002
-Last updated: 15 November 2005
+Last updated: 12 December 2005
THE OLD LIST
@@ -210,6 +210,7 @@ Alexander Sabourenkov Patch to add saslauthd daemon support
Patch for MySQL non-data queries
David Saez Suggested patch for $sender_hostname lookup if needed
Support for the clamd virus scanner
+ Suggested patch for increased number of ACL variables
Jonathan Sambrook Suggested patch for expanding uid and gid lists
Peter Savitch Diagnosis of FPE bug when statvfs() fails on spool
Harald Schueler Patch for dn_expand() failure on truncated data
diff --git a/src/README.UPDATING b/src/README.UPDATING
index fb599d384..cfcc08375 100644
--- a/src/README.UPDATING
+++ b/src/README.UPDATING
@@ -1,4 +1,4 @@
-$Cambridge: exim/src/README.UPDATING,v 1.9 2005/10/03 13:25:32 ph10 Exp $
+$Cambridge: exim/src/README.UPDATING,v 1.10 2005/12/12 15:58:53 ph10 Exp $
This document contains detailed information about incompatibilities that might
be encountered when upgrading from one release of Exim to another. The
@@ -28,6 +28,16 @@ The rest of this document contains information about changes in 4.xx releases
that might affect a running system.
+Exim version 4.61
+-----------------
+
+The default number of ACL variables of each type has been increased to 20, and
+it's possible to compile Exim with more. You can safely upgrade to this release
+if you already have messages on the queue with saved ACL variable values.
+However, if you downgrade from this release with messages on the queue, any
+saved ACL values they may have will be lost.
+
+
Exim version 4.54
-----------------
diff --git a/src/exim_monitor/em_globals.c b/src/exim_monitor/em_globals.c
index 761e47595..209c44d94 100644
--- a/src/exim_monitor/em_globals.c
+++ b/src/exim_monitor/em_globals.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/exim_monitor/em_globals.c,v 1.7 2005/05/23 15:28:38 fanf2 Exp $ */
+/* $Cambridge: exim/src/exim_monitor/em_globals.c,v 1.8 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim Monitor *
@@ -118,7 +118,7 @@ that fires up the monitor fishes the value out by using -bP anyway. */
#endif
-uschar *acl_var[ACL_C_MAX+ACL_M_MAX];
+uschar *acl_var[ACL_CVARS + ACL_MVARS];
uschar *active_hostname = NULL;
BOOL allow_unqualified_recipient = FALSE;
diff --git a/src/src/acl.c b/src/src/acl.c
index fb84c336e..286d61568 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/acl.c,v 1.52 2005/12/06 10:25:59 ph10 Exp $ */
+/* $Cambridge: exim/src/src/acl.c,v 1.53 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -752,17 +752,33 @@ while ((s = (*func)()) != NULL)
if (c == ACLC_SET)
{
- if (Ustrncmp(s, "acl_", 4) != 0 || (s[4] != 'c' && s[4] != 'm') ||
- !isdigit(s[5]) || (!isspace(s[6]) && s[6] != '='))
+ int offset, max, n;
+ uschar *endptr;
+
+ if (Ustrncmp(s, "acl_", 4) != 0) goto BAD_ACL_VAR;
+ if (s[4] == 'c')
+ {
+ offset = 0;
+ max = ACL_CVARS;
+ }
+ else if (s[4] == 'm')
+ {
+ offset = ACL_CVARS;
+ max = ACL_MVARS;
+ }
+ else goto BAD_ACL_VAR;
+
+ n = Ustrtoul(s + 5, &endptr, 10);
+ if ((*endptr != 0 && *endptr != '=' && !isspace(*endptr)) || n >= max)
{
- *error = string_sprintf("unrecognized name after \"set\" in ACL "
- "modifier \"set %s\"", s);
+ BAD_ACL_VAR:
+ *error = string_sprintf("syntax error or unrecognized name after "
+ "\"set\" in ACL modifier \"set %s\"", s);
return NULL;
}
- cond->u.varnumber = s[5] - '0';
- if (s[4] == 'm') cond->u.varnumber += ACL_C_MAX;
- s += 6;
+ cond->u.varnumber = n + offset;
+ s = endptr;
while (isspace(*s)) s++;
}
@@ -2329,8 +2345,8 @@ for (; cb != NULL; cb = cb->next)
if (cb->type == ACLC_SET)
{
int n = cb->u.varnumber;
- int t = (n < ACL_C_MAX)? 'c' : 'm';
- if (n >= ACL_C_MAX) n -= ACL_C_MAX;
+ int t = (n < ACL_CVARS)? 'c' : 'm';
+ if (n >= ACL_CVARS) n -= ACL_CVARS;
debug_printf("acl_%c%d ", t, n);
lhswidth += 7;
}
@@ -2802,7 +2818,7 @@ for (; cb != NULL; cb = cb->next)
case ACLC_SET:
{
int old_pool = store_pool;
- if (cb->u.varnumber < ACL_C_MAX) store_pool = POOL_PERM;
+ if (cb->u.varnumber < ACL_CVARS) store_pool = POOL_PERM;
acl_var[cb->u.varnumber] = string_copy(arg);
store_pool = old_pool;
}
diff --git a/src/src/config.h.defaults b/src/src/config.h.defaults
index 4991d6591..914d8c6a2 100644
--- a/src/src/config.h.defaults
+++ b/src/src/config.h.defaults
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/config.h.defaults,v 1.7 2005/08/01 13:20:28 ph10 Exp $ */
+/* $Cambridge: exim/src/src/config.h.defaults,v 1.8 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -11,6 +11,9 @@
any data just defines the existence of the variable; it won't get included
in config.h unless some value is defined in Local/Makefile. */
+#define ACL_CVARS 20
+#define ACL_MVARS 20
+
#define ALT_CONFIG_PREFIX
#define ALT_CONFIG_ROOT_ONLY
diff --git a/src/src/expand.c b/src/src/expand.c
index 8523ace21..048b87a09 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.50 2005/12/12 12:05:08 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.51 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -298,26 +298,6 @@ enum {
/* This table must be kept in alphabetical order. */
static var_entry var_table[] = {
- { "acl_c0", vtype_stringptr, &acl_var[0] },
- { "acl_c1", vtype_stringptr, &acl_var[1] },
- { "acl_c2", vtype_stringptr, &acl_var[2] },
- { "acl_c3", vtype_stringptr, &acl_var[3] },
- { "acl_c4", vtype_stringptr, &acl_var[4] },
- { "acl_c5", vtype_stringptr, &acl_var[5] },
- { "acl_c6", vtype_stringptr, &acl_var[6] },
- { "acl_c7", vtype_stringptr, &acl_var[7] },
- { "acl_c8", vtype_stringptr, &acl_var[8] },
- { "acl_c9", vtype_stringptr, &acl_var[9] },
- { "acl_m0", vtype_stringptr, &acl_var[10] },
- { "acl_m1", vtype_stringptr, &acl_var[11] },
- { "acl_m2", vtype_stringptr, &acl_var[12] },
- { "acl_m3", vtype_stringptr, &acl_var[13] },
- { "acl_m4", vtype_stringptr, &acl_var[14] },
- { "acl_m5", vtype_stringptr, &acl_var[15] },
- { "acl_m6", vtype_stringptr, &acl_var[16] },
- { "acl_m7", vtype_stringptr, &acl_var[17] },
- { "acl_m8", vtype_stringptr, &acl_var[18] },
- { "acl_m9", vtype_stringptr, &acl_var[19] },
{ "acl_verify_message", vtype_stringptr, &acl_verify_message },
{ "address_data", vtype_stringptr, &deliver_address_data },
{ "address_file", vtype_stringptr, &address_file },
@@ -1249,6 +1229,33 @@ find_variable(uschar *name, BOOL exists_only, BOOL skipping, int *newsize)
int first = 0;
int last = var_table_size;
+/* Handle ACL variables, which are not in the table because their number may
+vary depending on a build-time setting. */
+
+if (Ustrncmp(name, "acl_", 4) == 0)
+ {
+ int offset, max, n;
+ uschar *endptr;
+
+ if (name[4] == 'm')
+ {
+ offset = ACL_CVARS;
+ max = ACL_MVARS;
+ }
+ else if (name[4] == 'c')
+ {
+ offset = 0;
+ max = ACL_CVARS;
+ }
+ else return NULL;
+
+ n = Ustrtoul(name + 5, &endptr, 10);
+ if (*endptr != 0 || n >= max) return NULL;
+ return (acl_var[offset + n] == NULL)? US"" : acl_var[offset + n];
+ }
+
+/* For all other variables, search the table */
+
while (last > first)
{
uschar *s, *domain;
@@ -1260,7 +1267,7 @@ while (last > first)
if (c < 0) { last = middle; continue; }
/* Found an existing variable. If in skipping state, the value isn't needed,
- and we want to avoid processing (such as looking up up the host name). */
+ and we want to avoid processing (such as looking up the host name). */
if (skipping) return US"";
diff --git a/src/src/globals.c b/src/src/globals.c
index 941d85a5a..787a88fdb 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.c,v 1.43 2005/12/06 10:25:59 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.c,v 1.44 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -184,7 +184,7 @@ uschar *acl_smtp_rcpt = NULL;
uschar *acl_smtp_starttls = NULL;
uschar *acl_smtp_vrfy = NULL;
BOOL acl_temp_details = FALSE;
-uschar *acl_var[ACL_C_MAX+ACL_M_MAX];
+uschar *acl_var[ACL_CVARS + ACL_MVARS];
uschar *acl_verify_message = NULL;
header_line *acl_warn_headers = NULL;
string_item *acl_warn_logged = NULL;
diff --git a/src/src/globals.h b/src/src/globals.h
index c91cc67a2..0a5463fc5 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/globals.h,v 1.31 2005/12/06 10:25:59 ph10 Exp $ */
+/* $Cambridge: exim/src/src/globals.h,v 1.32 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -126,7 +126,7 @@ extern uschar *acl_smtp_rcpt; /* ACL run for RCPT */
extern uschar *acl_smtp_starttls; /* ACL run for STARTTLS */
extern uschar *acl_smtp_vrfy; /* ACL run for VRFY */
extern BOOL acl_temp_details; /* TRUE to give details for 4xx error */
-extern uschar *acl_var[ACL_C_MAX+ACL_M_MAX]; /* User variables */
+extern uschar *acl_var[ACL_CVARS+ACL_MVARS]; /* User ACL variables */
extern uschar *acl_verify_message; /* User message for verify failure */
extern header_line *acl_warn_headers; /* Warning headers added by ACL */
extern string_item *acl_warn_logged; /* Logged lines */
diff --git a/src/src/macros.h b/src/src/macros.h
index 97aaf05c2..911a5ea74 100644
--- a/src/src/macros.h
+++ b/src/src/macros.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/macros.h,v 1.20 2005/11/14 16:09:54 ph10 Exp $ */
+/* $Cambridge: exim/src/src/macros.h,v 1.21 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -160,11 +160,6 @@ record. */
#define WAIT_NAME_MAX 50
-/* The numbers of connection and message variables for ACLs */
-
-#define ACL_C_MAX 10
-#define ACL_M_MAX 10
-
/* Fixed option values for all PCRE functions */
#define PCRE_COPT 0 /* compile */
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 01f4a09ef..5c953375c 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/smtp_in.c,v 1.26 2005/09/13 11:13:27 ph10 Exp $ */
+/* $Cambridge: exim/src/src/smtp_in.c,v 1.27 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -841,7 +841,9 @@ sender_rate = sender_rate_limit = sender_rate_period = NULL;
ratelimiters_mail = NULL; /* Updated by ratelimit ACL condition */
/* Note that ratelimiters_conn persists across resets. */
-for (i = 0; i < ACL_M_MAX; i++) acl_var[ACL_C_MAX + i] = NULL;
+/* The message variables follow the connection variables. */
+
+for (i = 0; i < ACL_MVARS; i++) acl_var[ACL_CVARS + i] = NULL;
/* The message body variables use malloc store. They may be set if this is
not the first message in an SMTP session and the previous message caused them
@@ -1162,7 +1164,7 @@ tls_advertised = FALSE;
/* Reset ACL connection variables */
-for (i = 0; i < ACL_C_MAX; i++) acl_var[i] = NULL;
+for (i = 0; i < ACL_CVARS; i++) acl_var[i] = NULL;
/* Allow for trailing 0 in the command buffer. */
diff --git a/src/src/spool_in.c b/src/src/spool_in.c
index 8e56677bd..9867e6134 100644
--- a/src/src/spool_in.c
+++ b/src/src/spool_in.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/spool_in.c,v 1.13 2005/08/09 13:31:53 ph10 Exp $ */
+/* $Cambridge: exim/src/src/spool_in.c,v 1.14 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -236,7 +236,7 @@ uschar *p;
one exception. DO NOT change the default value of dont_deliver, because it may
be forced by an external setting. */
-for (n = 0; n < ACL_C_MAX + ACL_M_MAX; n++) acl_var[n] = NULL;
+for (n = 0; n < ACL_CVARS + ACL_MVARS; n++) acl_var[n] = NULL;
authenticated_id = NULL;
authenticated_sender = NULL;
@@ -376,22 +376,54 @@ for (;;)
{
if (Ufgets(big_buffer, big_buffer_size, f) == NULL) goto SPOOL_READ_ERROR;
if (big_buffer[0] != '-') break;
-
big_buffer[Ustrlen(big_buffer) - 1] = 0;
+
+ /* For backward compatibility, we recognize "-acl", which was used before the
+ number of ACL variables changed. Its variable number is 0-9 for connection
+ variables, and 10-19 for message variables. */
+
if (Ustrncmp(big_buffer, "-acl ", 5) == 0)
{
int index, count;
if (sscanf(CS big_buffer + 5, "%d %d", &index, &count) != 2)
goto SPOOL_FORMAT_ERROR;
- /* Ignore if index too big - might be if a later release with more
- variables built this spool file. */
- if (index < ACL_C_MAX + ACL_M_MAX)
+ acl_var[index] = store_get(count + 1);
+ if (fread(acl_var[index], 1, count+1, f) < count) goto SPOOL_READ_ERROR;
+ acl_var[index][count] = 0;
+ }
+
+ /* Nowadays we use "-aclc" and "-aclm" for the different types of ACL
+ variable, because Exim may be built with different numbers of them. */
+
+ else if (Ustrncmp(big_buffer, "-aclc ", 6) == 0)
+ {
+ int index, count;
+ if (sscanf(CS big_buffer + 6, "%d %d", &index, &count) != 2)
+ goto SPOOL_FORMAT_ERROR;
+ if (index < ACL_CVARS)
{
acl_var[index] = store_get(count + 1);
if (fread(acl_var[index], 1, count+1, f) < count) goto SPOOL_READ_ERROR;
acl_var[index][count] = 0;
}
}
+
+ else if (Ustrncmp(big_buffer, "-aclm ", 6) == 0)
+ {
+ int index, count;
+ if (sscanf(CS big_buffer + 6, "%d %d", &index, &count) != 2)
+ goto SPOOL_FORMAT_ERROR;
+ if (index < ACL_MVARS)
+ {
+ index += ACL_CVARS;
+ acl_var[index] = store_get(count + 1);
+ if (fread(acl_var[index], 1, count+1, f) < count) goto SPOOL_READ_ERROR;
+ acl_var[index][count] = 0;
+ }
+ }
+
+ /* Other values */
+
else if (Ustrcmp(big_buffer, "-local") == 0) sender_local = TRUE;
else if (Ustrcmp(big_buffer, "-localerror") == 0)
local_error_message = TRUE;
diff --git a/src/src/spool_out.c b/src/src/spool_out.c
index d5f970224..04ecd908e 100644
--- a/src/src/spool_out.c
+++ b/src/src/spool_out.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/spool_out.c,v 1.8 2005/06/27 14:29:44 ph10 Exp $ */
+/* $Cambridge: exim/src/src/spool_out.c,v 1.9 2005/12/12 15:58:53 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -193,10 +193,17 @@ if (received_protocol != NULL)
/* Preserve any ACL variables that are set. Because the values may contain
newlines, we use an explicit length. */
-for (i = 0; i < ACL_C_MAX + ACL_M_MAX; i++)
+for (i = 0; i < ACL_CVARS; i++)
{
if (acl_var[i] != NULL)
- fprintf(f, "-acl %d %d\n%s\n", i, Ustrlen(acl_var[i]), acl_var[i]);
+ fprintf(f, "-aclc %d %d\n%s\n", i, Ustrlen(acl_var[i]), acl_var[i]);
+ }
+
+for (i = 0; i < ACL_MVARS; i++)
+ {
+ int j = i + ACL_CVARS;
+ if (acl_var[j] != NULL)
+ fprintf(f, "-aclm %d %d\n%s\n", i, Ustrlen(acl_var[j]), acl_var[j]);
}
/* Now any other data that needs to be remembered. */