[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard ftp_fopen_wrapper.c
felipe Fri Jul 11 18:28:26 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard ftp_fopen_wrapper.c Log: - Fixed bug #45449 (filesize() regression using ftp wrapper) (patch by crrodriguez at suse dot de) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.85.2.4.2.9r2=1.85.2.4.2.10diff_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.9 php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.10 --- php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.9 Tue Jan 8 19:10:16 2008 +++ php-src/ext/standard/ftp_fopen_wrapper.cFri Jul 11 18:28:25 2008 @@ -18,7 +18,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.9 2008/01/08 19:10:16 iliaa Exp $ */ +/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.10 2008/07/11 18:28:25 felipe Exp $ */ #include php.h #include php_globals.h @@ -777,6 +777,13 @@ } php_stream_write_string(stream, TYPE I\r\n); /* we need this since some servers refuse to accept SIZE command in ASCII mode */ + + result = GET_FTP_RESULT(stream); + + if(result 200 || result 299) { + goto stat_errexit; + } + php_stream_printf(stream TSRMLS_CC, SIZE %s\r\n, (resource-path != NULL ? resource-path : /)); result = GET_FTP_RESULT(stream); if (result 200 || result 299) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard ftp_fopen_wrapper.c
janiSat 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.6r2=1.85.2.4.2.7diff_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.cSat Dec 29 18:46:37 2007 @@ -18,7 +18,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $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; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard ftp_fopen_wrapper.c
janiThu Sep 27 13:15:09 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard ftp_fopen_wrapper.c Log: ws + cs fixes http://cvs.php.net/viewvc.cgi/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.85.2.4.2.4r2=1.85.2.4.2.5diff_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.4 php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.5 --- php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.4 Fri Sep 21 12:57:38 2007 +++ php-src/ext/standard/ftp_fopen_wrapper.cThu Sep 27 13:15:09 2007 @@ -18,7 +18,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.4 2007/09/21 12:57:38 tony2001 Exp $ */ +/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.5 2007/09/27 13:15:09 jani Exp $ */ #include php.h #include php_globals.h @@ -69,7 +69,11 @@ #include php_fopen_wrappers.h +#define FTPS_ENCRYPT_DATA 1 +#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC) +/* {{{ get_ftp_result + */ static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC) { while (php_stream_gets(stream, buffer, buffer_size-1) @@ -77,24 +81,21 @@ isdigit((int) buffer[2]) buffer[3] == ' ')); return strtol(buffer, NULL, 10); } -#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC) - -#define FTPS_ENCRYPT_DATA 1 +/* }}} */ -static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, - php_stream *stream, - php_stream_statbuf *ssb - TSRMLS_DC) +/* {{{ php_stream_ftp_stream_stat + */ +static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) { /* For now, we return with a failure code to prevent the underlying * file's details from being used instead. */ return -1; } +/* }}} */ - -static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, - php_stream *stream - TSRMLS_DC) +/* {{{ php_stream_ftp_stream_close + */ +static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC) { php_stream *controlstream = (php_stream *)stream-wrapperdata; @@ -105,6 +106,7 @@ } return 0; } +/* }}} */ /* {{{ php_ftp_fopen_connect */ @@ -564,7 +566,7 @@ php_url_free(resource); return datastream; - errexit: +errexit: if (resource) { php_url_free(resource); } @@ -728,7 +730,7 @@ php_url_free(resource); return php_stream_alloc(php_ftp_dirstream_ops, datastream, 0, mode); - opendir_errexit: +opendir_errexit: if (resource) { php_url_free(resource); } @@ -828,7 +830,7 @@ #endif } else { /* error or unsupported command */ - mdtm_error: +mdtm_error: #ifdef NETWARE ssb-sb.st_mtime.tv_sec = -1; #else @@ -860,7 +862,7 @@ php_url_free(resource); return 0; - stat_errexit: +stat_errexit: if (resource) { php_url_free(resource); } @@ -910,7 +912,7 @@ php_stream_close(stream); return 1; - unlink_errexit: +unlink_errexit: if (resource) { php_url_free(resource); } @@ -986,7 +988,7 @@ php_stream_close(stream); return 1; - rename_errexit: +rename_errexit: if (resource_from) { php_url_free(resource_from); } @@ -1083,7 +1085,7 @@ return 1; - mkdir_errexit: +mkdir_errexit: if (resource) { php_url_free(resource); } @@ -1133,7 +1135,7 @@ return 1; - rmdir_errexit: +rmdir_errexit: if (resource) { php_url_free(resource); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard ftp_fopen_wrapper.c
tony2001Fri Sep 21 12:57:38 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard ftp_fopen_wrapper.c Log: MFH: fix invalid read when opendir over FTP fails (coverity issue #462) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.85.2.4.2.3r2=1.85.2.4.2.4diff_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.3 php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.4 --- php-src/ext/standard/ftp_fopen_wrapper.c:1.85.2.4.2.3 Fri Aug 31 07:42:00 2007 +++ php-src/ext/standard/ftp_fopen_wrapper.cFri Sep 21 12:57:38 2007 @@ -18,7 +18,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.3 2007/08/31 07:42:00 jani Exp $ */ +/* $Id: ftp_fopen_wrapper.c,v 1.85.2.4.2.4 2007/09/21 12:57:38 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -669,6 +669,8 @@ char ip[sizeof(123.123.123.123)]; unsigned short portno; + tmp_line[0] = '\0'; + stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, reuseid, resource, use_ssl, use_ssl_on_data TSRMLS_CC); if (!stream) { goto opendir_errexit; @@ -734,8 +736,9 @@ php_stream_notify_error(context, PHP_STREAM_NOTIFY_FAILURE, tmp_line, result); php_stream_close(stream); } - if (tmp_line[0] != '\0') + if (tmp_line[0] != '\0') { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, FTP server reports %s, tmp_line); + } return NULL; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php