X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/55414b25bee9f0195ccd1e47f3d3b5cba766e099..0bd1b1ed8a1aaf9dcd5bdf30afe38f15aba344a0:/src/src/rewrite.c diff --git a/src/src/rewrite.c b/src/src/rewrite.c index 9ce278575..f2a7ff273 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 - 2009 */ +/* Copyright (c) University of Cambridge 1995 - 2015 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions concerned with rewriting headers */ @@ -205,6 +205,24 @@ for (rule = rewrite_rules; { if (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"; + log_write(0, LOG_MAIN|LOG_PANIC, "Expansion of %s failed while rewriting: " "%s", rule->replacement, expand_string_message); break; @@ -247,8 +265,7 @@ for (rule = rewrite_rules; /* We have a validly rewritten address */ - if ((log_write_selector & L_address_rewrite) != 0 || - (debug_selector & D_rewrite) != 0) + if (LOGGING(address_rewrite) || (debug_selector & D_rewrite) != 0) { int i; const uschar *where = CUS"?";