Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/win32/sendmail.c branches/PHP_5_3/NEWS branches/PHP_5_3/win32/sendmail.c trunk/win32/sendmail.c

2009-08-19 Thread Jani Taskinen

On 08/18/2009 09:58 PM, Garrett Serack wrote:

garretts Tue, 18 Aug 2009 18:58:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=287462

Log:
- Fixed bug #28038 (Sent incorrect RCPT TO commands to SMTP server)

Bug: http://bugs.php.net/28038 (Closed) Sent incorrect RCPT TO commands to SMTP 
server


heh, why did you mention in the bug report that you fixed it in 
5.3.1-dev when you did fix it in all branches..? :)


--Jani



Changed paths:
 U   php/php-src/branches/PHP_5_2/NEWS
 U   php/php-src/branches/PHP_5_2/win32/sendmail.c
 U   php/php-src/branches/PHP_5_3/NEWS
 U   php/php-src/branches/PHP_5_3/win32/sendmail.c
 U   php/php-src/trunk/win32/sendmail.c





--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/win32/sendmail.c branches/PHP_5_3/NEWS branches/PHP_5_3/win32/sendmail.c trunk/win32/sendmail.c

2009-08-19 Thread Garrett Serack
I, uh... had a distracting day yesterday. :)

G

-Original Message-
From: Jani Taskinen [mailto:jani.taski...@iki.fi]
Sent: Wednesday, August 19, 2009 4:29 AM
To: Garrett Serack
Cc: php-cvs@lists.php.net
Subject: Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS 
branches/PHP_5_2/win32/sendmail.c branches/PHP_5_3/NEWS 
branches/PHP_5_3/win32/sendmail.c trunk/win32/sendmail.c

On 08/18/2009 09:58 PM, Garrett Serack wrote:
 garretts Tue, 18 Aug 2009 18:58:33 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=287462

 Log:
 - Fixed bug #28038 (Sent incorrect RCPT TO commands to SMTP server)

 Bug: http://bugs.php.net/28038 (Closed) Sent incorrect RCPT TO commands to 
 SMTP server

heh, why did you mention in the bug report that you fixed it in
5.3.1-dev when you did fix it in all branches..? :)

--Jani


 Changed paths:
  U   php/php-src/branches/PHP_5_2/NEWS
  U   php/php-src/branches/PHP_5_2/win32/sendmail.c
  U   php/php-src/branches/PHP_5_3/NEWS
  U   php/php-src/branches/PHP_5_3/win32/sendmail.c
  U   php/php-src/trunk/win32/sendmail.c






[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/win32/sendmail.c branches/PHP_5_3/NEWS branches/PHP_5_3/win32/sendmail.c trunk/win32/sendmail.c

2009-08-18 Thread Garrett Serack
garretts Tue, 18 Aug 2009 18:58:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=287462

Log:
- Fixed bug #28038 (Sent incorrect RCPT TO commands to SMTP server)

Bug: http://bugs.php.net/28038 (Closed) Sent incorrect RCPT TO commands to SMTP 
server
  
Changed paths:
U   php/php-src/branches/PHP_5_2/NEWS
U   php/php-src/branches/PHP_5_2/win32/sendmail.c
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/win32/sendmail.c
U   php/php-src/trunk/win32/sendmail.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===
--- php/php-src/branches/PHP_5_2/NEWS	2009-08-18 18:28:59 UTC (rev 287461)
+++ php/php-src/branches/PHP_5_2/NEWS	2009-08-18 18:58:33 UTC (rev 287462)
@@ -8,6 +8,7 @@
 - Fixed bug #49236 (Missing PHP_SUBST(PDO_MYSQL_SHARED_LIBADD)). (Jani)
 - Fixed bug #49144 (Import of schema from different host transmits original
   authentication details). (Dmitry)
+- Fixed bug #28038  (Sent incorrect RCPT TO commands to SMTP server) (Garrett)


 13 Aug 2009, PHP 5.2.11RC1

Modified: php/php-src/branches/PHP_5_2/win32/sendmail.c
===
--- php/php-src/branches/PHP_5_2/win32/sendmail.c	2009-08-18 18:28:59 UTC (rev 287461)
+++ php/php-src/branches/PHP_5_2/win32/sendmail.c	2009-08-18 18:58:33 UTC (rev 287462)
@@ -421,7 +421,7 @@
 	}

 	SMTP_SKIP_SPACE(RPath);
