X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/8768d5483a5894400ae1f70cda1beb44ed9b087c..ea97267cea0f7e6054806504b3616f2bf9723bce:/src/src/deliver.c diff --git a/src/src/deliver.c b/src/src/deliver.c index e3165051f..9ab740288 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -851,7 +851,7 @@ if (action) if (!(s = expand_string(action)) && *expand_string_message) log_write(0, LOG_MAIN|LOG_PANIC, "failed to expand event_action %s in %s: %s\n", - event, transport_name, expand_string_message); + event, transport_name ? transport_name : US"main", expand_string_message); event_name = event_data = NULL; @@ -1095,7 +1095,7 @@ static uschar buf[sizeof("0.000s")]; if (diff->tv_sec >= 5 || !LOGGING(millisec)) return readconf_printtime((int)diff->tv_sec); -sprintf(CS buf, "%d.%03ds", (int)diff->tv_sec, (int)diff->tv_usec/1000); +sprintf(CS buf, "%u.%03us", (uint)diff->tv_sec, (uint)diff->tv_usec/1000); return buf; } @@ -6171,19 +6171,19 @@ if (process_recipients != RECIP_IGNORE) /* RECIP_DEFER is set when a system filter freezes a message. */ case RECIP_DEFER: - new->next = addr_defer; - addr_defer = new; - break; + new->next = addr_defer; + addr_defer = new; + break; /* RECIP_FAIL_FILTER is set when a system filter has obeyed a "fail" command. */ case RECIP_FAIL_FILTER: - new->message = - filter_message ? filter_message : US"delivery cancelled"; - setflag(new, af_pass_message); - goto RECIP_QUEUE_FAILED; /* below */ + new->message = + filter_message ? filter_message : US"delivery cancelled"; + setflag(new, af_pass_message); + goto RECIP_QUEUE_FAILED; /* below */ /* RECIP_FAIL_TIMEOUT is set when a message is frozen, but is older @@ -6193,15 +6193,15 @@ if (process_recipients != RECIP_IGNORE) been logged. */ case RECIP_FAIL_TIMEOUT: - new->message = US"delivery cancelled; message timed out"; - goto RECIP_QUEUE_FAILED; /* below */ + new->message = US"delivery cancelled; message timed out"; + goto RECIP_QUEUE_FAILED; /* below */ /* RECIP_FAIL is set when -Mg has been used. */ case RECIP_FAIL: - new->message = US"delivery cancelled by administrator"; - /* Fall through */ + new->message = US"delivery cancelled by administrator"; + /* Fall through */ /* Common code for the failure cases above. If this is not a bounce message, put the address on the failed list so that it is used to @@ -6209,11 +6209,11 @@ if (process_recipients != RECIP_IGNORE) The incident has already been logged. */ RECIP_QUEUE_FAILED: - if (sender_address[0] != 0) - { - new->next = addr_failed; - addr_failed = new; - } + if (sender_address[0]) + { + new->next = addr_failed; + addr_failed = new; + } break; @@ -6222,17 +6222,17 @@ if (process_recipients != RECIP_IGNORE) is a bounce message, it will get frozen. */ case RECIP_FAIL_LOOP: - new->message = US"Too many \"Received\" headers - suspected mail loop"; - post_process_one(new, FAIL, LOG_MAIN, EXIM_DTYPE_ROUTER, 0); - break; + new->message = US"Too many \"Received\" headers - suspected mail loop"; + post_process_one(new, FAIL, LOG_MAIN, EXIM_DTYPE_ROUTER, 0); + break; /* Value should be RECIP_ACCEPT; take this as the safe default. */ default: - if (!addr_new) addr_new = new; else addr_last->next = new; - addr_last = new; - break; + if (!addr_new) addr_new = new; else addr_last->next = new; + addr_last = new; + break; } #ifndef DISABLE_EVENT @@ -6240,17 +6240,23 @@ if (process_recipients != RECIP_IGNORE) { uschar * save_local = deliver_localpart; const uschar * save_domain = deliver_domain; + uschar * addr = new->address, * errmsg = NULL; + int start, end, dom; - deliver_localpart = expand_string( - string_sprintf("${local_part:%s}", new->address)); - deliver_domain = expand_string( - string_sprintf("${domain:%s}", new->address)); + if (!parse_extract_address(addr, &errmsg, &start, &end, &dom, TRUE)) + log_write(0, LOG_MAIN|LOG_PANIC, + "failed to parse address '%.100s': %s\n", addr, errmsg); + else + { + deliver_localpart = + string_copyn(addr+start, dom ? (dom-1) - start : end - start); + deliver_domain = dom ? CUS string_copyn(addr+dom, end - dom) : CUS""; - (void) event_raise(event_action, - US"msg:fail:internal", new->message); + event_raise(event_action, US"msg:fail:internal", new->message); - deliver_localpart = save_local; - deliver_domain = save_domain; + deliver_localpart = save_local; + deliver_domain = save_domain; + } } #endif } @@ -7248,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 ) { @@ -7315,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" @@ -7354,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); @@ -7435,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; @@ -8074,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 @@ -8597,6 +8599,7 @@ else } return; /* compiler quietening; control does not reach here. */ +#ifdef SUPPORT_TLS fail: log_write(0, LOG_MAIN | (exec_type == CEE_EXEC_EXIT ? LOG_PANIC : LOG_PANIC_DIE), @@ -8606,6 +8609,7 @@ fail: Note: this must be _exit(), not exit(). */ _exit(EX_EXECFAILED); +#endif } /* vi: aw ai sw=2