X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Frewrite.c;h=2196bfa696b795c942ae66db1ea488e1c14b9482;hb=de6f74f297d040a34746bc8e1829ad4b867441c9;hp=f2a7ff273ae859e88950a6c44f9dc34bf92590b9;hpb=0bd1b1ed8a1aaf9dcd5bdf30afe38f15aba344a0;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/rewrite.c b/src/src/rewrite.c index f2a7ff273..2196bfa69 100644 --- a/src/src/rewrite.c +++ b/src/src/rewrite.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2015 */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions concerned with rewriting headers */ @@ -142,7 +142,7 @@ for (rule = rewrite_rules; uschar *key = expand_string(rule->key); if (key == NULL) { - if (!expand_string_forcedfail) + if (!f.expand_string_forcedfail) log_write(0, LOG_MAIN|LOG_PANIC, "failed to expand \"%s\" while " "checking for SMTP rewriting: %s", rule->key, expand_string_message); continue; @@ -203,25 +203,10 @@ for (rule = rewrite_rules; if (new == NULL) { - if (expand_string_forcedfail) + if (f.expand_string_forcedfail) { if ((rule->flags & rewrite_quit) != 0) break; else continue; } - /* Avoid potentially exposing a password */ - - if ( ( Ustrstr(expand_string_message, "failed to expand") != NULL - || Ustrstr(expand_string_message, "expansion of ") != NULL - ) - && ( Ustrstr(expand_string_message, "mysql") != NULL - || Ustrstr(expand_string_message, "pgsql") != NULL - || Ustrstr(expand_string_message, "redis") != NULL - || Ustrstr(expand_string_message, "sqlite") != NULL - || Ustrstr(expand_string_message, "ldap:") != NULL - || Ustrstr(expand_string_message, "ldaps:") != NULL - || Ustrstr(expand_string_message, "ldapi:") != NULL - || Ustrstr(expand_string_message, "ldapdn:") != NULL - || Ustrstr(expand_string_message, "ldapm:") != NULL - ) ) - expand_string_message = US"Temporary internal error"; + expand_string_message = expand_hide_passwords(expand_string_message); log_write(0, LOG_MAIN|LOG_PANIC, "Expansion of %s failed while rewriting: " "%s", rule->replacement, expand_string_message); @@ -324,7 +309,7 @@ for (rule = rewrite_rules; start = Ustrlen(pf1) + start + new - p1; end = start + Ustrlen(newparsed); - new = string_sprintf("%s%.*s%s", pf1, p2 - p1, p1, pf2); + new = string_sprintf("%s%.*s%s", pf1, (int)(p2 - p1), p1, pf2); } /* Now accept the whole thing */ @@ -480,7 +465,7 @@ while (isspace(*s)) s++; DEBUG(D_rewrite) debug_printf("rewrite_one_header: type=%c:\n %s", h->type, h->text); -parse_allow_group = TRUE; /* Allow group syntax */ +f.parse_allow_group = TRUE; /* Allow group syntax */ /* Loop for multiple addresses in the header. We have to go through them all in case any need qualifying, even if there's no rewriting. Pathological headers @@ -559,8 +544,8 @@ while (*s != 0) /* Can only qualify if permitted; if not, no rewrite. */ - if (changed && ((is_recipient && !allow_unqualified_recipient) || - (!is_recipient && !allow_unqualified_sender))) + if (changed && ((is_recipient && !f.allow_unqualified_recipient) || + (!is_recipient && !f.allow_unqualified_sender))) { store_reset(loop_reset_point); continue; @@ -688,8 +673,8 @@ while (*s != 0) } } -parse_allow_group = FALSE; /* Reset group flags */ -parse_found_group = FALSE; +f.parse_allow_group = FALSE; /* Reset group flags */ +f.parse_found_group = FALSE; /* If a rewrite happened and "replace" is true, put the new header into the chain following the old one, and mark the old one as replaced. */