iliaa           Tue Oct 11 10:41:43 2005 EDT

  Modified files:              (Branch: PHP_4_4)
    /php-src/ext/standard       ftp_fopen_wrapper.c 
    /php-src    NEWS 
  Log:
  MFH: Fixed bug #34742 (ftp wrapper failures caused from segmented command 
  transfer).
  
  
http://cvs.php.net/diff.php/php-src/ext/standard/ftp_fopen_wrapper.c?r1=1.38.2.8.2.2&r2=1.38.2.8.2.3&ty=u
Index: php-src/ext/standard/ftp_fopen_wrapper.c
diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.38.2.8.2.2 
php-src/ext/standard/ftp_fopen_wrapper.c:1.38.2.8.2.3
--- php-src/ext/standard/ftp_fopen_wrapper.c:1.38.2.8.2.2       Tue Jul 26 
05:32:58 2005
+++ php-src/ext/standard/ftp_fopen_wrapper.c    Tue Oct 11 10:41:39 2005
@@ -17,7 +17,7 @@
    |          Hartmut Holzgraefe <[EMAIL PROTECTED]>                       |
    +----------------------------------------------------------------------+
  */
-/* $Id: ftp_fopen_wrapper.c,v 1.38.2.8.2.2 2005/07/26 09:32:58 hyanantha Exp $ 
*/
+/* $Id: ftp_fopen_wrapper.c,v 1.38.2.8.2.3 2005/10/11 14:41:39 iliaa Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -246,18 +246,16 @@
 }
 
        /* send the user name */
-       php_stream_write_string(stream, "USER ");
        if (resource->user != NULL) {
                unsigned char *s, *e;
                tmp_len = php_raw_url_decode(resource->user, 
strlen(resource->user));
                
                PHP_FTP_CNTRL_CHK(resource->user, tmp_len, "Invalid login %s")
                
-               php_stream_write_string(stream, resource->user);
+               php_stream_printf(stream, TSRMLS_CC, "USER %s\r\n", 
resource->user);
        } else {
-               php_stream_write_string(stream, "anonymous");
+               php_stream_write_string(stream, "USER anonymous\r\n");
        }
-       php_stream_write_string(stream, "\r\n");
        
        /* get the response */
        result = GET_FTP_RESULT(stream);
@@ -266,23 +264,21 @@
        if (result >= 300 && result <= 399) {
                php_stream_notify_info(context, 
PHP_STREAM_NOTIFY_AUTH_REQUIRED, tmp_line, 0);
 
-               php_stream_write_string(stream, "PASS ");
                if (resource->pass != NULL) {
                        tmp_len = php_raw_url_decode(resource->pass, 
strlen(resource->pass));
                        
                        PHP_FTP_CNTRL_CHK(resource->pass, tmp_len, "Invalid 
password %s")
                        
-                       php_stream_write_string(stream, resource->pass);
+                       php_stream_printf(stream, TSRMLS_CC, "PASS %s\r\n", 
resource->pass);
                } else {
                        /* if the user has configured who they are,
                           send that as the password */
                        if (cfg_get_string("from", &scratch) == SUCCESS) {
-                               php_stream_write_string(stream, scratch);
+                               php_stream_printf(stream, TSRMLS_CC, "PASS 
%s\r\n", scratch);
                        } else {
-                               php_stream_write_string(stream, "anonymous");
+                               php_stream_write_string(stream, "PASS 
anonymous\r\n");
                        }
                }
-               php_stream_write_string(stream, "\r\n");
                
                /* read the response */
                result = GET_FTP_RESULT(stream);
@@ -303,9 +299,7 @@
                goto errexit;
        
        /* find out the size of the file (verifying it exists) */
-       php_stream_write_string(stream, "SIZE ");
-       php_stream_write_string(stream, resource->path);
-       php_stream_write_string(stream, "\r\n");
+       php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n", resource->path);
        
        /* read the response */
        result = GET_FTP_RESULT(stream);
@@ -400,19 +394,7 @@
                goto errexit;
        }
        
-       if (mode[0] == 'r') {
-               /* retrieve file */
-               php_stream_write_string(stream, "RETR ");
-       } else {
-               /* store file */
-               php_stream_write_string(stream, "STOR ");
-       } 
-       if (resource->path != NULL) {
-               php_stream_write_string(stream, resource->path);
-       } else {
-               php_stream_write_string(stream, "/");
-       }
-       php_stream_write_string(stream, "\r\n");
+       php_stream_printf(stream, TSRMLS_CC, "%s %s\r\n", (mode[0] == 'r' ? 
"RETR" : "STOR"), (resource->path != NULL ? resource->path : "/"));
        
        /* open the data channel */
        if (hoststart == NULL) {
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.920.2.54&r2=1.1247.2.920.2.55&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.54 php-src/NEWS:1.1247.2.920.2.55
--- php-src/NEWS:1.1247.2.920.2.54      Tue Oct 11 02:48:31 2005
+++ php-src/NEWS        Tue Oct 11 10:41:41 2005
@@ -3,6 +3,8 @@
 ?? Oct 2005, Version 4.4.1
 - Fixed bug #34790 (preg_match_all(), named capturing groups, variable
   assignment/return => crash). (Dmitry)
+- Fixed bug #34742 (ftp wrapper failures caused from segmented command 
+  transfer). (Ilia)
 - Fixed bug #34704 (Infinite recursion due to corrupt JPEG). (Marcus)
 - Fixed bug #33383 (crash when retrieving empty LOBs). (Tony)
        

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

Reply via email to