X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/0a49a7a4f1090b6f1ce1d0f9d969804c9226b53e..1e1ddfac79fbcd052f199500a6493c7f79cb8462:/src/src/routers/rf_change_domain.c diff --git a/src/src/routers/rf_change_domain.c b/src/src/routers/rf_change_domain.c index df82f97cc..39c41fc9d 100644 --- a/src/src/routers/rf_change_domain.c +++ b/src/src/routers/rf_change_domain.c @@ -1,10 +1,8 @@ -/* $Cambridge: exim/src/src/routers/rf_change_domain.c,v 1.5 2009/11/16 19:50:38 nm4 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2009 */ +/* Copyright (c) University of Cambridge 1995 - 2018 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -34,13 +32,13 @@ Returns: nothing */ void -rf_change_domain(address_item *addr, uschar *domain, BOOL rewrite, +rf_change_domain(address_item *addr, const uschar *domain, BOOL rewrite, address_item **addr_new) { -address_item *parent = store_get(sizeof(address_item)); +address_item *parent = store_get(sizeof(address_item), FALSE); uschar *at = Ustrrchr(addr->address, '@'); -uschar *address = string_sprintf("%.*s@%s", at - addr->address, addr->address, - domain); +uschar *address = string_sprintf("%.*s@%s", + (int)(at - addr->address), addr->address, domain); DEBUG(D_route) debug_printf("domain changed to %s\n", domain); @@ -54,11 +52,12 @@ domain cache. Then copy over the propagating fields from the parent. Then set up the new fields. */ *addr = address_defaults; -addr->p = parent->p; +addr->prop = parent->prop; addr->address = address; addr->unique = string_copy(address); addr->parent = parent; +parent->child_count = 1; addr->next = *addr_new; *addr_new = addr; @@ -67,17 +66,16 @@ addr->next = *addr_new; if (rewrite) { - header_line *h; DEBUG(D_route|D_rewrite) debug_printf("rewriting header lines\n"); - for (h = header_list; h != NULL; h = h->next) + for (header_line * h = header_list; h != NULL; h = h->next) { header_line *newh = rewrite_header(h, parent->domain, domain, global_rewrite_rules, rewrite_existflags, TRUE); - if (newh != NULL) + if (newh) { h = newh; - header_rewritten = TRUE; + f.header_rewritten = TRUE; } } }