X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/9f1a75f126ae217a3a3568b106c9133b3c5c413a..699f306744e5f0e1ad860a460454efe85fe63c74:/src/src/expand.c diff --git a/src/src/expand.c b/src/src/expand.c index ffbdc14e5..ff0b4d600 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -1860,7 +1860,7 @@ else if (Ustrncmp(name, "r_", 2) == 0) return node ? node->data.ptr : strict_acl_vars ? NULL : US""; } -/* Handle $auth variables. */ +/* Handle $auth, $regex variables. */ if (Ustrncmp(name, "auth", 4) == 0) { @@ -1869,6 +1869,7 @@ if (Ustrncmp(name, "auth", 4) == 0) if (!*endptr && n != 0 && n <= AUTH_VARS) return auth_vars[n-1] ? auth_vars[n-1] : US""; } +#ifdef WITH_CONTENT_SCAN else if (Ustrncmp(name, "regex", 5) == 0) { uschar *endptr; @@ -1876,6 +1877,7 @@ else if (Ustrncmp(name, "regex", 5) == 0) if (!*endptr && n != 0 && n <= REGEX_VARS) return regex_vars[n-1] ? regex_vars[n-1] : US""; } +#endif /* For all other variables, search the table */ @@ -6542,6 +6544,9 @@ while (*s) if (item_type == EITEM_FILTER) { BOOL condresult; + /* the condition could modify $value, as a side-effect */ + uschar * save_value = lookup_value; + if (!eval_condition(expr, &resetok, &condresult)) { iterate_item = save_iterate_item; @@ -6550,6 +6555,7 @@ while (*s) expand_string_message, name); goto EXPAND_FAILED; } + lookup_value = save_value; DEBUG(D_expand) debug_printf_indent("%s: condition is %s\n", name, condresult? "true":"false"); if (condresult) @@ -6558,14 +6564,12 @@ while (*s) continue; /* FALSE => skip this item */ } - /* EITEM_MAP and EITEM_REDUCE */ - - else + else /* EITEM_MAP and EITEM_REDUCE */ { + /* the expansion could modify $value, as a side-effect */ uschar * t = expand_string_internal(expr, ESI_BRACE_ENDS | ESI_HONOR_DOLLAR | flags, NULL, &resetok, NULL); - temp = t; - if (!temp) + if (!(temp = t)) { iterate_item = save_iterate_item; expand_string_message = string_sprintf("%s inside \"%s\" item", @@ -8715,9 +8719,11 @@ assert_variable_notin() treats as const, so deconst is safe. */ for (int i = 0; i < AUTH_VARS; i++) if (auth_vars[i]) assert_variable_notin(US"auth", US auth_vars[i], &e); +#ifdef WITH_CONTENT_SCAN /* check regex variables. assert_variable_notin() treats as const. */ for (int i = 0; i < REGEX_VARS; i++) if (regex_vars[i]) assert_variable_notin(US"regex", US regex_vars[i], &e); +#endif /* check known-name variables */ for (var_entry * v = var_table; v < var_table + var_table_size; v++)