Gitweb:
http://git.exim.org/exim.git/commitdiff/82dbd376b5de9b9d91e93e91a4e058a80a43de99
Commit: 82dbd376b5de9b9d91e93e91a4e058a80a43de99
Parent: 0f06b4f296802e4e13188c740ea09419931a3020
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Sep 2 23:37:57 2014 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Tue Sep 2 23:53:28 2014 +0100
Fix ${extract expansion for use within ${if inlist etc. Bug 1524
The coding of the numeric test on the key decided that empty was numeric, and
insisted on a third substring even in syntax-check "skip" mode. This failed
when a single expansion variable was used for the key (eg. $item) and the
defaults for string2, string3 were being assumed. Skip the test in skip mode.
---
src/src/expand.c | 45 ++++++++++++++++++++++++++-------------------
1 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/src/src/expand.c b/src/src/expand.c
index 8111c42..a929e93 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -2752,6 +2752,8 @@ switch(cond_type)
uschar *save_iterate_item = iterate_item;
int (*compare)(const uschar *, const uschar *);
+ DEBUG(D_expand) debug_printf("condition: %s\n", name);
+
tempcond = FALSE;
if (cond_type == ECOND_INLISTI)
compare = strcmpic;
@@ -2839,6 +2841,8 @@ switch(cond_type)
int sep = 0;
uschar *save_iterate_item = iterate_item;
+ DEBUG(D_expand) debug_printf("condition: %s\n", name);
+
while (isspace(*s)) s++;
if (*s++ != '{') goto COND_FAILED_CURLY_START; /* }-for-text-editors */
sub[0] = expand_string_internal(s, TRUE, &s, (yield == NULL), TRUE, resetok);
@@ -5229,25 +5233,28 @@ while (*s != 0)
while (len > 0 && isspace(p[len-1])) len--;
p[len] = 0;
- if (*p == 0 && !skipping)
- {
- expand_string_message = US"first argument of \"extract\" must "
- "not be empty";
- goto EXPAND_FAILED;
- }
+ if (!skipping)
+ {
+ if (*p == 0)
+ {
+ expand_string_message = US"first argument of \"extract\" must "
+ "not be empty";
+ goto EXPAND_FAILED;
+ }
- if (*p == '-')
- {
- field_number = -1;
- p++;
- }
- while (*p != 0 && isdigit(*p)) x = x * 10 + *p++ - '0';
- if (*p == 0)
- {
- field_number *= x;
- j = 3; /* Need 3 args */
- field_number_set = TRUE;
- }
+ if (*p == '-')
+ {
+ field_number = -1;
+ p++;
+ }
+ while (*p != 0 && isdigit(*p)) x = x * 10 + *p++ - '0';
+ if (*p == 0)
+ {
+ field_number *= x;
+ j = 3; /* Need 3 args */
+ field_number_set = TRUE;
+ }
+ }
}
}
else goto EXPAND_FAILED_CURLY;