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
)
{
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"
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);
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;
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
{
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)
{
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));
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))
{
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,
int c;
auth_instance *au;
uschar *orcpt = NULL;
- int flags;
+ int dsn_flags;
gstring * g;
#ifdef AUTH_TLS
/* Set the DSN flags orcpt and dsn_flags from the session*/
orcpt = NULL;
- flags = 0;
+ dsn_flags = 0;
if (fl.esmtp) for(;;)
{
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;
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
{
}
p = pp;
}
- DEBUG(D_receive) debug_printf("DSN Flags: %x\n", flags);
+ DEBUG(D_receive) debug_printf("DSN Flags: %x\n", dsn_flags);
}
}
/* 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,
--- /dev/null
+# Exim test configuration 0618
+
+SERVER =
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+
+# ----- Main settings -----
+
+.ifdef OPT
+dsn_advertise_hosts = *
+.endif
+delay_warning = 3s : 24h
+
+accept_8bitmime = false
+pipelining_advertise_hosts = :
+
+trusted_users = CALLER
+acl_smtp_rcpt = rcpt
+
+log_selector = +received_recipients
+queue_only
+queue_run_in_order
+
+
+event_action = ${acl {ev_log}}
+
+#
+
+begin acl
+
+ev_log:
+ accept logwrite = event $event_name
+
+rcpt:
+ accept hosts = HOSTIPV4
+
+ deny local_parts = rmt_reject
+ defer local_parts = rmt_defer
+ accept
+
+# ----- Routers -----
+
+begin routers
+
+r1:
+ driver = accept
+ condition = ${if eq {127.0.0.1}{$sender_host_address}}
+ transport = tofile
+
+r2:
+ driver = manualroute
+ local_parts = ^rmt_.*
+ route_list = * 127.0.0.1::PORT_D
+ self = send
+ transport = smtp
+
+r3:
+ driver = manualroute
+ local_parts = deferred
+ route_list = * 127.0.0.1::PORT_S
+ self = send
+ transport = bad_tpt
+
+# ----- Transports -----
+
+begin transports
+
+smtp:
+ driver = smtp
+ event_action = ${acl {ev_log}}
+
+bad_tpt:
+ driver = smtp
+ connect_timeout = 1s
+ event_action = ${acl {ev_log}}
+
+tofile:
+ driver = appendfile
+ file = DIR/test-mail/$local_part
+ user = CALLER
+ event_action = ${acl {ev_log}}
+
+begin retry
+
+* * F,1m,3s
+# End
--- /dev/null
+1999-03-02 09:44:33 Start queue run: pid=pppp
+1999-03-02 09:44:33 10HmaX-0005vi-00 event tcp:connect
+1999-03-02 09:44:33 10HmaX-0005vi-00 event smtp:connect
+1999-03-02 09:44:33 10HmaX-0005vi-00 event tcp:close
+1999-03-02 09:44:33 10HmaX-0005vi-00 ** rmt_reject@test.ex R=r2 T=smtp H=127.0.0.1 [127.0.0.1]: SMTP error from remote mail server after RCPT TO:<rmt_reject@test.ex>: 550 Administrative prohibition
+1999-03-02 09:44:33 10HmaX-0005vi-00 event msg:fail:delivery
+1999-03-02 09:44:33 10HmaX-0005vi-00 rmt_reject@test.ex: error ignored
+1999-03-02 09:44:33 10HmaX-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaX-0005vi-00 event msg:complete
+1999-03-02 09:44:33 10HmaY-0005vi-00 event tcp:connect
+1999-03-02 09:44:33 10HmaY-0005vi-00 event smtp:connect
+1999-03-02 09:44:33 10HmaY-0005vi-00 event tcp:close
+1999-03-02 09:44:33 10HmaY-0005vi-00 => rmt_accept@test.ex R=r2 T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmaZ-0005vi-00"
+1999-03-02 09:44:33 10HmaY-0005vi-00 event msg:delivery
+1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaY-0005vi-00 event msg:complete
+1999-03-02 09:44:33 10HmbA-0005vi-00 event tcp:connect
+1999-03-02 09:44:33 10HmbA-0005vi-00 event smtp:connect
+1999-03-02 09:44:33 10HmbA-0005vi-00 event msg:rcpt:host:defer
+1999-03-02 09:44:33 10HmbA-0005vi-00 event msg:rcpt:defer
+1999-03-02 09:44:33 10HmbA-0005vi-00 event tcp:close
+1999-03-02 09:44:33 10HmbA-0005vi-00 == rmt_defer@test.ex R=r2 T=smtp defer (-44) H=127.0.0.1 [127.0.0.1]: SMTP error from remote mail server after RCPT TO:<rmt_defer@test.ex>: 451 Temporary local problem - please try later
+1999-03-02 09:44:33 10HmbB-0005vi-00 event tcp:connect
+1999-03-02 09:44:33 10HmbB-0005vi-00 event smtp:connect
+1999-03-02 09:44:33 10HmbB-0005vi-00 event msg:rcpt:host:defer
+1999-03-02 09:44:33 10HmbB-0005vi-00 event msg:rcpt:defer
+1999-03-02 09:44:33 10HmbB-0005vi-00 event tcp:close
+1999-03-02 09:44:33 10HmbB-0005vi-00 == rmt_defer@test.ex R=r2 T=smtp defer (-44) H=127.0.0.1 [127.0.0.1]: SMTP error from remote mail server after RCPT TO:<rmt_defer@test.ex>: 451 Temporary local problem - please try later
+1999-03-02 09:44:33 End queue run: pid=pppp
+1999-03-02 09:44:33 Start queue run: pid=pppp
+1999-03-02 09:44:33 10HmbA-0005vi-00 event tcp:connect
+1999-03-02 09:44:33 10HmbA-0005vi-00 event smtp:connect
+1999-03-02 09:44:33 10HmbA-0005vi-00 event msg:rcpt:host:defer
+1999-03-02 09:44:33 10HmbA-0005vi-00 event msg:rcpt:defer
+1999-03-02 09:44:33 10HmbA-0005vi-00 event tcp:close
+1999-03-02 09:44:33 10HmbA-0005vi-00 == rmt_defer@test.ex R=r2 T=smtp defer (-44) H=127.0.0.1 [127.0.0.1]: SMTP error from remote mail server after RCPT TO:<rmt_defer@test.ex>: 451 Temporary local problem - please try later
+1999-03-02 09:44:33 10HmbC-0005vi-00 <= <> R=10HmbA-0005vi-00 U=EXIMUSER P=local S=sss for c@dump.ex
+1999-03-02 09:44:33 10HmbB-0005vi-00 event tcp:connect
+1999-03-02 09:44:33 10HmbB-0005vi-00 event smtp:connect
+1999-03-02 09:44:33 10HmbB-0005vi-00 event msg:rcpt:host:defer
+1999-03-02 09:44:33 10HmbB-0005vi-00 event msg:rcpt:defer
+1999-03-02 09:44:33 10HmbB-0005vi-00 event tcp:close
+1999-03-02 09:44:33 10HmbB-0005vi-00 == rmt_defer@test.ex R=r2 T=smtp defer (-44) H=127.0.0.1 [127.0.0.1]: SMTP error from remote mail server after RCPT TO:<rmt_defer@test.ex>: 451 Temporary local problem - please try later
+1999-03-02 09:44:33 10HmaZ-0005vi-00 => rmt_accept <rmt_accept@test.ex> R=r1 T=tofile
+1999-03-02 09:44:33 10HmaZ-0005vi-00 event msg:delivery
+1999-03-02 09:44:33 10HmbD-0005vi-00 <= <> R=10HmaZ-0005vi-00 U=EXIMUSER P=local S=sss for b@dump.ex
+1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaZ-0005vi-00 event msg:complete
+1999-03-02 09:44:33 End queue run: pid=pppp
+
+******** SERVER ********
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= a@dump.ex H=(testclient) [ip4.ip4.ip4.ip4] P=esmtp S=sss for rmt_reject@test.ex
+1999-03-02 09:44:33 10HmaY-0005vi-00 <= b@dump.ex H=(testclient) [ip4.ip4.ip4.ip4] P=esmtp S=sss for rmt_accept@test.ex
+1999-03-02 09:44:33 10HmbA-0005vi-00 <= c@dump.ex H=(testclient) [ip4.ip4.ip4.ip4] P=esmtp S=sss for rmt_defer@test.ex
+1999-03-02 09:44:33 10HmbB-0005vi-00 <= d@dump.ex H=(testclient) [ip4.ip4.ip4.ip4] P=esmtp S=sss for rmt_defer@test.ex
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<a@dump.ex> rejected RCPT <rmt_reject@test.ex>
+1999-03-02 09:44:33 10HmaZ-0005vi-00 <= b@dump.ex H=localhost (myhost.test.ex) [127.0.0.1] P=esmtp S=sss for rmt_accept@test.ex
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<c@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<d@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<c@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<d@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
--- /dev/null
+From b@dump.ex Tue Mar 02 09:44:33 1999
+Received: from localhost ([127.0.0.1] helo=myhost.test.ex)
+ by myhost.test.ex with esmtp (Exim x.yz)
+ (envelope-from <b@dump.ex>)
+ id 10HmaZ-0005vi-00
+ for rmt_accept@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+Received: from [ip4.ip4.ip4.ip4] (helo=testclient)
+ by myhost.test.ex with esmtp (Exim x.yz)
+ (envelope-from <b@dump.ex>)
+ id 10HmaY-0005vi-00
+ for rmt_accept@test.ex; Tue, 2 Mar 1999 09:44:33 +0000
+Subject: test
+
+
--- /dev/null
+
+******** SERVER ********
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<a@dump.ex> rejected RCPT <rmt_reject@test.ex>
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<c@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<d@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<c@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
+1999-03-02 09:44:33 H=localhost (myhost.test.ex) [127.0.0.1] F=<d@dump.ex> temporarily rejected RCPT <rmt_defer@test.ex>
--- /dev/null
+# DSN ESMTP extension RCPT options
+#
+# Server does not advertise by default
+exim -DSERVER=server -bd -oX PORT_D
+****
+client 127.0.0.1 PORT_D
+??? 220
+EHLO testclient
+??? 250-
+??? 250-SIZE
+??? 250 HELP
+****
+killdaemon
+#
+#
+# Server does advertise when told. Client requests no bounces, and this one gets a reject.
+exim -DSERVER=server -DOPT=y -bd -oX PORT_D
+****
+client HOSTIPV4 PORT_D
+??? 220
+EHLO testclient
+??? 250-
+??? 250-SIZE
+??? 250-DSN
+??? 250 HELP
+MAIL FROM:<a@dump.ex>
+??? 250
+RCPT TO:<any@test.ex> NOTIFY=foo
+??? 501
+RCPT TO:<rmt_reject@test.ex> NOTIFY=never
+??? 250
+DATA
+??? 354
+Subject: test
+.
+??? 250
+QUIT
+??? 221
+****
+# Client requests delivery notification; the server supports DSN to takes responsibility
+client HOSTIPV4 PORT_D
+??? 220
+EHLO testclient
+??? 250-
+??? 250-SIZE
+??? 250-DSN
+??? 250 HELP
+MAIL FROM:<b@dump.ex>
+??? 250
+RCPT TO:<rmt_accept@test.ex> NOTIFY=success
+??? 250
+DATA
+??? 354
+Subject: test
+.
+??? 250
+QUIT
+??? 221
+****
+# Client requests notification of deferral. First time of trying, the
+# queue-time probably has not hit the 1st retry time yet, so no DSN will
+# be sent and the message remains queued.
+client HOSTIPV4 PORT_D
+??? 220
+EHLO testclient
+??? 250-
+??? 250-SIZE
+??? 250-DSN
+??? 250 HELP
+MAIL FROM:<c@dump.ex>
+??? 250
+RCPT TO:<rmt_defer@test.ex> NOTIFY=delay
+??? 250
+DATA
+??? 354
+Subject: test
+.
+??? 250
+QUIT
+??? 221
+****
+# Clients requests no DSNs, and this one gets deferred
+client HOSTIPV4 PORT_D
+??? 220
+EHLO testclient
+??? 250-
+??? 250-SIZE
+??? 250-DSN
+??? 250 HELP
+MAIL FROM:<d@dump.ex>
+??? 250
+RCPT TO:<rmt_defer@test.ex> NOTIFY=never
+??? 250
+DATA
+??? 354
+Subject: test
+.
+??? 250
+QUIT
+??? 221
+****
+# This attemmpt the set of all the above, for the first time.
+exim -q
+****
+sleep 3
+# Second time, for the queued deferrals. Final delivery for the acceptance.
+exim -q
+****
+killdaemon
+#
+#
+no_msglog_check
--- /dev/null
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> EHLO testclient
+??? 250-
+<<< 250-myhost.test.ex Hello testclient [127.0.0.1]
+??? 250-SIZE
+<<< 250-SIZE 52428800
+??? 250 HELP
+<<< 250 HELP
+End of script
+Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> EHLO testclient
+??? 250-
+<<< 250-myhost.test.ex Hello testclient [ip4.ip4.ip4.ip4]
+??? 250-SIZE
+<<< 250-SIZE 52428800
+??? 250-DSN
+<<< 250-DSN
+??? 250 HELP
+<<< 250 HELP
+>>> MAIL FROM:<a@dump.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<any@test.ex> NOTIFY=foo
+??? 501
+<<< 501 Invalid value for NOTIFY parameter
+>>> RCPT TO:<rmt_reject@test.ex> NOTIFY=never
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> Subject: test
+>>> .
+??? 250
+<<< 250 OK id=10HmaX-0005vi-00
+>>> QUIT
+??? 221
+<<< 221 myhost.test.ex closing connection
+End of script
+Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> EHLO testclient
+??? 250-
+<<< 250-myhost.test.ex Hello testclient [ip4.ip4.ip4.ip4]
+??? 250-SIZE
+<<< 250-SIZE 52428800
+??? 250-DSN
+<<< 250-DSN
+??? 250 HELP
+<<< 250 HELP
+>>> MAIL FROM:<b@dump.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<rmt_accept@test.ex> NOTIFY=success
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> Subject: test
+>>> .
+??? 250
+<<< 250 OK id=10HmaY-0005vi-00
+>>> QUIT
+??? 221
+<<< 221 myhost.test.ex closing connection
+End of script
+Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> EHLO testclient
+??? 250-
+<<< 250-myhost.test.ex Hello testclient [ip4.ip4.ip4.ip4]
+??? 250-SIZE
+<<< 250-SIZE 52428800
+??? 250-DSN
+<<< 250-DSN
+??? 250 HELP
+<<< 250 HELP
+>>> MAIL FROM:<c@dump.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<rmt_defer@test.ex> NOTIFY=delay
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> Subject: test
+>>> .
+??? 250
+<<< 250 OK id=10HmbA-0005vi-00
+>>> QUIT
+??? 221
+<<< 221 myhost.test.ex closing connection
+End of script
+Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> EHLO testclient
+??? 250-
+<<< 250-myhost.test.ex Hello testclient [ip4.ip4.ip4.ip4]
+??? 250-SIZE
+<<< 250-SIZE 52428800
+??? 250-DSN
+<<< 250-DSN
+??? 250 HELP
+<<< 250 HELP
+>>> MAIL FROM:<d@dump.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<rmt_defer@test.ex> NOTIFY=never
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> Subject: test
+>>> .
+??? 250
+<<< 250 OK id=10HmbB-0005vi-00
+>>> QUIT
+??? 221
+<<< 221 myhost.test.ex closing connection
+End of script