ph10 2005/01/13 16:15:53 GMT
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src smtp_in.c
exim-test-orig/AutoTest/log 349
exim-test-orig/AutoTest/rejectlog 349
exim-test-orig/AutoTest/scripts 349
exim-test-orig/AutoTest/stdout 349
Log:
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).
Revision Changes Path
1.70 +4 -0 exim/exim-doc/doc-txt/ChangeLog
1.9 +14 -1 exim/exim-src/src/smtp_in.c
1.2 +1 -0 exim/exim-test-orig/AutoTest/log/349
1.2 +1 -0 exim/exim-test-orig/AutoTest/rejectlog/349
1.2 +8 -8 exim/exim-test-orig/AutoTest/scripts/349
1.2 +5 -0 exim/exim-test-orig/AutoTest/stdout/349
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- ChangeLog 13 Jan 2005 11:12:12 -0000 1.69
+++ ChangeLog 13 Jan 2005 16:15:52 -0000 1.70
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.69 2005/01/13 11:12:12 ph10 Exp $
+$Cambridge: exim/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
-------------------------------------------
@@ -312,6 +312,10 @@
user-specific message (i.e. there was only a "system" message), nothing was
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
Index: smtp_in.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/smtp_in.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- smtp_in.c 4 Jan 2005 10:00:42 -0000 1.8
+++ smtp_in.c 13 Jan 2005 16:15:53 -0000 1.9
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/smtp_in.c,v 1.8 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/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 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 (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;
}
Index: 349
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/log/349,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 349 8 Oct 2004 14:49:31 -0000 1.1
+++ 349 13 Jan 2005 16:15:53 -0000 1.2
@@ -11,3 +11,4 @@
1999-03-02 09:44:33 10HmaY-0005vi-00 <= ph10@??? H=(dis.able) [127.0.0.1] P=esmtp S=182
1999-03-02 09:44:33 10HmaY-0005vi-00 => :blackhole: <ph10@???> R=r1
1999-03-02 09:44:33 10HmaY-0005vi-00 Completed
+1999-03-02 09:44:33 SMTP protocol violation: synchronization error (input sent without waiting for greeting): rejected connection from H=[127.0.0.2] input="helo abcd\r\n"
Index: 349
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/rejectlog/349,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 349 8 Oct 2004 14:49:51 -0000 1.1
+++ 349 13 Jan 2005 16:15:53 -0000 1.2
@@ -4,3 +4,4 @@
1999-03-02 09:44:33 SMTP protocol violation: synchronization error (next input sent too soon: pipelining was not advertised): rejected "mail from:<ph10@???>" H=(abcd) [::1] next input="rcpt to:<ph10@???>\r\n"
1999-03-02 09:44:33 SMTP protocol violation: synchronization error (next input sent too soon: pipelining was not advertised): rejected "junk1" H=[::1] next input="junk2\r\n"
1999-03-02 09:44:33 SMTP protocol violation: synchronization error (next input sent too soon: pipelining was not advertised): rejected "rset" H=(abcd) [::1] next input="quit\r\n"
+1999-03-02 09:44:33 SMTP protocol violation: synchronization error (input sent without waiting for greeting): rejected connection from H=[127.0.0.2] input="helo abcd\r\n"
Index: 349
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/scripts/349,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 349 8 Oct 2004 14:49:52 -0000 1.1
+++ 349 13 Jan 2005 16:15:53 -0000 1.2
@@ -104,14 +104,14 @@
quit
??? 221
****
-# Send HELO without waiting for greeting
-# Can't test this because it needs a delay at
-# the server end, which we can't have
-# 0
-# client 127.0.0.1 1225
-# helo abcd
-# ??? 554
-# ****
+# Send HELO without waiting for greeting; note the use of
+# 127.0.0.2 to get a delay at the server end. We need to
+# increase the client timeout to cope with this.
+0
+client -t2 127.0.0.2 1225
+helo abcd
+??? 554
+****
0
killdaemon
****
Index: 349
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/stdout/349,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 349 8 Oct 2004 14:50:13 -0000 1.1
+++ 349 13 Jan 2005 16:15:53 -0000 1.2
@@ -129,3 +129,8 @@
??? 221
<<< 221 myhost.test.ex closing connection
End of script
+Connecting to 127.0.0.2 port 1225 ... connected
+>>> helo abcd
+??? 554
+<<< 554 SMTP synchronization error
+End of script