X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/d315eda12f25ca2f72ca56b777a427c9ee7188e1..a5ffa9b475a426bc73366db01f7cc92a3811bc3a:/src/src/receive.c diff --git a/src/src/receive.c b/src/src/receive.c index b03ab71ed..9561a4baf 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*/ } @@ -2192,7 +2194,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 +3027,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 +3501,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++) { @@ -4301,13 +4302,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, @@ -4321,7 +4321,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) {