X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=blobdiff_plain;f=src%2Fsrc%2Froute.c;h=6ba1d9f10d02d83a88e06914ba5573bd7ca6a5ba;hp=32dbd60abd04ea207d7f988f56f61dd21bf207d5;hb=a3ef73105c3539e9d29c27095573f9d437752f7f;hpb=b5a70bdfa38bcc3e1143f8fe6f63e7613f03e690 diff --git a/src/src/route.c b/src/src/route.c index 32dbd60ab..6ba1d9f10 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2009 */ +/* Copyright (c) University of Cambridge 1995 - 2014 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions concerned with routing, and the list of generic router options. */ @@ -58,6 +58,10 @@ optionlist optionlist_routers[] = { (void *)offsetof(router_instance, domains) }, { "driver", opt_stringptr|opt_public, (void *)offsetof(router_instance, driver_name) }, + #ifdef EXPERIMENTAL_DSN + { "dsn_lasthop", opt_bool|opt_public, + (void *)offsetof(router_instance, dsn_lasthop) }, + #endif { "errors_to", opt_stringptr|opt_public, (void *)(offsetof(router_instance, errors_to)) }, { "expn", opt_bool|opt_public, @@ -270,6 +274,15 @@ for (r = routers; r != NULL; r = r->next) if (r->pass_router_name != NULL) set_router(r, r->pass_router_name, &(r->pass_router), TRUE); + + #ifdef EXPERIMENTAL_DSN + DEBUG(D_route) { + if (r->dsn_lasthop == FALSE) + debug_printf("DSN: %s propagating DSN\n", r->name); + else + debug_printf("DSN: %s lasthop set\n", r->name); + } + #endif } } @@ -1412,6 +1425,10 @@ new->p.errors_address = parent->p.errors_address; copyflag(new, addr, af_propagate); new->p.address_data = addr->p.address_data; +#ifdef EXPERIMENTAL_DSN +new->dsn_flags = addr->dsn_flags; +new->dsn_orcpt = addr->dsn_orcpt; +#endif /* As it has turned out, we haven't set headers_add or headers_remove for the @@ -1633,6 +1650,7 @@ for (r = (addr->start_router == NULL)? routers : addr->start_router; /* Set the expansion variables now that we have the affixes and the case of the local part sorted. */ + router_name = r->name; deliver_set_expansions(addr); /* For convenience, the pre-router checks are in a separate function, which @@ -1640,6 +1658,7 @@ for (r = (addr->start_router == NULL)? routers : addr->start_router; if ((rc = check_router_conditions(r, addr, verify, &pw, &error)) != OK) { + router_name = NULL; if (rc == SKIP) continue; addr->message = error; yield = rc; @@ -1678,6 +1697,7 @@ for (r = (addr->start_router == NULL)? routers : addr->start_router; { DEBUG(D_route) debug_printf("\"more\"=false: skipping remaining routers\n"); + router_name = NULL; r = NULL; break; } @@ -1716,11 +1736,24 @@ for (r = (addr->start_router == NULL)? routers : addr->start_router; /* Run the router, and handle the consequences. */ +#ifdef EXPERIMENTAL_DSN +/* ... but let us check on DSN before. If this should be the last hop for DSN + set flag +*/ + if ((r->dsn_lasthop == TRUE) && ((addr->dsn_flags & rf_dsnlasthop) == 0)) + { + addr->dsn_flags |= rf_dsnlasthop; + HDEBUG(D_route) debug_printf("DSN: last hop for %s\n", addr->address); + } +#endif + HDEBUG(D_route) debug_printf("calling %s router\n", r->name); yield = (r->info->code)(r, addr, pw, verify, paddr_local, paddr_remote, addr_new, addr_succeed); + router_name = NULL; + if (yield == FAIL) { HDEBUG(D_route) debug_printf("%s router forced address failure\n", r->name); @@ -1936,6 +1969,7 @@ DEBUG(D_route) if (h->mx >= 0) debug_printf(" MX=%d", h->mx); else if (h->mx != MX_NONE) debug_printf(" rgroup=%d", h->mx); if (h->port != PORT_NONE) debug_printf(" port=%d", h->port); + /* if (h->dnssec != DS_UNK) debug_printf(" dnssec=%s", h->dnssec==DS_YES ? "yes" : "no"); */ debug_printf("\n"); } } @@ -1956,6 +1990,9 @@ if (yield == DEFER) { ( Ustrstr(addr->message, "mysql") != NULL || Ustrstr(addr->message, "pgsql") != NULL || +#ifdef EXPERIMENTAL_REDIS + Ustrstr(addr->message, "redis") != NULL || +#endif Ustrstr(addr->message, "sqlite") != NULL || Ustrstr(addr->message, "ldap:") != NULL || Ustrstr(addr->message, "ldapdn:") != NULL || @@ -1967,6 +2004,7 @@ if (yield == DEFER) { } deliver_set_expansions(NULL); +router_name = NULL; disable_logging = FALSE; return yield; }