diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2018-09-23 12:07:26 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2018-09-23 16:01:30 +0100 |
commit | ea97267cea0f7e6054806504b3616f2bf9723bce (patch) | |
tree | 1680964272769e495dc83cfbf2cde84b75043996 /src | |
parent | 70e384dde1f5b1290b807bc69c73887a7cbbe773 (diff) |
DSN: tescase for ESMTP DSN extension, RCPT options
Diffstat (limited to 'src')
-rw-r--r-- | src/src/deliver.c | 20 | ||||
-rw-r--r-- | src/src/readconf.c | 3 | ||||
-rw-r--r-- | src/src/receive.c | 2 | ||||
-rw-r--r-- | src/src/route.c | 7 | ||||
-rw-r--r-- | src/src/smtp_in.c | 18 |
5 files changed, 23 insertions, 27 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c index 1cf757d69..9ab740288 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -7254,7 +7254,6 @@ for (addr_dsntmp = addr_succeed; addr_dsntmp; addr_dsntmp = addr_dsntmp->next) if ( ( addr_dsntmp->dsn_aware != dsn_support_yes || addr_dsntmp->dsn_flags & rf_dsnlasthop ) - && addr_dsntmp->dsn_flags & rf_dsnflags && addr_dsntmp->dsn_flags & rf_notify_success ) { @@ -7321,11 +7320,9 @@ if (addr_senddsn) addr_dsntmp = addr_dsntmp->next) fprintf(f, "<%s> (relayed %s)\n\n", addr_dsntmp->address, - (addr_dsntmp->dsn_flags & rf_dsnlasthop) == 1 - ? "via non DSN router" - : addr_dsntmp->dsn_aware == dsn_support_no - ? "to non-DSN-aware mailer" - : "via non \"Remote SMTP\" router" + addr_dsntmp->dsn_flags & rf_dsnlasthop ? "via non DSN router" + : addr_dsntmp->dsn_aware == dsn_support_no ? "to non-DSN-aware mailer" + : "via non \"Remote SMTP\" router" ); fprintf(f, "--%s\n" @@ -7360,7 +7357,7 @@ if (addr_senddsn) addr_dsntmp->host_used->name); else fprintf(f, "Diagnostic-Code: X-Exim; relayed via non %s router\n\n", - (addr_dsntmp->dsn_flags & rf_dsnlasthop) == 1 ? "DSN" : "SMTP"); + addr_dsntmp->dsn_flags & rf_dsnlasthop ? "DSN" : "SMTP"); } fprintf(f, "--%s\nContent-type: text/rfc822-headers\n\n", bound); @@ -7441,9 +7438,8 @@ while (addr_failed) mark the recipient done. */ if ( addr_failed->prop.ignore_error - || ( addr_failed->dsn_flags & rf_dsnflags - && (addr_failed->dsn_flags & rf_notify_failure) != rf_notify_failure - ) ) + || addr_failed->dsn_flags & (rf_dsnflags & ~rf_notify_failure) + ) { addr = addr_failed; addr_failed = addr->next; @@ -8080,8 +8076,8 @@ else if (addr_defer != (address_item *)(+1)) if ( !f.queue_2stage && delivery_attempted - && ( ((addr_defer->dsn_flags & rf_dsnflags) == 0) - || (addr_defer->dsn_flags & rf_notify_delay) == rf_notify_delay + && ( !(addr_defer->dsn_flags & rf_dsnflags) + || addr_defer->dsn_flags & rf_notify_delay ) && delay_warning[1] > 0 && sender_address[0] != 0 diff --git a/src/src/readconf.c b/src/src/readconf.c index b4474757a..14bbf312a 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -823,7 +823,8 @@ if (*s) for (m = *s == '_' ? macros : macros_user; m; m = m->next) { int moveby; - READCONF_DEBUG fprintf(stderr, "%s: matched '%s' in '%s'\n", __FUNCTION__, m->name, ss); + READCONF_DEBUG fprintf(stderr, "%s: matched '%s' in '%.*s'\n", __FUNCTION__, + m->name, strlen(ss)-1, ss); /* Expand the buffer if necessary */ while (*newlen - m->namelen + m->replen + 1 > big_buffer_size) diff --git a/src/src/receive.c b/src/src/receive.c index f7124a61f..bc5cebaad 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -487,7 +487,7 @@ if (recipients_count >= recipients_list_max) { recipient_item *oldlist = recipients_list; int oldmax = recipients_list_max; - recipients_list_max = recipients_list_max? 2*recipients_list_max : 50; + recipients_list_max = recipients_list_max ? 2*recipients_list_max : 50; recipients_list = store_get(recipients_list_max * sizeof(recipient_item)); if (oldlist != NULL) memcpy(recipients_list, oldlist, oldmax * sizeof(recipient_item)); diff --git a/src/src/route.c b/src/src/route.c index c69bdcb4e..d419d1c58 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -1672,10 +1672,7 @@ for (r = addr->start_router ? addr->start_router : routers; r; r = nextr) pw = &pwcopy; } - /* Run the router, and handle the consequences. */ - - /* ... but let us check on DSN before. If this should be the last hop for DSN - set flag. */ + /* If this should be the last hop for DSN flag the addr. */ if (r->dsn_lasthop && !(addr->dsn_flags & rf_dsnlasthop)) { @@ -1683,6 +1680,8 @@ for (r = addr->start_router ? addr->start_router : routers; r; r = nextr) HDEBUG(D_route) debug_printf("DSN: last hop for %s\n", addr->address); } + /* Run the router, and handle the consequences. */ + HDEBUG(D_route) debug_printf("calling %s router\n", r->name); yield = (r->info->code)(r, addr, pw, verify, paddr_local, paddr_remote, diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index cb6469811..b99b5cdbc 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -3909,7 +3909,7 @@ while (done <= 0) int c; auth_instance *au; uschar *orcpt = NULL; - int flags; + int dsn_flags; gstring * g; #ifdef AUTH_TLS @@ -4962,7 +4962,7 @@ while (done <= 0) /* Set the DSN flags orcpt and dsn_flags from the session*/ orcpt = NULL; - flags = 0; + dsn_flags = 0; if (fl.esmtp) for(;;) { @@ -4987,14 +4987,14 @@ while (done <= 0) else if (fl.dsn_advertised && strcmpic(name, US"NOTIFY") == 0) { /* Check if the notify flags have been already set */ - if (flags > 0) + if (dsn_flags > 0) { done = synprot_error(L_smtp_syntax_error, 501, NULL, US"NOTIFY can be specified once only"); goto COMMAND_LOOP; } if (strcmpic(value, US"NEVER") == 0) - flags |= rf_notify_never; + dsn_flags |= rf_notify_never; else { uschar *p = value; @@ -5006,17 +5006,17 @@ while (done <= 0) if (strcmpic(p, US"SUCCESS") == 0) { DEBUG(D_receive) debug_printf("DSN: Setting notify success\n"); - flags |= rf_notify_success; + dsn_flags |= rf_notify_success; } else if (strcmpic(p, US"FAILURE") == 0) { DEBUG(D_receive) debug_printf("DSN: Setting notify failure\n"); - flags |= rf_notify_failure; + dsn_flags |= rf_notify_failure; } else if (strcmpic(p, US"DELAY") == 0) { DEBUG(D_receive) debug_printf("DSN: Setting notify delay\n"); - flags |= rf_notify_delay; + dsn_flags |= rf_notify_delay; } else { @@ -5027,7 +5027,7 @@ while (done <= 0) } p = pp; } - DEBUG(D_receive) debug_printf("DSN Flags: %x\n", flags); + DEBUG(D_receive) debug_printf("DSN Flags: %x\n", dsn_flags); } } @@ -5145,7 +5145,7 @@ while (done <= 0) /* Set the dsn flags in the recipients_list */ recipients_list[recipients_count-1].orcpt = orcpt; - recipients_list[recipients_count-1].dsn_flags = flags; + recipients_list[recipients_count-1].dsn_flags = dsn_flags; DEBUG(D_receive) debug_printf("DSN: orcpt: %s flags: %d\n", recipients_list[recipients_count-1].orcpt, |