1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2009 */
6 /* See the file NOTICE for conditions of use and distribution. */
7 /* SPDX-License-Identifier: GPL-2.0-only */
11 #include "rf_functions.h"
14 /*************************************************
15 * Expand data string and handle errors *
16 *************************************************/
18 /* This little function is used by a couple of routers for expanding things. It
19 just saves repeating this code too many times. It does an expansion, and
20 chooses a suitable return code on error.
23 addr the address that's being routed
24 s the string to be expanded
25 prc pointer to where to put the return code on failure
27 Returns: the expanded string, or NULL (with prc set) on failure
31 rf_expand_data(address_item *addr, uschar *s, int *prc)
33 uschar *yield = expand_string(s);
34 if (yield != NULL) return yield;
35 if (f.expand_string_forcedfail)
37 DEBUG(D_route) debug_printf("forced failure for expansion of \"%s\"\n", s);
42 addr->message = string_sprintf("failed to expand \"%s\": %s", s,
43 expand_string_message);
49 /* End of routers/rf_expand_data.c */