X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fdeliver.c;h=4e472ebe6bb8b34056033d577d56364a9f71a46e;hb=3327394394a45c79cd48b2091536f6a6b8ba32a3;hp=29e2b719df1b076acc3ae9120fb309bf9b737457;hpb=001bf8f58763581d117edaa391aa13ac139eb39b;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/deliver.c b/src/src/deliver.c index 29e2b719d..4e472ebe6 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -334,7 +334,7 @@ static int open_msglog_file(uschar *filename, int mode, uschar **error) { if (Ustrstr(filename, US"/../")) - log_write(0, LOG_MAIN|LOG_PANIC, + log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Attempt to open msglog file path with upward-traversal: '%s'\n", filename); for (int i = 2; i > 0; i--) @@ -521,8 +521,12 @@ while (one && two) else if (one->port != two->port) return FALSE; - /* Hosts matched */ +#ifdef SUPPORT_DANE + /* DNSSEC equality */ + if (one->dnssec != two->dnssec) return FALSE; +#endif + /* Hosts matched */ one = one->next; two = two->next; } @@ -1269,8 +1273,8 @@ if ( LOGGING(smtp_confirmation) /* Time on queue and actual time taken to deliver */ if (LOGGING(queue_time)) - g = string_append(g, 2, US" QT=", - string_timesince(&received_time)); + g = string_append(g, 2, US" QT=", string_timesince( + LOGGING(queue_time_exclusive) ? &received_time_complete : &received_time)); if (LOGGING(deliver_time)) g = string_append(g, 2, US" DT=", string_timediff(&addr->delivery_time)); @@ -1580,6 +1584,12 @@ if (addr->return_file >= 0 && addr->return_filename) (void)close(addr->return_file); } +/* Check if the transport notifed continue-conn status explicitly, and +update our knowlege. */ + +if (testflag(addr, af_new_conn)) continue_sequence = 1; +else if (testflag(addr, af_cont_conn)) continue_sequence++; + /* The success case happens only after delivery by a transport. */ if (result == OK) @@ -2087,9 +2097,9 @@ return FALSE; /* Each local delivery is performed in a separate process which sets its uid and gid as specified. This is a safer way than simply changing and -restoring using seteuid(); there is a body of opinion that seteuid() cannot be -used safely. From release 4, Exim no longer makes any use of it. Besides, not -all systems have seteuid(). +restoring using seteuid(); there is a body of opinion that seteuid() +cannot be used safely. From release 4, Exim no longer makes any use of +it for delivery. Besides, not all systems have seteuid(). If the uid/gid are specified in the transport_instance, they are used; the transport initialization must ensure that either both or neither are set. @@ -2878,10 +2888,8 @@ while (addr_local) deliveries (e.g. to pipes) can take a substantial time. */ if (!(dbm_file = dbfn_open(US"retry", O_RDONLY, &dbblock, FALSE, TRUE))) - { DEBUG(D_deliver|D_retry|D_hints_lookup) debug_printf("no retry data available\n"); - } addr2 = addr; addr3 = NULL; @@ -3571,7 +3579,13 @@ while (!done) switch (*subid) { - #ifdef SUPPORT_SOCKS + case 3: /* explicit notification of continued-connection (non)use; + overrides caller's knowlege. */ + if (*ptr & BIT(1)) setflag(addr, af_new_conn); + else if (*ptr & BIT(2)) setflag(addr, af_cont_conn); + break; + +#ifdef SUPPORT_SOCKS case '2': /* proxy information; must arrive before A0 and applies to that addr XXX oops*/ proxy_session = TRUE; /*XXX should this be cleared somewhere? */ if (*ptr == 0) @@ -3584,9 +3598,9 @@ while (!done) ptr += sizeof(proxy_local_port); } break; - #endif +#endif - #ifdef EXPERIMENTAL_DSN_INFO +#ifdef EXPERIMENTAL_DSN_INFO case '1': /* must arrive before A0, and applies to that addr */ /* Two strings: smtp_greeting and helo_response */ addr->smtp_greeting = string_copy(ptr); @@ -3594,7 +3608,7 @@ while (!done) addr->helo_response = string_copy(ptr); while(*ptr++); break; - #endif +#endif case '0': DEBUG(D_deliver) debug_printf("A0 %s tret %d\n", addr->address, *ptr); @@ -4885,6 +4899,14 @@ all pipes, so I do not see a reason to use non-blocking IO here rmt_dlv_checked_write(fd, 'R', '0', big_buffer, ptr - big_buffer); } + if (testflag(addr, af_new_conn) || testflag(addr, af_cont_conn)) + { + DEBUG(D_deliver) debug_printf("%scontinued-connection\n", + testflag(addr, af_new_conn) ? "non-" : ""); + big_buffer[0] = testflag(addr, af_new_conn) ? BIT(1) : BIT(2); + rmt_dlv_checked_write(fd, 'A', '3', big_buffer, 1); + } + #ifdef SUPPORT_SOCKS if (LOGGING(proxy) && proxy_session) { @@ -8416,7 +8438,7 @@ else if (addr_defer != (address_item *)(+1)) /* If this was a first delivery attempt, unset the first time flag, and ensure that the spool gets updated. */ - if (f.deliver_firsttime) + if (f.deliver_firsttime && !f.queue_2stage) { f.deliver_firsttime = FALSE; update_spool = TRUE; @@ -8550,6 +8572,9 @@ f.tcp_fastopen_ok = TRUE; +/* Called from a commandline, or from the daemon, to do a delivery. +We need to regain privs; do this by exec of the exim binary. */ + void delivery_re_exec(int exec_type) {