git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build: use pkg-config for i18n
[exim.git]
/
src
/
src
/
rewrite.c
diff --git
a/src/src/rewrite.c
b/src/src/rewrite.c
index 318cda215d5494630575cf98a393f9206c109484..dd3b4fa743a13b03664adfa06720de71f6c353f5 100644
(file)
--- a/
src/src/rewrite.c
+++ b/
src/src/rewrite.c
@@
-2,7
+2,7
@@
* Exim - an Internet mail transport agent *
*************************************************/
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) The Exim Maintainers 2021 - 202
3
*/
+/* Copyright (c) The Exim Maintainers 2021 - 202
4
*/
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
/* SPDX-License-Identifier: GPL-2.0-or-later */
@@
-104,7
+104,7
@@
rewrite_one(const uschar *s, int flag, BOOL *whole, BOOL add_header, uschar *nam
{
const uschar *yield = s;
const uschar *subject = s;
{
const uschar *yield = s;
const uschar *subject = s;
-uschar *domain = NULL;
+
const
uschar *domain = NULL;
BOOL done = FALSE;
int rule_number = 1;
int yield_start = 0, yield_end = 0;
BOOL done = FALSE;
int rule_number = 1;
int yield_start = 0, yield_end = 0;
@@
-158,7
+158,7
@@
for (rewrite_rule * rule = rewrite_rules;
else
{
else
{
- if (!domain) domain = Ustrrchr(subject, '@') + 1;
+ if (!domain) domain =
C
Ustrrchr(subject, '@') + 1;
/* Use the general function for matching an address against a list (here
just one item, so use the "impossible value" separator UCHAR_MAX+1). */
/* Use the general function for matching an address against a list (here
just one item, so use the "impossible value" separator UCHAR_MAX+1). */
@@
-182,16
+182,14
@@
for (rewrite_rule * rule = rewrite_rules;
save_domain = deliver_domain;
/* We have subject pointing to "localpart@domain" and domain pointing to
save_domain = deliver_domain;
/* We have subject pointing to "localpart@domain" and domain pointing to
- the domain.
Temporarily terminate the local part so that it can be
-
set up as
an expansion variable */
+ the domain.
Split into local part and domain so that it can be set up as
+ an expansion variable */
- domain[-1] = 0;
- deliver_localpart = US subject;
+ deliver_localpart = US string_copyn(subject, domain-subject-1);
deliver_domain = domain;
new = expand_string(rule->replacement);
deliver_domain = domain;
new = expand_string(rule->replacement);
- domain[-1] = '@';
deliver_localpart = save_localpart;
deliver_domain = save_domain;
}
deliver_localpart = save_localpart;
deliver_domain = save_domain;
}
@@
-454,7
+452,7
@@
header_line * newh = NULL;
rmark function_reset_point = store_mark();
uschar * s = Ustrchr(h->text, ':') + 1;
rmark function_reset_point = store_mark();
uschar * s = Ustrchr(h->text, ':') + 1;
-
while (isspace(*s)) s++
;
+
Uskip_whitespace(&s)
;
DEBUG(D_rewrite) /* The header text includes the trailing newline */
debug_printf_indent("rewrite_one_header: type=%c:\n %s", h->type, h->text);
DEBUG(D_rewrite) /* The header text includes the trailing newline */
debug_printf_indent("rewrite_one_header: type=%c:\n %s", h->type, h->text);
@@
-495,7
+493,7
@@
while (*s)
recipient = parse_extract_address(s, &errmess, &start, &end, &domain, FALSE);
*ss1 = terminator;
s = ss + (*ss ? 1 : 0);
recipient = parse_extract_address(s, &errmess, &start, &end, &domain, FALSE);
*ss1 = terminator;
s = ss + (*ss ? 1 : 0);
-
while (isspace(*s)) s++
;
+
Uskip_whitespace(&s)
;
/* There isn't much we can do for syntactic disasters at this stage.
Pro tem (possibly for ever) ignore them.
/* There isn't much we can do for syntactic disasters at this stage.
Pro tem (possibly for ever) ignore them.
@@
-510,8
+508,8
@@
while (*s)
address, "To: undisclosed recpients:;" being the classic case. Ignore
this one and carry on. */
address, "To: undisclosed recpients:;" being the classic case. Ignore
this one and carry on. */
- if (
(rewrite_rules || routed_old) &&
Ustrcmp(errmess, "empty address") != 0)
- log_write(0, LOG_MAIN, "rewrite: %s", errmess);
+ if (Ustrcmp(errmess, "empty address") != 0)
+ log_write(0, LOG_MAIN, "
qualify/
rewrite: %s", errmess);
loop_reset_point = store_reset(loop_reset_point);
continue;
loop_reset_point = store_reset(loop_reset_point);
continue;