X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Freceive.c;h=65e9fb415127f301e017c68e5d86b42132e382e9;hb=4c0a7a9cb02f9904c2e890f77ff8ce3a6beb25f4;hp=3d92a8479a0a121de98a8ca789c0911c55076cf0;hpb=328c5688dbe0f4c14418f22350ccd99b3fe8ac71;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/receive.c b/src/src/receive.c index 3d92a8479..65e9fb415 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -919,7 +919,7 @@ BOOL fix_nl = FALSE; for(;;) { - switch ((ch = (bdat_getc)(GETC_BUFFER_UNLIMITED))) + switch ((ch = bdat_getc(GETC_BUFFER_UNLIMITED))) { case EOF: return END_EOF; case ERR: return END_PROTOCOL; @@ -1026,32 +1026,34 @@ int ch; DEBUG(D_receive) debug_printf("CHUNKING: writing spoolfile in wire format\n"); spool_file_wireformat = TRUE; -/* Unfortunately cannot use sendfile() even if not TLS -as that requires (on linux) mmap-like operations on the input fd. - -XXX but worthwhile doing a block interface to the bdat_getc buffer -in the future */ - -for (;;) switch (ch = bdat_getc(GETC_BUFFER_UNLIMITED)) +for (;;) { - case EOF: return END_EOF; - case EOD: return END_DOT; - case ERR: return END_PROTOCOL; + if (chunking_data_left > 0) + { + unsigned len = MAX(chunking_data_left, thismessage_size_limit - message_size + 1); + uschar * buf = bdat_getbuf(&len); - default: - message_size++; -/*XXX not done: -linelength -max_received_linelength -body_linecount -body_zerocount -*/ - if (fout) - { - if (fputc(ch, fout) == EOF) return END_WERROR; - if (message_size > thismessage_size_limit) return END_SIZE; - } - break; + message_size += len; + if (fout && fwrite(buf, len, 1, fout) != 1) return END_WERROR; + } + else switch (ch = bdat_getc(GETC_BUFFER_UNLIMITED)) + { + case EOF: return END_EOF; + case EOD: return END_DOT; + case ERR: return END_PROTOCOL; + + default: + message_size++; + /*XXX not done: + linelength + max_received_linelength + body_linecount + body_zerocount + */ + if (fout && fputc(ch, fout) == EOF) return END_WERROR; + break; + } + if (message_size > thismessage_size_limit) return END_SIZE; } /*NOTREACHED*/ } @@ -1301,7 +1303,7 @@ add_host_info_for_log(uschar * s, int * sizeptr, int * ptrptr) if (sender_fullhost) { if (LOGGING(dnssec) && sender_host_dnssec) /*XXX sender_helo_dnssec? */ - s = string_cat(s, sizeptr, ptrptr, US" DS"); + s = string_catn(s, sizeptr, ptrptr, US" DS", 3); s = string_append(s, sizeptr, ptrptr, 2, US" H=", sender_fullhost); if (LOGGING(incoming_interface) && interface_address != NULL) { @@ -1309,9 +1311,14 @@ if (sender_fullhost) string_sprintf(" I=[%s]:%d", interface_address, interface_port)); } } -if (sender_ident != NULL) +if (tcp_in_fastopen && !tcp_in_fastopen_logged) + { + s = string_catn(s, sizeptr, ptrptr, US" TFO", 4); + tcp_in_fastopen_logged = TRUE; + } +if (sender_ident) s = string_append(s, sizeptr, ptrptr, 2, US" U=", sender_ident); -if (received_protocol != NULL) +if (received_protocol) s = string_append(s, sizeptr, ptrptr, 2, US" P=", received_protocol); return s; } @@ -1741,9 +1748,9 @@ message id creation below. */ /* 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 -things like ultimate message timeouts. */ +things like ultimate message timeouts.XXX */ -received_time = message_id_tv.tv_sec; +received_time = message_id_tv; /* If SMTP input, set the special handler for timeouts. The alarm() calls happen in the smtp_getc() function when it refills its buffer. */ @@ -2192,7 +2199,7 @@ for (;;) sender_address, sender_fullhost ? " H=" : "", sender_fullhost ? sender_fullhost : US"", sender_ident ? " U=" : "", sender_ident ? sender_ident : US""); - smtp_printf("552 Message header not CRLF terminated\r\n"); + smtp_printf("552 Message header not CRLF terminated\r\n", FALSE); bdat_flush_data(); smtp_reply = US""; goto TIDYUP; /* Skip to end of function */ @@ -3025,7 +3032,6 @@ if (chunking_state > CHUNKING_OFFERED) /* Cutthrough delivery: We have to create the Received header now rather than at the end of reception, so the timestamp behaviour is a change to the normal case. -XXX Ensure this gets documented XXX. Having created it, send the headers to the destination. */ if (cutthrough.fd >= 0 && cutthrough.delivery) @@ -3500,7 +3506,7 @@ else int all_pass = OK; int all_fail = FAIL; - smtp_printf("353 PRDR content analysis beginning\r\n"); + smtp_printf("353 PRDR content analysis beginning\r\n", TRUE); /* Loop through recipients, responses must be in same order received */ for (c = 0; recipients_count > c; c++) { @@ -3676,6 +3682,7 @@ dcc_ok = 0; version supplied with Exim always accepts, but this is a hook for sysadmins to supply their own checking code. The local_scan() function is run even when all the recipients have been discarded. */ +/*XXS could we avoid this for the standard case, given that few people will use it? */ lseek(data_fd, (long int)SPOOL_DATA_START_OFFSET, SEEK_SET); @@ -4300,13 +4307,12 @@ if (smtp_input) else if (chunking_state > CHUNKING_OFFERED) { -/*XXX rethink for spool_wireformat */ - smtp_printf("250- %u byte chunk, total %d\r\n250 OK id=%s\r\n", + smtp_printf("250- %u byte chunk, total %d\r\n250 OK id=%s\r\n", FALSE, chunking_datasize, message_size+message_linecount, message_id); chunking_state = CHUNKING_OFFERED; } else - smtp_printf("250 OK id=%s\r\n", message_id); + smtp_printf("250 OK id=%s\r\n", FALSE, message_id); if (host_checking) fprintf(stdout, @@ -4320,7 +4326,7 @@ if (smtp_input) smtp_respond((fake_response == DEFER)? US"450" : US"550", 3, TRUE, fake_response_text); else - smtp_printf("%.1024s\r\n", smtp_reply); + smtp_printf("%.1024s\r\n", FALSE, smtp_reply); switch (cutthrough_done) {