From: Philip Hazel Date: Thu, 13 Jan 2005 16:15:52 +0000 (+0000) Subject: Add the unwanted input to the log line for a synchronization error right X-Git-Tag: exim-4_50~31 X-Git-Url: https://vcs.fsf.org/?p=exim.git;a=commitdiff_plain;h=00f00ca5c40d7deec2a8eddb9153b47830554b83 Add the unwanted input to the log line for a synchronization error right at the start of an SMTP session (so it's the same as other cases). --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 430aa8692..04b87509b 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.69 2005/01/13 11:12:12 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.70 2005/01/13 16:15:52 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -313,6 +313,10 @@ Exim version 4.50 put in $acl_verify_message. In this situation, it now puts the system message there. +71. Change 4.23/11 added synchronization checking at the start of an SMTP + session; change 4.31/43 added the unwanted input to the log line - except + that it did not do this in the start of session case. It now does. + Exim version 4.43 ----------------- diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index a33fcd081..063d74a96 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/smtp_in.c,v 1.8 2005/01/04 10:00:42 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.9 2005/01/13 16:15:53 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1121,6 +1121,15 @@ int size = 256; int i, ptr; uschar *p, *s, *ss; +/* If we are running in the test harness, and the incoming call is from +127.0.0.2 (sic), have a short delay. This makes it possible to test handling of +input sent too soon (before the banner is output). */ + +if (running_in_test_harness && Ustrcmp(sender_host_address, "127.0.0.2") == 0) + sleep(1); + +/* Default values for certain variables */ + helo_seen = esmtp = helo_accept_junk = FALSE; count_nonmail = TRUE_UNSET; synprot_error_count = unknown_command_count = nonmail_command_count = 0; @@ -1598,9 +1607,13 @@ if (smtp_enforce_sync && sender_host_address != NULL && !sender_host_notsocket) if (select(fileno(smtp_in) + 1, (SELECT_ARG2_TYPE *)&fds, NULL, NULL, &tzero) > 0) { + int rc = read(fileno(smtp_in), smtp_inbuffer, in_buffer_size); + if (rc > 150) rc = 150; + smtp_inbuffer[rc] = 0; log_write(0, LOG_MAIN|LOG_REJECT, "SMTP protocol violation: " "synchronization error (input sent without waiting for greeting): " - "rejected connection from %s", host_and_ident(TRUE)); + "rejected connection from %s input=\"%s\"", host_and_ident(TRUE), + string_printing(smtp_inbuffer)); smtp_printf("554 SMTP synchronization error\r\n"); return FALSE; }