pollita         Mon Sep  8 18:32:34 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/ftp    php_ftp.c 
  Log:
  Bug #25314 ASCII mode transfers behaving like binary when initiated from windows.
  
Index: php-src/ext/ftp/php_ftp.c
diff -u php-src/ext/ftp/php_ftp.c:1.74.2.12 php-src/ext/ftp/php_ftp.c:1.74.2.13
--- php-src/ext/ftp/php_ftp.c:1.74.2.12 Thu Aug 28 15:18:55 2003
+++ php-src/ext/ftp/php_ftp.c   Mon Sep  8 18:32:33 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_ftp.c,v 1.74.2.12 2003/08/28 19:18:55 iliaa Exp $ */
+/* $Id: php_ftp.c,v 1.74.2.13 2003/09/08 22:32:33 pollita Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -603,15 +603,15 @@
        }
 
        if (ftp->autoseek && resumepos) {
-               if (PG(safe_mode) && (!php_checkuid(local, "rb+", 
CHECKUID_CHECK_MODE_PARAM))) {
+               if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? 
"rt+" : "rb+", CHECKUID_CHECK_MODE_PARAM))) {
                        RETURN_FALSE;
                }
-               outstream = php_stream_fopen(local, "rb+", NULL);
+               outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt+" : 
"rb+", NULL);
                if (outstream == NULL) {
-                       if (PG(safe_mode) && (!php_checkuid(local, "wb", 
CHECKUID_CHECK_MODE_PARAM))) {
+                       if (PG(safe_mode) && (!php_checkuid(local, mode == 
FTPTYPE_ASCII ? "wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
                                RETURN_FALSE;
                        }
-                       outstream = php_stream_fopen(local, "wb", NULL);
+                       outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? 
"wt" : "wb", NULL);
                }
                if (outstream != NULL) {
                        /* if autoresume is wanted seek to end */
@@ -623,10 +623,10 @@
                        }
                }
        } else {
-               if (PG(safe_mode) && (!php_checkuid(local, "wb", 
CHECKUID_CHECK_MODE_PARAM))) {
+               if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? 
"wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
                        RETURN_FALSE;
                }
-               outstream = php_stream_fopen(local, "wb", NULL);
+               outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "wt" : 
"wb", NULL);
        }
 
        if (outstream == NULL)  {
@@ -674,15 +674,15 @@
        }
 
        if (ftp->autoseek && resumepos) {
-               if (PG(safe_mode) && (!php_checkuid(local, "rb+", 
CHECKUID_CHECK_MODE_PARAM))) {
+               if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? 
"rt+" : "rb+", CHECKUID_CHECK_MODE_PARAM))) {
                        RETURN_FALSE;
                }
-               outstream = php_stream_fopen(local, "rb+", NULL);
+               outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt+" : 
"rb+", NULL);
                if (outstream == NULL) {
-                       if (PG(safe_mode) && (!php_checkuid(local, "wb", 
CHECKUID_CHECK_MODE_PARAM))) {
+                       if (PG(safe_mode) && (!php_checkuid(local, mode == 
FTPTYPE_ASCII ? "wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
                                RETURN_FALSE;
                        }
-                       outstream = php_stream_fopen(local, "wb", NULL);
+                       outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? 
"wt" : "wb", NULL);
                }
                if (outstream != NULL) {
                        /* if autoresume is wanted seek to end */
@@ -694,10 +694,10 @@
                        }
                }
        } else {
-               if (PG(safe_mode) && (!php_checkuid(local, "wb", 
CHECKUID_CHECK_MODE_PARAM))) {
+               if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? 
"wt" : "wb", CHECKUID_CHECK_MODE_PARAM))) {
                        RETURN_FALSE;
                }
-               outstream = php_stream_fopen(local, "wb", NULL);
+               outstream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "wt" : 
"wb", NULL);
        }
 
        if (outstream == NULL)  {
@@ -881,11 +881,11 @@
        if (php_check_open_basedir(local TSRMLS_CC)) {
                RETURN_FALSE;
        }
-       if (PG(safe_mode) && (!php_checkuid(local, "rb", CHECKUID_CHECK_MODE_PARAM))) {
+       if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "rt" : 
"rb", CHECKUID_CHECK_MODE_PARAM))) {
                RETURN_FALSE;
        }
 
-       instream = php_stream_fopen(local, "rb", NULL);
+       instream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt" : "rb", NULL);
 
        if (instream == NULL)   {
                RETURN_FALSE;
@@ -943,11 +943,11 @@
        if (php_check_open_basedir(local TSRMLS_CC)) {
                RETURN_FALSE;
        }
-       if (PG(safe_mode) && (!php_checkuid(local, "rb", CHECKUID_CHECK_MODE_PARAM))) {
+       if (PG(safe_mode) && (!php_checkuid(local, mode == FTPTYPE_ASCII ? "rt" : 
"rb", CHECKUID_CHECK_MODE_PARAM))) {
                RETURN_FALSE;
        }
 
-       instream = php_stream_fopen(local, "rb", NULL);
+       instream = php_stream_fopen(local, mode == FTPTYPE_ASCII ? "rt" : "rb", NULL);
 
        if (instream == NULL)   {
                RETURN_FALSE;

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

Reply via email to