cvs: php-src(PHP_5_2) /ext/standard ftp_fopen_wrapper.c
| From: | Jani Taskinen | Date: | Sat, 29 Dec 2007 18:46:37 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/standard ftp_fopen_wrapper.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-47646@lists.php.net to get a copy of this message | ||
jani Sat Dec 29 18:46:37 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard ftp_fopen_wrapper.c
Log:
MFH:- This makes no sense with non-ipv6 builds. (and fixes lot of issues with misconfigured
servers)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.85.2.4.2.6&r2=1.85.2.4.2.7&diff_format=u
Index: php-src/ext/standard/ftp_fopen_wrapper.c
diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.6
php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.7
--- php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.6 Thu Oct 4 13:31:11 2007
+++ php-src/ext/standard/ftp_fopen_wrapper.c Sat Dec 29 18:46:37 2007
@@ -18,7 +18,7 @@
| Sara Golemon <pollita@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.6 2007/10/04 13:31:11 jani Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.7 2007/12/29 18:46:37 jani Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -300,19 +300,21 @@
/* {{{ php_fopen_do_pasv
*/
-static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, int ip_size, char
**phoststart TSRMLS_DC)
+static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char
**phoststart TSRMLS_DC)
{
char tmp_line[512];
int result, i;
unsigned short portno;
char *tpath, *ttpath, *hoststart=NULL;
+#ifdef HAVE_IPV6
/* We try EPSV first, needed for IPv6 and works on some IPv4 servers */
php_stream_write_string(stream, "EPSV\r\n");
result = GET_FTP_RESULT(stream);
/* check if we got a 229 response */
if (result != 229) {
+#endif
/* EPSV failed, let's try PASV */
php_stream_write_string(stream, "PASV\r\n");
result = GET_FTP_RESULT(stream);
@@ -357,6 +359,8 @@
tpath++;
/* pull out the LSB of the port */
portno += (unsigned short) strtoul(tpath, &ttpath, 10);
+
+#ifdef HAVE_IPV6
} else {
/* parse epsv command (|||6446|) */
for (i = 0, tpath = tmp_line + 4; *tpath; tpath++) {
@@ -372,7 +376,8 @@
/* pull out the port */
portno = (unsigned short) strtoul(tpath + 1, &ttpath, 10);
}
-
+#endif
+
if (ttpath == NULL) {
/* didn't get correct response from EPSV/PASV */
return 0;