* 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. */
int manualroute_router_options_count =
sizeof(manualroute_router_options)/sizeof(optionlist);
+
+#ifdef MACRO_PREDEF
+
+/* Dummy entries */
+manualroute_router_options_block manualroute_router_option_defaults = {0};
+void manualroute_router_init(router_instance *rblock) {}
+int manualroute_router_entry(router_instance *rblock, address_item *addr,
+ struct passwd *pw, int verify, address_item **addr_local,
+ address_item **addr_remote, address_item **addr_new,
+ address_item **addr_succeed) {return 0;}
+
+#else /*!MACRO_PREDEF*/
+
+
+
/* Default private options block for the manualroute router. */
manualroute_router_options_block manualroute_router_option_defaults = {
/* Set default lookup type and scan the options */
-lookup_type = lk_default;
+lookup_type = LK_DEFAULT;
while (*options != 0)
{
if (Ustrncmp(s, "randomize", n) == 0) randomize = TRUE;
else if (Ustrncmp(s, "no_randomize", n) == 0) randomize = FALSE;
- else if (Ustrncmp(s, "byname", n) == 0) lookup_type = lk_byname;
- else if (Ustrncmp(s, "bydns", n) == 0) lookup_type = lk_bydns;
+ else if (Ustrncmp(s, "byname", n) == 0)
+ lookup_type = lookup_type & ~(LK_DEFAULT | LK_BYDNS) | LK_BYNAME;
+ else if (Ustrncmp(s, "bydns", n) == 0)
+ lookup_type = lookup_type & ~(LK_DEFAULT | LK_BYNAME) & LK_BYDNS;
+ else if (Ustrncmp(s, "ipv4_prefer", n) == 0) lookup_type |= LK_IPV4_PREFER;
+ else if (Ustrncmp(s, "ipv4_only", n) == 0) lookup_type |= LK_IPV4_ONLY;
else
{
transport_instance *t;
- for (t = transports; t != NULL; t = t->next)
- if (Ustrcmp(t->name, s) == 0)
+ for (t = transports; t; t = t->next)
+ if (Ustrncmp(t->name, s, n) == 0)
{
transport = t;
individual_transport_set = TRUE;
break;
}
- if (t == NULL)
+ if (!t)
{
s = string_sprintf("unknown routing option or transport name \"%s\"", s);
log_write(0, LOG_MAIN, "Error in %s router: %s", rblock->name, s);
/* Set up the errors address, if any. */
-rc = rf_get_errors_address(addr, rblock, verify, &(addr->p.errors_address));
+rc = rf_get_errors_address(addr, rblock, verify, &addr->prop.errors_address);
if (rc != OK) return rc;
/* Set up the additional and removeable headers for this address. */
-rc = rf_get_munge_headers(addr, rblock, &(addr->p.extra_headers),
- &(addr->p.remove_headers));
+rc = rf_get_munge_headers(addr, rblock, &addr->prop.extra_headers,
+ &addr->prop.remove_headers);
if (rc != OK) return rc;
/* If an individual transport is not set, get the transport for this router, if
/* Deal with the case of a local transport. The host list is passed over as a
single text string that ends up in $host. */
-if (transport != NULL && transport->info->local)
+if (transport && transport->info->local)
{
if (hostlist[0] != 0)
{
{
if (verify != v_none) goto ROUTED;
addr->message = string_sprintf("error in %s router: no host(s) specified "
- "for domain %s", rblock->name, domain);
+ "for domain %s", rblock->name, addr->domain);
log_write(0, LOG_MAIN, "%s", addr->message);
return DEFER;
}
be ignored, in which case we will end up with an empty host list. What happens
is controlled by host_all_ignored. */
-if (addr->host_list == NULL)
+if (!addr->host_list)
{
int i;
DEBUG(D_route) debug_printf("host_find_failed ignored every host\n");
return OK;
}
+#endif /*!MACRO_PREDEF*/
/* End of routers/manualroute.c */