-	snprintf(Buffer, MAIL_BUFFER_SIZE, MAIL FROM:%s\r\n, RPath);
+	FormatEmailAddress(Buffer, RPath, MAIL FROM:%s\r\n);
 	if ((res = Post(Buffer)) != SUCCESS) {
 		return (res);
 	}
@@ -436,7 +436,7 @@
 	while (token != NULL)
 	{
 		SMTP_SKIP_SPACE(token);
-		snprintf(Buffer, MAIL_BUFFER_SIZE, RCPT TO:%s\r\n, token);
+		FormatEmailAddress(Buffer, token, RCPT TO:%s\r\n);
 		if ((res = Post(Buffer)) != SUCCESS) {
 			efree(tempMailTo);
 			return (res);
@@ -457,7 +457,7 @@
 		while (token != NULL)
 		{
 			SMTP_SKIP_SPACE(token);
-			snprintf(Buffer, MAIL_BUFFER_SIZE, RCPT TO:%s\r\n, token);
+			FormatEmailAddress(Buffer, token, RCPT TO:%s\r\n);
 			if ((res = Post(Buffer)) != SUCCESS) {
 efree(tempMailTo);
 return (res);
@@ -487,7 +487,7 @@
 		while (token != NULL)
 		{
 			SMTP_SKIP_SPACE(token);
-			snprintf(Buffer, MAIL_BUFFER_SIZE, RCPT TO:%s\r\n, token);
+			FormatEmailAddress(Buffer, token, RCPT TO:%s\r\n);
 			if ((res = Post(Buffer)) != SUCCESS) {
 efree(tempMailTo);
 return (res);
@@ -512,7 +512,7 @@
 		while (token != NULL)
 		{
 			SMTP_SKIP_SPACE(token);
-			snprintf(Buffer, MAIL_BUFFER_SIZE, RCPT TO:%s\r\n, token);
+			FormatEmailAddress(Buffer, token, RCPT TO:%s\r\n);
 			if ((res = Post(Buffer)) != SUCCESS) {
 efree(tempMailTo);
 return (res);
@@ -545,7 +545,7 @@
 			while (token != NULL)
 			{
 SMTP_SKIP_SPACE(token);
-snprintf(Buffer, MAIL_BUFFER_SIZE, RCPT TO:%s\r\n, token);
+FormatEmailAddress(Buffer, token, RCPT TO:%s\r\n);
 if ((res = Post(Buffer)) != SUCCESS) {
 	efree(tempMailTo);
 	return (res);
@@ -922,3 +922,30 @@
 	}
 	return (lAddr);
 } /* end GetAddr() */
+
+
+/*
+// Name:  int FormatEmailAddress
+// Input:
+// Output:
+// Description: Formats the email address to remove any content ouside
+//   of the angle brackets   as per RFC 2821.
+//
+//   Returns the invalidly formatted mail address if the   are
+//   unbalanced (the SMTP server should reject it if it's out of spec.)
+//
+// Author/Date:  garretts 08/18/2009
+// History:
+///
+int FormatEmailAddress(char* Buffer, char* EmailAddress, char* FormatString )  {
+	char *tmpAddress1, *tmpAddress2;
+	int result;
+
+	if( (tmpAddress1 = strchr(EmailAddress, ''))  (tmpAddress2 = strchr(tmpAddress1, ''))  ) {
+		*tmpAddress2 = 0; // terminate the string temporarily.
+		result = snprintf(Buffer, MAIL_BUFFER_SIZE, FormatString , tmpAddress1+1);
+		*tmpAddress2 = ''; // put it back the way it was.
+		return result;
+	}
+	return snprintf(Buffer, MAIL_BUFFER_SIZE , FormatString , EmailAddress );
+} /* end FormatEmailAddress() */

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2009-08-18 18:28:59 UTC (rev 287461)
+++ php/php-src/branches/PHP_5_3/NEWS	2009-08-18 18:58:33 UTC (rev 287462)
@@ -146,6 +146,7 @@
   com, Kalle)
 - Fixed bug #38091 (Mail() does not use FQDN when sending SMTP helo).
   (Kalle, Rick Yorgason)
+- Fixed bug #28038  (Sent incorrect RCPT TO commands to SMTP server) (Garrett)

 30 Jun 2009, PHP 5.3.0
 - Upgraded bundled PCRE to version 7.9. (Nuno)

Modified: php/php-src/branches/PHP_5_3/win32/sendmail.c
===
--- php/php-src/branches/PHP_5_3/win32/sendmail.c	2009-08-18 18:28:59 UTC (rev 287461)
+++