ph10 2005/03/29 16:53:12 BST
Modified files:
exim-doc/doc-txt ChangeLog
exim-src/src smtp_in.c
exim-test-orig/AutoTest/scripts 349
exim-test-orig/AutoTest/stdout 349
Log:
Fix non-check for read() error in sync check before writing banner.
Revision Changes Path
1.106 +9 -0 exim/exim-doc/doc-txt/ChangeLog
1.15 +11 -8 exim/exim-src/src/smtp_in.c
1.3 +9 -0 exim/exim-test-orig/AutoTest/scripts/349
1.3 +2 -0 exim/exim-test-orig/AutoTest/stdout/349
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- ChangeLog 29 Mar 2005 15:19:25 -0000 1.105
+++ ChangeLog 29 Mar 2005 15:53:12 -0000 1.106
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.105 2005/03/29 15:19:25 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.106 2005/03/29 15:53:12 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -107,6 +107,15 @@
for a non-existent subprocess. Forks do occasionally fail when resources
run out. I reviewed all the other calls to fork(); they all seem to check
for failure.
+
+PH/20 When checking for unexpected SMTP input at connect time (before writing
+ the banner), Exim was not dealing correctly with a non-positive return
+ from the read() function. If the client had disconnected by this time,
+ the result was a log entry for a synchronization error with an empty
+ string after "input=" when read() returned zero. If read() returned -1
+ (an event I could not check), uninitialized data bytes were printed.
+ There were reports of junk text (parts of files, etc) appearing after
+ "input=".
A note about Exim versions 4.44 and 4.50
Index: smtp_in.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/smtp_in.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- smtp_in.c 22 Mar 2005 10:11:43 -0000 1.14
+++ smtp_in.c 29 Mar 2005 15:53:12 -0000 1.15
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/smtp_in.c,v 1.14 2005/03/22 10:11:43 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/smtp_in.c,v 1.15 2005/03/29 15:53:12 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -1616,14 +1616,17 @@
&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 input=\"%s\"", host_and_ident(TRUE),
- string_printing(smtp_inbuffer));
- smtp_printf("554 SMTP synchronization error\r\n");
- return FALSE;
+ if (rc > 0)
+ {
+ 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 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/scripts/349,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 349 13 Jan 2005 16:15:53 -0000 1.2
+++ 349 29 Mar 2005 15:53:12 -0000 1.3
@@ -112,6 +112,15 @@
helo abcd
??? 554
****
+# Disconnect without waiting for the greeting. This should
+# test the check for input that happens before sending the
+# banner (there was a bug at one point; missing error check).
+0
+client -t2 127.0.0.2 1225
+****
+0
+sleep 1
+****
0
killdaemon
****
Index: 349
===================================================================
RCS file: /home/cvs/exim/exim-test-orig/AutoTest/stdout/349,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- 349 13 Jan 2005 16:15:53 -0000 1.2
+++ 349 29 Mar 2005 15:53:12 -0000 1.3
@@ -134,3 +134,5 @@
??? 554
<<< 554 SMTP synchronization error
End of script
+Connecting to 127.0.0.2 port 1225 ... connected
+End of script