X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/da47dd4d092ba35e4f8ff055d79693cc1266c816..f870028fd26f8ac1a2fcb6e43e0d7d1c76c110ec:/src/src/receive.c diff --git a/src/src/receive.c b/src/src/receive.c index df8719ec6..ce7da5719 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -176,6 +176,7 @@ else empty item in a list. */ if (*p == 0) p = US":"; + /* should never be a tainted list */ while ((path = string_nextinlist(&p, &sep, buffer, sizeof(buffer)))) if (Ustrcmp(path, "syslog") != 0) break; @@ -1228,9 +1229,8 @@ if (acl_removed_headers) const uschar * list = acl_removed_headers; int sep = ':'; /* This is specified as a colon-separated list */ uschar *s; - uschar buffer[128]; - while ((s = string_nextinlist(&list, &sep, buffer, sizeof(buffer)))) + while ((s = string_nextinlist(&list, &sep, NULL, 0))) if (header_testname(h, s, Ustrlen(s), FALSE)) { h->type = htype_old; @@ -1784,7 +1784,7 @@ if (sender_host_address) dmarc_init(); /* initialize libopendmarc */ ids, and fractions of a second are required. See the comments that precede the message id creation below. */ -(void)gettimeofday(&message_id_tv, NULL); +exim_gettime(&message_id_tv); /* For other uses of the received time we can operate with granularity of one second, and for that we use the global variable received_time. This is for @@ -2806,7 +2806,7 @@ From:) but we still want to ensure a valid Sender: if it is required. */ if ( !from_header && ((!sender_host_address && !f.suppress_local_fixups) || f.submission_mode)) { - uschar *oname = US""; + const uschar * oname = US""; /* Use the originator_name if this is a locally submitted message and the caller is not trusted. For trusted callers, use it only if -F was used to @@ -3272,7 +3272,7 @@ if (fflush(spool_data_file) == EOF || ferror(spool_data_file) || /* No I/O errors were encountered while writing the data file. */ DEBUG(D_receive) debug_printf("Data file written for message %s\n", message_id); -if (LOGGING(receive_time)) timesince(&received_time_taken, &received_time); +gettimeofday(&received_time_complete, NULL); /* If there were any bad addresses extracted by -t, or there were no recipients @@ -4004,7 +4004,7 @@ if (LOGGING(tls_certificate_verified) && tls_in.cipher) if (LOGGING(tls_peerdn) && tls_in.peerdn) g = string_append(g, 3, US" DN=\"", string_printing(tls_in.peerdn), US"\""); if (LOGGING(tls_sni) && tls_in.sni) - g = string_append(g, 3, US" SNI=\"", string_printing(tls_in.sni), US"\""); + g = string_append(g, 2, US" SNI=", string_printing2(tls_in.sni, SP_TAB|SP_SPACE)); #endif if (sender_host_authenticated) @@ -4050,7 +4050,11 @@ if (LOGGING(dkim) && arc_state && Ustrcmp(arc_state, "pass") == 0) #endif if (LOGGING(receive_time)) - g = string_append(g, 2, US" RT=", string_timediff(&received_time_taken)); + { + struct timeval diff = received_time_complete; + timediff(&diff, &received_time); + g = string_append(g, 2, US" RT=", string_timediff(&diff)); + } if (*queue_name) g = string_append(g, 2, US" Q=", queue_name); @@ -4177,12 +4181,10 @@ response, but the chance of this happening should be small. */ if (smtp_input && sender_host_address && !f.sender_host_notsocket && !receive_smtp_buffered()) { - struct timeval tv; + struct timeval tv = {.tv_sec = 0, .tv_usec = 0}; fd_set select_check; FD_ZERO(&select_check); FD_SET(fileno(smtp_in), &select_check); - tv.tv_sec = 0; - tv.tv_usec = 0; if (select(fileno(smtp_in) + 1, &select_check, NULL, NULL, &tv) != 0) { @@ -4375,12 +4377,17 @@ if (smtp_input) else if (chunking_state > CHUNKING_OFFERED) { - smtp_printf("250- %u byte chunk, total %d\r\n250 OK id=%s\r\n", FALSE, + /* If there is more input waiting, no need to flush (probably the client + pipelined QUIT after data). We check only the in-process buffer, not + the socket. */ + + smtp_printf("250- %u byte chunk, total %d\r\n250 OK id=%s\r\n", + receive_smtp_buffered(), chunking_datasize, message_size+message_linecount, message_id); chunking_state = CHUNKING_OFFERED; } else - smtp_printf("250 OK id=%s\r\n", FALSE, message_id); + smtp_printf("250 OK id=%s\r\n", receive_smtp_buffered(), message_id); if (host_checking) fprintf(stdout,