* Exim - an Internet mail transport agent *
*************************************************/
+/* Copyright (c) The Exim Maintainers 2020 - 2022 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 */
/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "../exim.h"
+
+#ifdef ROUTER_MANUALROUTE
#include "rf_functions.h"
#include "manualroute.h"
/* One of route_list or route_data must be specified */
-if ((ob->route_list == NULL && ob->route_data == NULL) ||
- (ob->route_list != NULL && ob->route_data != NULL))
+if ( !ob->route_list && !ob->route_data
+ || ob->route_list && ob->route_data)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n "
"route_list or route_data (but not both) must be specified",
rblock->name);
parse_route_item(const uschar *s, const uschar **domain, const uschar **hostlist,
const uschar **options)
{
-while (*s != 0 && isspace(*s)) s++;
+Uskip_whitespace(&s);
if (domain)
{
if (!*s) return FALSE; /* missing data */
*domain = string_dequote(&s);
- while (*s && isspace(*s)) s++;
+ Uskip_whitespace(&s);
}
*hostlist = string_dequote(&s);
-while (*s && isspace(*s)) s++;
+Uskip_whitespace(&s);
*options = s;
return TRUE;
}
BOOL individual_transport_set = FALSE;
BOOL randomize = ob->hosts_randomize;
-addr_new = addr_new; /* Keep picky compilers happy */
-addr_succeed = addr_succeed;
-
DEBUG(D_route) debug_printf("%s router called for %s\n domain = %s\n",
rblock->name, addr->address, addr->domain);
int sep = -(';'); /* Default is semicolon */
listptr = ob->route_list;
- while ((route_item = string_nextinlist(&listptr, &sep, NULL, 0)) != NULL)
+ while ((route_item = string_nextinlist(&listptr, &sep, NULL, 0)))
{
int rc;
else
{
+ GET_OPTION("route_data");
if (!(route_item = rf_expand_data(addr, ob->route_data, &rc)))
return rc;
(void) parse_route_item(route_item, NULL, &hostlist, &options);
while (*options)
{
unsigned n;
- const uschar *s = options;
- while (*options != 0 && !isspace(*options)) options++;
+ const uschar * s = options;
+
+ while (*options && !isspace(*options)) options++;
n = options-s;
if (Ustrncmp(s, "randomize", n) == 0) randomize = TRUE;
if (*options)
{
options++;
- while (*options != 0 && isspace(*options)) options++;
+ while (*options && isspace(*options)) options++;
}
}
if (hostlist[0])
{
host_item *h;
- addr->host_list = h = store_get(sizeof(host_item), FALSE);
+ addr->host_list = h = store_get(sizeof(host_item), GET_UNTAINTED);
h->name = string_copy(hostlist);
h->address = NULL;
h->port = PORT_NONE;
defined for these hosts. It will be a remote one, as a local transport is
dealt with above. However, we don't need one if verifying only. */
-if (transport == NULL && verify == v_none)
+if (!transport && verify == v_none)
{
log_write(0, LOG_MAIN, "Error in %s router: no transport defined",
rblock->name);
return OK;
}
-#endif /*!MACRO_PREDEF*/
+#endif /*!MACRO_PREDEF*/
+#endif /*ROUTER_MANUALROUTE*/
/* End of routers/manualroute.c */