kalle Tue Jun 30 11:39:16 2009 UTC Modified files: (Branch: PHP_5_3) /php-src NEWS /php-src/win32 sendmail.c Log: MFH: Fixed bug #38091 (Mail() does not use FQDN when sending SMTP helo) # Note, this does not go in 5.2 because the inet ports for VC6 are not in that branch http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.656&r2=1.2027.2.547.2.965.2.657&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.656 php-src/NEWS:1.2027.2.547.2.965.2.657 --- php-src/NEWS:1.2027.2.547.2.965.2.656 Mon Jun 29 16:33:24 2009 +++ php-src/NEWS Tue Jun 30 11:39:15 2009 @@ -1,7 +1,10 @@ -PHP NEWS +PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2009, PHP 5.3.1 +- Fixed bug #38091 (Mail() does not use FQDN when sending SMTP helo). + (Kalle, Rick Yorgason) + 30 Jun 2009, PHP 5.3.0 - Upgraded bundled PCRE to version 7.9. (Nuno) http://cvs.php.net/viewvc.cgi/php-src/win32/sendmail.c?r1=1.65.2.2.2.1&r2=1.65.2.2.2.1.2.1&diff_format=u Index: php-src/win32/sendmail.c diff -u php-src/win32/sendmail.c:1.65.2.2.2.1 php-src/win32/sendmail.c:1.65.2.2.2.1.2.1 --- php-src/win32/sendmail.c:1.65.2.2.2.1 Sat Feb 24 02:17:28 2007 +++ php-src/win32/sendmail.c Tue Jun 30 11:39:15 2009 @@ -17,7 +17,7 @@ * */ -/* $Id: sendmail.c,v 1.65.2.2.2.1 2007/02/24 02:17:28 helly Exp $ */ +/* $Id: sendmail.c,v 1.65.2.2.2.1.2.1 2009/06/30 11:39:15 kalle Exp $ */ #include "php.h" /*php specific */ #include <stdio.h> @@ -37,6 +37,7 @@ #endif /* NETWARE */ #include "sendmail.h" #include "php_ini.h" +#include "inet.h" #if HAVE_PCRE || HAVE_BUNDLED_PCRE #include "ext/pcre/php_pcre.h" @@ -765,16 +766,52 @@ static int MailConnect() { - int res; + int res, namelen; short portnum; + struct hostent *ent; + IN_ADDR addr; +#ifdef HAVE_IPV6 + IN6_ADDR addr6; +#endif /* Create Socket */ - if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) + if ((sc = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { return (FAILED_TO_OBTAIN_SOCKET_HANDLE); + } /* Get our own host name */ - if (gethostname(LocalHost, HOST_NAME_LEN)) + if (gethostname(LocalHost, HOST_NAME_LEN)) { + return (FAILED_TO_GET_HOSTNAME); + } + + ent = gethostbyname(LocalHost); + + if (!ent) { return (FAILED_TO_GET_HOSTNAME); + } + + namelen = strlen(ent->h_name); + +#ifdef HAVE_IPV6 + if (inet_pton(AF_INET, ent->h_name, &addr) == 1 || inet_pton(AF_INET6, ent->h_name, &addr6) == 1) +#else + if (inet_pton(AF_INET, ent->h_name, &addr) == 1) +#endif + { + if (namelen + 2 >= HOST_NAME_LEN) { + return (FAILED_TO_GET_HOSTNAME); + } + + strcpy(LocalHost, "["); + strcpy(LocalHost + 1, ent->h_name); + strcpy(LocalHost + namelen + 1, "]"); + } else { + if (namelen >= HOST_NAME_LEN) { + return (FAILED_TO_GET_HOSTNAME); + } + + strcpy(LocalHost, ent->h_name); + } /* Resolve the servers IP */ /* @@ -794,8 +831,9 @@ sock_in.sin_port = htons(portnum); sock_in.sin_addr.S_un.S_addr = GetAddr(MailHost); - if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in))) + if (connect(sc, (LPSOCKADDR) & sock_in, sizeof(sock_in))) { return (FAILED_TO_CONNECT); + } /* receive Server welcome message */ res = Ack(NULL);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php