ID: 22947 User updated by: me at mattbeale dot plus dot com Reported By: me at mattbeale dot plus dot com Status: Assigned Bug Type: Mail related Operating System: Windows 2000 SP4 PHP Version: 4CVS-2003-04-29 (stable) Assigned To: edink New Comment:
Woohoo, Everything works fine. Excellent work Lee! I've only compiled a CGI version (not debug), but if anyone else (Andrew?) wants to test it, it is here: http://www.mattbeale.plus.com/phpbug22947/phpbug22947.tar.gz Previous Comments: ------------------------------------------------------------------------ [2003-08-11 05:16:10] lwillis at plus dot net Probably easier to grab the patch from here: http://www.lwillis.plus.com/php_sendmail_patch.patch Lee ------------------------------------------------------------------------ [2003-08-11 05:15:01] lwillis at plus dot net The patch below (I can't find anywhere to add this as an attachment - shoot me if I'm being stupid) may fix the problem (Matt - could you try it?). Not sure whether it will work correctly with multi-line responses. This is untested - I don't have access to a win32 platform to build on right now (Or a mail server that sends multi-line responses to a HELO ...) Index: win32/sendmail.c =================================================================== RCS file: /repository/php-src/win32/sendmail.c,v retrieving revision 1.55 diff -u -r1.55 sendmail.c --- win32/sendmail.c 23 Jul 2003 16:03:10 -0000 1.55 +++ win32/sendmail.c 11 Aug 2003 10:10:54 -0000 @@ -882,11 +882,10 @@ /* Check for newline */ Index += rlen; - if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || + if ((buf[3] == '-') || (buf[Received - 2] != '\r') || (buf[Received - 1] != '\n')) /* err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */ - goto again; /* Incomplete data. Line must be terminated by CRLF - And not contain a space followed by a '-' */ + goto again; /* Incomplete data OR multi-line response. Line must be terminated by CRLF */ if (buf[0] > '3') { /* If we've a valid pointer, return the SMTP server response so the error message contains more information */ ------------------------------------------------------------------------ [2003-08-11 04:43:16] lwillis at plus dot net As far as I can see from section 4.1.1.1 of RFC 2821 the response given to the HELO command is perfectly valid. http://www.faqs.org/rfcs/rfc2821.html The check for a space and then dash was introduced into win32/sendmail.c at version 1.20 with the following log entry: -------------------------------------- revision 1.20 date: 2000/09/05 00:26:15; author: sterling; state: Exp; lines: +5 -2 This should fix the multiple-line problem. -------------------------------------- Not sure which "multiple line problem" though - possibly bug 6537 Either way, the response we're sending looks like it should be handled fine by PHP - and it certainly shouldn't cause a hang (I expect PHP is waiting for more data trying to get the next line of a multi-line response - but it should be doing this as the response code (250) is followed by a space, not a dash ... ------------------------------------------------------------------------ [2003-08-03 09:05:38] me at mattbeale dot plus dot com Does this not get acknowledgement unless the Status is set back to Open? ------------------------------------------------------------------------ [2003-08-02 18:28:51] phpbugs at pligplob dot com This does seem to be a fault in the Windows code, the Ack() function in sendmail.c: win32/sendmail.c(Ack): ... if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') || ... It is specifically disallowing SPACE HYPHEN at the end of the SMTP reply text that PlusNet's server is sending, but that seems to be allowed by RFC2821. However, since someone has deliberately blocked this pattern there must be a reason for it, but it seems invalid to me. When I modifed the php4ts.dll to use EHLO instead of HELO the SMTP exchange completed successfully. PlusNet's server avoids the "illegal" SPACE HYPHEN in its extended reply, so the hangup doesn't occur. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22947 -- Edit this bug report at http://bugs.php.net/?id=22947&edit=1