[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2008-04-13 Thread Greg Beaver
cellog  Sun Apr 13 22:19:23 2008 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  MFB do not scan include_path with faulty plain_wrapper-based include_path 
fopen
  
  # _fopen_with_path_rel probably needs to call out to regular php_stream_open, 
for exts that use it (it is exported)
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.94r2=1.95diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.94 
php-src/main/streams/plain_wrapper.c:1.95
--- php-src/main/streams/plain_wrapper.c:1.94   Thu Mar 27 10:33:52 2008
+++ php-src/main/streams/plain_wrapper.cSun Apr 13 22:19:23 2008
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.94 2008/03/27 10:33:52 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.95 2008/04/13 22:19:23 cellog Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -976,10 +976,6 @@
 static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, 
char *path, char *mode,
int options, char **opened_path, php_stream_context *context 
STREAMS_DC TSRMLS_DC)
 {
-   if ((options  USE_PATH)  PG(include_path) != NULL) {
-   return php_stream_fopen_with_path_rel(path, mode, 
PG(include_path), opened_path, options);
-   }
-
if (((options  STREAM_DISABLE_OPEN_BASEDIR) == 0)  
php_check_open_basedir(path TSRMLS_CC)) {
return NULL;
}



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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-11-01 Thread Jani Taskinen
janiThu Nov  1 17:32:10 2007 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  - Nuke unused variables
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.91r2=1.92diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.91 
php-src/main/streams/plain_wrapper.c:1.92
--- php-src/main/streams/plain_wrapper.c:1.91   Wed Oct 31 13:22:18 2007
+++ php-src/main/streams/plain_wrapper.cThu Nov  1 17:32:10 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.91 2007/10/31 13:22:18 jani Exp $ */
+/* $Id: plain_wrapper.c,v 1.92 2007/11/01 17:32:10 jani Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1006,8 +1006,6 @@
 {
char *p;
int ret;
-   zval funcname;
-   zval *retval = NULL;
 
if ((p = strstr(url, ://)) != NULL) {
url = p + 3;

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



Re: [PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-07-11 Thread Antony Dovgal

MFH ?

On 11.07.2007 00:13, Sascha Schumann wrote:

sas Tue Jul 10 20:13:29 2007 UTC

  Modified files:  
/php-src/main/streams	plain_wrapper.c 
  Log:

  - fix concurrent reader/writer use case
(we read, while the other process writes - if we don't try
 read we won't notice that the file has been growing.)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.88r2=1.89diff_format=u

Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.88 
php-src/main/streams/plain_wrapper.c:1.89
--- php-src/main/streams/plain_wrapper.c:1.88   Mon May 28 23:00:24 2007
+++ php-src/main/streams/plain_wrapper.cTue Jul 10 20:13:29 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.88 2007/05/28 23:00:24 iliaa Exp $ */

+/* $Id: plain_wrapper.c,v 1.89 2007/07/10 20:13:29 sas Exp $ */
 
 #include php.h

 #include php_globals.h
@@ -333,9 +333,6 @@
assert(data != NULL);
 
 	if (data-fd = 0) {

-   if (stream-eof  !data-is_pipe) {
-   return 0;
-   }
ret = read(data-fd, buf, count);
 
 		if (ret == (size_t)-1  errno == EINTR) {





--
Wbr, 
Antony Dovgal


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



Re: [PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-07-11 Thread Derick Rethans
On Wed, 11 Jul 2007, Antony Dovgal wrote:

 MFH ?

Test case?

Derick

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



Re: [PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-07-11 Thread Jani Taskinen
Shouldn't this be MFH'd??

--Jani

On Tue, 2007-07-10 at 20:13 +, Sascha Schumann wrote:
 sas   Tue Jul 10 20:13:29 2007 UTC
 
   Modified files:  
 /php-src/main/streams plain_wrapper.c 
   Log:
   - fix concurrent reader/writer use case
 (we read, while the other process writes - if we don't try
  read we won't notice that the file has been growing.)
   
   
 http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.88r2=1.89diff_format=u
 Index: php-src/main/streams/plain_wrapper.c
 diff -u php-src/main/streams/plain_wrapper.c:1.88 
 php-src/main/streams/plain_wrapper.c:1.89
 --- php-src/main/streams/plain_wrapper.c:1.88 Mon May 28 23:00:24 2007
 +++ php-src/main/streams/plain_wrapper.c  Tue Jul 10 20:13:29 2007
 @@ -16,7 +16,7 @@
 +--+
   */
  
 -/* $Id: plain_wrapper.c,v 1.88 2007/05/28 23:00:24 iliaa Exp $ */
 +/* $Id: plain_wrapper.c,v 1.89 2007/07/10 20:13:29 sas Exp $ */
  
  #include php.h
  #include php_globals.h
 @@ -333,9 +333,6 @@
   assert(data != NULL);
  
   if (data-fd = 0) {
 - if (stream-eof  !data-is_pipe) {
 - return 0;
 - }
   ret = read(data-fd, buf, count);
  
   if (ret == (size_t)-1  errno == EINTR) {
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-07-10 Thread Sascha Schumann
sas Tue Jul 10 20:13:29 2007 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  - fix concurrent reader/writer use case
(we read, while the other process writes - if we don't try
 read we won't notice that the file has been growing.)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.88r2=1.89diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.88 
php-src/main/streams/plain_wrapper.c:1.89
--- php-src/main/streams/plain_wrapper.c:1.88   Mon May 28 23:00:24 2007
+++ php-src/main/streams/plain_wrapper.cTue Jul 10 20:13:29 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.88 2007/05/28 23:00:24 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.89 2007/07/10 20:13:29 sas Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -333,9 +333,6 @@
assert(data != NULL);
 
if (data-fd = 0) {
-   if (stream-eof  !data-is_pipe) {
-   return 0;
-   }
ret = read(data-fd, buf, count);
 
if (ret == (size_t)-1  errno == EINTR) {

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-04-18 Thread Dmitry Stogov
dmitry  Wed Apr 18 13:53:32 2007 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Fixed crash
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.85r2=1.86diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.85 
php-src/main/streams/plain_wrapper.c:1.86
--- php-src/main/streams/plain_wrapper.c:1.85   Mon Apr 16 09:43:52 2007
+++ php-src/main/streams/plain_wrapper.cWed Apr 18 13:53:32 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.85 2007/04/16 09:43:52 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.86 2007/04/18 13:53:32 dmitry Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -718,8 +718,16 @@
return 
PHP_STREAM_OPTION_RETURN_ERR;
}
 
-   if (range-length == 0) {
-   range-length = 
GetFileSize(hfile, NULL) - range-offset;
+   size = GetFileSize(hfile, NULL);
+   if (range-length == 0  
range-offset  0  range-offset  size) {
+   range-length = size - 
range-offset;
+   }
+   if (range-length == 0 || 
range-length  size) {
+   range-length = size;
+   }
+   if (range-offset = size) {
+   range-offset = size;
+   range-length = 0;
}
 
/* figure out how big a chunk 
to map to be able to view the part that we need */

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-04-18 Thread Dmitry Stogov
dmitry  Wed Apr 18 14:23:35 2007 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Fixed crash on win32 in case of negative size
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.86r2=1.87diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.86 
php-src/main/streams/plain_wrapper.c:1.87
--- php-src/main/streams/plain_wrapper.c:1.86   Wed Apr 18 13:53:32 2007
+++ php-src/main/streams/plain_wrapper.cWed Apr 18 14:23:35 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.86 2007/04/18 13:53:32 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.87 2007/04/18 14:23:35 dmitry Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -777,8 +777,13 @@
case PHP_STREAM_TRUNCATE_SUPPORTED:
return fd == -1 ? 
PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
 
-   case PHP_STREAM_TRUNCATE_SET_SIZE:
-   return ftruncate(fd, 
*(ptrdiff_t*)ptrparam) == 0 ? PHP_STREAM_OPTION_RETURN_OK : 
PHP_STREAM_OPTION_RETURN_ERR;
+   case PHP_STREAM_TRUNCATE_SET_SIZE: {
+   ptrdiff_t new_size = 
*(ptrdiff_t*)ptrparam;
+   if (new_size  0) {
+   return 
PHP_STREAM_OPTION_RETURN_ERR;
+   }
+   return ftruncate(fd, new_size) == 0 ? 
PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
+   }
}

default:

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2007-04-09 Thread Dmitry Stogov
dmitry  Mon Apr  9 15:38:21 2007 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Fixed 64-bit support
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.83r2=1.84diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.83 
php-src/main/streams/plain_wrapper.c:1.84
--- php-src/main/streams/plain_wrapper.c:1.83   Sat Mar  3 20:41:12 2007
+++ php-src/main/streams/plain_wrapper.cMon Apr  9 15:38:21 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.83 2007/03/03 20:41:12 helly Exp $ */
+/* $Id: plain_wrapper.c,v 1.84 2007/04/09 15:38:21 dmitry Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1266,7 +1266,7 @@

 #ifdef PHP_WIN32
if (IS_SLASH(filename[0])) {
-   int cwd_len;
+   size_t cwd_len;
char *cwd;
cwd = virtual_getcwd_ex(cwd_len TSRMLS_CC);
/* getcwd() will return always return [DRIVE_LETTER]:/) on 
windows. */

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-11-10 Thread Dmitry Stogov
dmitry  Fri Nov 10 13:10:28 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Disabled reading from stream (calls to read()) after EOF
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.75r2=1.76diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.75 
php-src/main/streams/plain_wrapper.c:1.76
--- php-src/main/streams/plain_wrapper.c:1.75   Fri Nov 10 10:55:43 2006
+++ php-src/main/streams/plain_wrapper.cFri Nov 10 13:10:28 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.75 2006/11/10 10:55:43 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.76 2006/11/10 13:10:28 dmitry Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -316,6 +316,9 @@
assert(data != NULL);
 
if (data-fd = 0) {
+   if (stream-eof  !data-is_pipe) {
+   return 0;
+   }
ret = read(data-fd, buf, count);

stream-eof = (ret == 0 || (ret == (size_t)-1  errno != 
EWOULDBLOCK));



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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-11-10 Thread Dmitry Stogov
dmitry  Fri Nov 10 13:18:47 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Removed unnecessary ftell() calls (one call for each included PHP file)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.76r2=1.77diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.76 
php-src/main/streams/plain_wrapper.c:1.77
--- php-src/main/streams/plain_wrapper.c:1.76   Fri Nov 10 13:10:28 2006
+++ php-src/main/streams/plain_wrapper.cFri Nov 10 13:18:46 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.76 2006/11/10 13:10:28 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.77 2006/11/10 13:18:46 dmitry Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -39,6 +39,11 @@
 
 #include php_streams_int.h
 
+#define php_stream_fopen_from_fd_int(fd, mode, persistent_id)  
_php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC 
TSRMLS_CC)
+#define php_stream_fopen_from_fd_int_rel(fd, mode, persistent_id)   
_php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_REL_CC 
TSRMLS_CC)
+#define php_stream_fopen_from_file_int(file, mode) 
_php_stream_fopen_from_file_int((file), (mode) STREAMS_CC TSRMLS_CC)
+#define php_stream_fopen_from_file_int_rel(file, mode)  
_php_stream_fopen_from_file_int((file), (mode) STREAMS_REL_CC TSRMLS_CC)
+
 /* parse standard fopen modes into open() flags */
 PHPAPI int php_stream_parse_fopen_modes(const char *mode, int *open_flags)
 {
@@ -128,12 +133,44 @@
return 0;
 }
 
+static php_stream *_php_stream_fopen_from_fd_int(int fd, const char *mode, 
const char *persistent_id STREAMS_DC TSRMLS_DC)
+{
+   php_stdio_stream_data *self;
+   
+   self = pemalloc_rel_orig(sizeof(*self), persistent_id);
+   memset(self, 0, sizeof(*self));
+   self-file = NULL;
+   self-is_pipe = 0;
+   self-lock_flag = LOCK_UN;
+   self-is_process_pipe = 0;
+   self-temp_file_name = NULL;
+   self-fd = fd;
+   
+   return php_stream_alloc_rel(php_stream_stdio_ops, self, persistent_id, 
mode);
+}
+
+static php_stream *_php_stream_fopen_from_file_int(FILE *file, const char 
*mode STREAMS_DC TSRMLS_DC)
+{
+   php_stdio_stream_data *self;
+   
+   self = emalloc_rel_orig(sizeof(*self));
+   memset(self, 0, sizeof(*self));
+   self-file = file;
+   self-is_pipe = 0;
+   self-lock_flag = LOCK_UN;
+   self-is_process_pipe = 0;
+   self-temp_file_name = NULL;
+   self-fd = fileno(file);
+
+   return php_stream_alloc_rel(php_stream_stdio_ops, self, 0, mode);
+}
+
 PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const 
char *pfx, char **opened_path STREAMS_DC TSRMLS_DC)
 {
int fd = php_open_temporary_fd(dir, pfx, opened_path TSRMLS_CC);
 
if (fd != -1)   {
-   php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b, 
NULL);
+   php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, 
r+b, NULL);
if (stream) {
return stream;
}
@@ -152,7 +189,7 @@
int fd = php_open_temporary_fd(NULL, php, opened_path TSRMLS_CC);
 
if (fd != -1)   {
-   php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b, 
NULL);
+   php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, 
r+b, NULL);
if (stream) {
php_stdio_stream_data *self = 
(php_stdio_stream_data*)stream-abstract;
stream-wrapper = php_plain_files_wrapper;
@@ -174,36 +211,26 @@
 
 PHPAPI php_stream *_php_stream_fopen_from_fd(int fd, const char *mode, const 
char *persistent_id STREAMS_DC TSRMLS_DC)
 {
-   php_stdio_stream_data *self;
-   php_stream *stream;
-   
-   self = pemalloc_rel_orig(sizeof(*self), persistent_id);
-   memset(self, 0, sizeof(*self));
-   self-file = NULL;
-   self-is_pipe = 0;
-   self-lock_flag = LOCK_UN;
-   self-is_process_pipe = 0;
-   self-temp_file_name = NULL;
-   self-fd = fd;
+   php_stream *stream = php_stream_fopen_from_fd_int_rel(fd, mode, 
persistent_id);
+
+   if (stream) {
+   php_stdio_stream_data *self = 
(php_stdio_stream_data*)stream-abstract;
 
 #ifdef S_ISFIFO
-   /* detect if this is a pipe */
-   if (self-fd = 0) {
-   self-is_pipe = (do_fstat(self, 0) == 0  
S_ISFIFO(self-sb.st_mode)) ? 1 : 0;
-   }
+   /* detect if this is a pipe */
+   if (self-fd = 0) {
+   self-is_pipe = (do_fstat(self, 0) == 0  
S_ISFIFO(self-sb.st_mode)) ? 1 : 0;
+   }
 #elif defined(PHP_WIN32)
-   {
-   long handle = _get_osfhandle(self-fd);
+   {
+   long handle = _get_osfhandle(self-fd);
 
-   if 

[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-09-28 Thread Dmitry Stogov
dmitry  Thu Sep 28 07:26:19 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Fixed wrong pipe detection code
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.71r2=1.72diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.71 
php-src/main/streams/plain_wrapper.c:1.72
--- php-src/main/streams/plain_wrapper.c:1.71   Sun Sep 24 20:33:14 2006
+++ php-src/main/streams/plain_wrapper.cThu Sep 28 07:26:19 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.71 2006/09/24 20:33:14 pollita Exp $ */
+/* $Id: plain_wrapper.c,v 1.72 2006/09/28 07:26:19 dmitry Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -243,10 +243,9 @@
 #elif defined(PHP_WIN32)
{
long handle = _get_osfhandle(self-fd);
-   DWORD in_buf_size, out_buf_size;
 
if (handle != 0x) {
-   self-is_pipe = GetNamedPipeInfo((HANDLE)handle, NULL, 
out_buf_size, in_buf_size, NULL);
+   self-is_pipe = GetFileType((HANDLE)handle) == 
FILE_TYPE_PIPE;
}
}
 #endif

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-09-12 Thread Ilia Alshanetsky
iliaa   Tue Sep 12 15:49:03 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  MFB: Fixed bug #37779 (empty include_path leads to search for files 
  inside /).
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.69r2=1.70diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.69 
php-src/main/streams/plain_wrapper.c:1.70
--- php-src/main/streams/plain_wrapper.c:1.69   Mon Aug 28 17:14:13 2006
+++ php-src/main/streams/plain_wrapper.cTue Sep 12 15:49:02 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.69 2006/08/28 17:14:13 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.70 2006/09/12 15:49:02 iliaa Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1262,11 +1262,13 @@
*end = '\0';
end++;
}
+   if (*ptr == '\0') {
+   goto stream_skip;
+   }
snprintf(trypath, MAXPATHLEN, %s/%s, ptr, filename);
 
if (((options  STREAM_DISABLE_OPEN_BASEDIR) == 0)  
php_check_open_basedir_ex(trypath, 0 TSRMLS_CC)) {
-   ptr = end;
-   continue;
+   goto stream_skip;
}

stream = php_stream_fopen_rel(trypath, mode, opened_path, 
options);
@@ -1275,6 +1277,7 @@
efree(pathbuf);
return stream;
}
+stream_skip:
ptr = end;
} /* end provided path */
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-08-28 Thread Antony Dovgal
tony2001Mon Aug 28 17:14:13 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  fix #38199 (fclose() unable to close STDOUT and STDERR)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.68r2=1.69diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.68 
php-src/main/streams/plain_wrapper.c:1.69
--- php-src/main/streams/plain_wrapper.c:1.68   Tue Aug 22 06:15:45 2006
+++ php-src/main/streams/plain_wrapper.cMon Aug 28 17:14:13 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.68 2006/08/22 06:15:45 dmitry Exp $ */
+/* $Id: plain_wrapper.c,v 1.69 2006/08/28 17:14:13 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -373,7 +373,7 @@
data-file = NULL;
}
} else if (data-fd != -1) {
-#ifdef PHP_DEBUG
+#if PHP_DEBUG
if ((data-fd == 1 || data-fd == 2)  0 == 
strcmp(sapi_module.name, cli)) {
/* don't close stdout or stderr in CLI in DEBUG 
mode, as we want to see any leaks */
ret = 0;

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-08-22 Thread Dmitry Stogov
dmitry  Tue Aug 22 06:15:45 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Fixed bug #38488 (Access to php://stdin and family crashes PHP on win32)
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/streams/plain_wrapper.c?r1=1.67r2=1.68diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.67 
php-src/main/streams/plain_wrapper.c:1.68
--- php-src/main/streams/plain_wrapper.c:1.67   Mon Jun  5 22:39:10 2006
+++ php-src/main/streams/plain_wrapper.cTue Aug 22 06:15:45 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.67 2006/06/05 22:39:10 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.68 2006/08/22 06:15:45 dmitry Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -194,10 +194,9 @@
 #elif defined(PHP_WIN32)
{
long handle = _get_osfhandle(self-fd);
-   DWORD in_buf_size, out_buf_size;
 
if (handle != 0x) {
-   self-is_pipe = GetNamedPipeInfo((HANDLE)handle, NULL, 
out_buf_size, in_buf_size, NULL);
+   self-is_pipe = GetFileType((HANDLE)handle) == 
FILE_TYPE_PIPE;
}
}
 #endif

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-06-05 Thread Edin Kadribasic
edink   Mon Jun  5 22:23:39 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  MFB
  
http://cvs.php.net/viewcvs.cgi/php-src/main/streams/plain_wrapper.c?r1=1.65r2=1.66diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.65 
php-src/main/streams/plain_wrapper.c:1.66
--- php-src/main/streams/plain_wrapper.c:1.65   Tue May 16 13:05:23 2006
+++ php-src/main/streams/plain_wrapper.cMon Jun  5 22:23:39 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.65 2006/05/16 13:05:23 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.66 2006/06/05 22:23:39 edink Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -706,7 +706,7 @@
delta = range-offset - 
loffs;
}
 
-   data-last_mapped_addr = 
MapViewOfFile(data-file_mapping, acc, 0, loffs, range-length);
+   data-last_mapped_addr = 
MapViewOfFile(data-file_mapping, acc, 0, loffs, range-length + delta);
 
if (data-last_mapped_addr) {
/* give them back the 
address of the start offset they requested */
@@ -963,7 +963,7 @@
if ((p = strstr(url, ://)) != NULL) {
url = p + 3;
}
-
+
if (!(options  STREAM_DISABLE_OPEN_BASEDIR)) {
if (php_check_open_basedir(url TSRMLS_CC)) {
return 0;
@@ -1221,7 +1221,7 @@
if (((options  STREAM_DISABLE_OPEN_BASEDIR) == 0)  
php_check_open_basedir(trypath TSRMLS_CC)) {
return NULL;
}
-
+
return php_stream_fopen_rel(trypath, mode, opened_path, 
options);
}
 #endif

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-06-05 Thread Antony Dovgal
tony2001Mon Jun  5 22:39:10 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  no need to check if non-existing include_path complies with open_basedir 
setting
  the only result we can get is segfault
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/streams/plain_wrapper.c?r1=1.66r2=1.67diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.66 
php-src/main/streams/plain_wrapper.c:1.67
--- php-src/main/streams/plain_wrapper.c:1.66   Mon Jun  5 22:23:39 2006
+++ php-src/main/streams/plain_wrapper.cMon Jun  5 22:39:10 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.66 2006/06/05 22:23:39 edink Exp $ */
+/* $Id: plain_wrapper.c,v 1.67 2006/06/05 22:39:10 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1227,11 +1227,6 @@
 #endif
 
if (!path || (path  !*path)) {
-
-   if (((options  STREAM_DISABLE_OPEN_BASEDIR) == 0)  
php_check_open_basedir(path TSRMLS_CC)) {
-   return NULL;
-   }
-
return php_stream_fopen_rel(filename, mode, opened_path, 
options);
}
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-05-16 Thread Antony Dovgal
tony2001Tue May 16 13:05:23 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  MFB: fix #37395 (recursive mkdir() fails to create nonexistent directories in 
root dir)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/streams/plain_wrapper.c?r1=1.64r2=1.65diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.64 
php-src/main/streams/plain_wrapper.c:1.65
--- php-src/main/streams/plain_wrapper.c:1.64   Wed Mar  8 14:41:45 2006
+++ php-src/main/streams/plain_wrapper.cTue May 16 13:05:23 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.64 2006/03/08 14:41:45 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.65 2006/05/16 13:05:23 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1081,7 +1081,7 @@
}
else {
/* find a top level directory we need to create */
-   while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || 
(p = strrchr(buf, DEFAULT_SLASH)) ) {
+   while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || 
(offset != 1  (p = strrchr(buf, DEFAULT_SLASH))) ) {
*p = '\0';
if (VCWD_STAT(buf, sb) == 0) {
*p = DEFAULT_SLASH;

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-02-18 Thread Andi Gutmans
andiSun Feb 19 03:41:25 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  - Fix according to Sara's reply
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/streams/plain_wrapper.c?r1=1.61r2=1.62diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.61 
php-src/main/streams/plain_wrapper.c:1.62
--- php-src/main/streams/plain_wrapper.c:1.61   Sun Feb 19 01:19:37 2006
+++ php-src/main/streams/plain_wrapper.cSun Feb 19 03:41:25 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.61 2006/02/19 01:19:37 andi Exp $ */
+/* $Id: plain_wrapper.c,v 1.62 2006/02/19 03:41:25 andi Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -963,9 +963,8 @@
if ((p = strstr(url, ://)) != NULL) {
url = p + 3;
}
-
-   /* FIXME: Andi - Pending email I sent to internals@ re: 
ENFORCE_SAFE_MODE */
-   if (options  ENFORCE_SAFE_MODE) {
+
+   if (!(options  STREAM_DISABLE_OPEN_BASEDIR)) {
if (php_check_open_basedir(url TSRMLS_CC)) {
return 0;
}

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-01-16 Thread Antony Dovgal
tony2001Mon Jan 16 19:47:07 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  fix bug #35999 (recursive mkdir() does not work with relative path like 
foo/bar)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/streams/plain_wrapper.c?r1=1.56r2=1.57diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.56 
php-src/main/streams/plain_wrapper.c:1.57
--- php-src/main/streams/plain_wrapper.c:1.56   Sun Jan  1 13:09:57 2006
+++ php-src/main/streams/plain_wrapper.cMon Jan 16 19:47:07 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.56 2006/01/01 13:09:57 sniper Exp $ */
+/* $Id: plain_wrapper.c,v 1.57 2006/01/16 19:47:07 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1095,12 +1095,17 @@
offset = p - buf + 1;
}
 
-   /* find a top level directory we need to create */
-   while ((p = strrchr(buf + offset, DEFAULT_SLASH))) {
-   *p = '\0';
-   if (VCWD_STAT(buf, sb) == 0) {
-   *p = DEFAULT_SLASH;
-   break;
+   if (p  dir_len == 1) {
+   /* buf == DEFAULT_SLASH */
+   }
+   else {
+   /* find a top level directory we need to create */
+   while ( (p = strrchr(buf + offset, DEFAULT_SLASH)) || 
(p = strrchr(buf, DEFAULT_SLASH)) ) {
+   *p = '\0';
+   if (VCWD_STAT(buf, sb) == 0) {
+   *p = DEFAULT_SLASH;
+   break;
+   }
}
}
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2006-01-16 Thread Ilia Alshanetsky
iliaa   Tue Jan 17 02:32:34 2006 UTC

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  MFB51: Only report mkdir() errors if error reporting option is set.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/main/streams/plain_wrapper.c?r1=1.57r2=1.58diff_format=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.57 
php-src/main/streams/plain_wrapper.c:1.58
--- php-src/main/streams/plain_wrapper.c:1.57   Mon Jan 16 19:47:07 2006
+++ php-src/main/streams/plain_wrapper.cTue Jan 17 02:32:34 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.57 2006/01/16 19:47:07 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.58 2006/01/17 02:32:34 iliaa Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1120,7 +1120,9 @@
if (*p == '\0'  *(p + 1) != '\0') {
*p = DEFAULT_SLASH;
if ((ret = VCWD_MKDIR(buf, 
(mode_t)mode))  0) {
-   php_error_docref(NULL 
TSRMLS_CC, E_WARNING, %s, strerror(errno));
+   if (options  REPORT_ERRORS) {
+   php_error_docref(NULL 
TSRMLS_CC, E_WARNING, %s, strerror(errno));
+   }
break;
}
}

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2005-11-17 Thread Antony Dovgal
tony2001Thu Nov 17 09:19:09 2005 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  fix #35079 (stream_set_blocking(true) toggles, not enables blocking)
  patch by askalski at gmail dot com
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.53r2=1.54ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.53 
php-src/main/streams/plain_wrapper.c:1.54
--- php-src/main/streams/plain_wrapper.c:1.53   Fri Aug 26 08:50:06 2005
+++ php-src/main/streams/plain_wrapper.cThu Nov 17 09:19:06 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.53 2005/08/26 12:50:06 derick Exp $ */
+/* $Id: plain_wrapper.c,v 1.54 2005/11/17 14:19:06 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -540,7 +540,7 @@
flags = fcntl(fd, F_GETFL, 0);
oldval = (flags  O_NONBLOCK) ? 0 : 1;
if (value)
-   flags ^= O_NONBLOCK;
+   flags = ~O_NONBLOCK;
else
flags |= O_NONBLOCK;


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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2005-07-18 Thread Wez Furlong
wez Mon Jul 18 09:28:26 2005 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Apparently our pipe detection code just above this isn't foolproof.
  Catch it here.
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.49r2=1.50ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.49 
php-src/main/streams/plain_wrapper.c:1.50
--- php-src/main/streams/plain_wrapper.c:1.49   Sun Jul 17 14:39:24 2005
+++ php-src/main/streams/plain_wrapper.cMon Jul 18 09:28:24 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.49 2005/07/17 18:39:24 helly Exp $ */
+/* $Id: plain_wrapper.c,v 1.50 2005/07/18 13:28:24 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -208,6 +208,12 @@
stream-flags |= PHP_STREAM_FLAG_NO_SEEK;
} else {
stream-position = lseek(self-fd, 0, SEEK_CUR);
+#ifdef ESPIPE
+   if (stream-position == (off_t)-1  errno == ESPIPE) {
+   stream-position = 0;
+   stream-is_pipe = 1;
+   }
+#endif
}
}
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2005-07-18 Thread Wez Furlong
wez Mon Jul 18 10:12:54 2005 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  compile before commit (gah!)
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.50r2=1.51ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.50 
php-src/main/streams/plain_wrapper.c:1.51
--- php-src/main/streams/plain_wrapper.c:1.50   Mon Jul 18 09:28:24 2005
+++ php-src/main/streams/plain_wrapper.cMon Jul 18 10:12:52 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.50 2005/07/18 13:28:24 wez Exp $ */
+/* $Id: plain_wrapper.c,v 1.51 2005/07/18 14:12:52 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -211,7 +211,7 @@
 #ifdef ESPIPE
if (stream-position == (off_t)-1  errno == ESPIPE) {
stream-position = 0;
-   stream-is_pipe = 1;
+   self-is_pipe = 1;
}
 #endif
}

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2005-07-17 Thread Marcus Boerger
helly   Sun Jul 17 14:39:25 2005 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  - Fix problem with debug mode on selective machines
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.48r2=1.49ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.48 
php-src/main/streams/plain_wrapper.c:1.49
--- php-src/main/streams/plain_wrapper.c:1.48   Thu Jun 23 22:04:19 2005
+++ php-src/main/streams/plain_wrapper.cSun Jul 17 14:39:24 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.48 2005/06/24 02:04:19 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.49 2005/07/17 18:39:24 helly Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -368,8 +368,8 @@
}
} else if (data-fd != -1) {
 #ifdef PHP_DEBUG
-   if (data-fd == 2  0 == strcmp(sapi_module.name, 
cli)) {
-   /* don't close stderr in CLI in DEBUG mode, as 
we want to see any leaks */
+   if ((data-fd == 1 || data-fd == 2)  0 == 
strcmp(sapi_module.name, cli)) {
+   /* don't close stdout or stderr in CLI in DEBUG 
mode, as we want to see any leaks */
ret = 0;
} else {
ret = close(data-fd);

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2005-06-23 Thread Ilia Alshanetsky
iliaa   Thu Jun 23 22:04:21 2005 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Likely fix for bug #33140
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.47r2=1.48ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.47 
php-src/main/streams/plain_wrapper.c:1.48
--- php-src/main/streams/plain_wrapper.c:1.47   Mon Jun 20 11:59:12 2005
+++ php-src/main/streams/plain_wrapper.cThu Jun 23 22:04:19 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.47 2005/06/20 15:59:12 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.48 2005/06/24 02:04:19 iliaa Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1079,18 +1079,24 @@
char *e, *buf;
struct stat sb;
int dir_len = strlen(dir);
+   int offset = 0;
 
buf = estrndup(dir, dir_len);
e = buf + dir_len;
 
+   if ((p = memchr(buf, DEFAULT_SLASH, dir_len))) {
+   offset = p - buf + 1;
+   }
+
/* find a top level directory we need to create */
-   while ((p = strrchr(buf, DEFAULT_SLASH))) {
+   while ((p = strrchr(buf + offset, DEFAULT_SLASH))) {
*p = '\0';
if (VCWD_STAT(buf, sb) == 0) {
*p = DEFAULT_SLASH;
break;
}
}
+
if (p == buf) {
ret = php_mkdir(dir, mode TSRMLS_CC);
} else if (!(ret = php_mkdir(buf, mode TSRMLS_CC))) {

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2005-05-24 Thread Antony Dovgal
tony2001Tue May 24 06:13:54 2005 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  make it compile on Win32 (thanks to Sebastian for noticing)
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.45r2=1.46ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.45 
php-src/main/streams/plain_wrapper.c:1.46
--- php-src/main/streams/plain_wrapper.c:1.45   Mon May 23 17:48:51 2005
+++ php-src/main/streams/plain_wrapper.cTue May 24 06:13:52 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.45 2005/05/23 21:48:51 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.46 2005/05/24 10:13:52 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -154,8 +154,8 @@
if (fd != -1)   {
php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b, 
NULL);
if (stream) {
-   stream-wrapper = php_plain_files_wrapper;
php_stdio_stream_data *self = 
(php_stdio_stream_data*)stream-abstract;
+   stream-wrapper = php_plain_files_wrapper;
 
self-temp_file_name = opened_path;
self-lock_flag = LOCK_UN;

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2005-05-23 Thread Ilia Alshanetsky
iliaa   Mon May 23 17:48:52 2005 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Fixed bug #32810 (temporary files not using plain file wrapper).
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.44r2=1.45ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.44 
php-src/main/streams/plain_wrapper.c:1.45
--- php-src/main/streams/plain_wrapper.c:1.44   Thu Apr  7 03:29:14 2005
+++ php-src/main/streams/plain_wrapper.cMon May 23 17:48:51 2005
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.44 2005/04/07 07:29:14 thetaphi Exp $ */
+/* $Id: plain_wrapper.c,v 1.45 2005/05/23 21:48:51 iliaa Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -154,6 +154,7 @@
if (fd != -1)   {
php_stream *stream = php_stream_fopen_from_fd_rel(fd, r+b, 
NULL);
if (stream) {
+   stream-wrapper = php_plain_files_wrapper;
php_stdio_stream_data *self = 
(php_stdio_stream_data*)stream-abstract;
 
self-temp_file_name = opened_path;

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-10-28 Thread Antony Dovgal
tony2001Thu Oct 28 01:05:21 2004 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  fix Win32  Netware build
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.41r2=1.42ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.41 
php-src/main/streams/plain_wrapper.c:1.42
--- php-src/main/streams/plain_wrapper.c:1.41   Wed Oct 27 07:58:49 2004
+++ php-src/main/streams/plain_wrapper.cThu Oct 28 01:05:20 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.41 2004/10/27 11:58:49 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.42 2004/10/28 05:05:20 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1024,6 +1024,7 @@
struct stat sb;
if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) {
if (VCWD_STAT(url_from, sb) == 0) {
+#if !defined(TSRM_WIN32)  !defined(NETWARE)
if (VCWD_CHMOD(url_to, sb.st_mode)) {
if (errno == EPERM) {
php_error_docref2(NULL 
TSRMLS_CC, url_from, url_to, E_WARNING, %s, strerror(errno));
@@ -1042,6 +1043,7 @@
php_error_docref2(NULL TSRMLS_CC, 
url_from, url_to, E_WARNING, %s, strerror(errno));
return 0;
}
+#endif
VCWD_UNLINK(url_from);
return 1;
}

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-10-27 Thread Antony Dovgal
tony2001Wed Oct 27 07:58:50 2004 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  fix bug #30388 (rename across filesystems loses ownership and permission info)
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.40r2=1.41ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.40 
php-src/main/streams/plain_wrapper.c:1.41
--- php-src/main/streams/plain_wrapper.c:1.40   Sat Jul 31 06:09:25 2004
+++ php-src/main/streams/plain_wrapper.cWed Oct 27 07:58:49 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.40 2004/07/31 10:09:25 wez Exp $ */
+/* $Id: plain_wrapper.c,v 1.41 2004/10/27 11:58:49 tony2001 Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -1021,10 +1021,33 @@
if (ret == -1) {
 #ifdef EXDEV
if (errno == EXDEV) {
+   struct stat sb;
if (php_copy_file(url_from, url_to TSRMLS_CC) == SUCCESS) {
-   VCWD_UNLINK(url_from);
-   return 1;
+   if (VCWD_STAT(url_from, sb) == 0) {
+   if (VCWD_CHMOD(url_to, sb.st_mode)) {
+   if (errno == EPERM) {
+   php_error_docref2(NULL 
TSRMLS_CC, url_from, url_to, E_WARNING, %s, strerror(errno));
+   VCWD_UNLINK(url_from);
+   return 1;
+   }
+   php_error_docref2(NULL TSRMLS_CC, 
url_from, url_to, E_WARNING, %s, strerror(errno));
+   return 0;
+   }
+   if (VCWD_CHOWN(url_to, sb.st_uid, sb.st_gid)) {
+   if (errno == EPERM) {
+   php_error_docref2(NULL 
TSRMLS_CC, url_from, url_to, E_WARNING, %s, strerror(errno));
+   VCWD_UNLINK(url_from);
+   return 1;
+   }
+   php_error_docref2(NULL TSRMLS_CC, 
url_from, url_to, E_WARNING, %s, strerror(errno));
+   return 0;
+   }
+   VCWD_UNLINK(url_from);
+   return 1;
+   }
}
+   php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, 
%s, strerror(errno));
+   return 0;
}
 #endif
php_error_docref2(NULL TSRMLS_CC, url_from, url_to, E_WARNING, %s, 
strerror(errno));

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-07-31 Thread Wez Furlong
wez Sat Jul 31 06:09:25 2004 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Implement an fstat cache for plain files.
  
  http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.39r2=1.40ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.39 
php-src/main/streams/plain_wrapper.c:1.40
--- php-src/main/streams/plain_wrapper.c:1.39   Tue May 25 09:23:20 2004
+++ php-src/main/streams/plain_wrapper.cSat Jul 31 06:09:25 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.39 2004/05/25 13:23:20 wez Exp $ */
+/* $Id: plain_wrapper.c,v 1.40 2004/07/31 10:09:25 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -83,93 +83,16 @@
 }
 
 
-/* {{{ php_stream_fopen */
-PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char 
**opened_path, int options STREAMS_DC TSRMLS_DC)
-{
-   char *realpath = NULL;
-   struct stat st;
-   int open_flags;
-   int fd;
-   php_stream *ret;
-   int persistent = options  STREAM_OPEN_PERSISTENT;
-   char *persistent_id = NULL;
-
-   if (FAILURE == php_stream_parse_fopen_modes(mode, open_flags)) {
-   if (options  REPORT_ERRORS) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, `%s' is not a 
valid mode for fopen, mode);
-   }
-   return NULL;
-   }
-   
-   if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) == NULL) {
-   return NULL;
-   }
-
-   if (persistent) {
-   spprintf(persistent_id, 0, streams_stdio_%d_%s, open_flags, 
realpath);
-   switch (php_stream_from_persistent_id(persistent_id, ret TSRMLS_CC)) {
-   case PHP_STREAM_PERSISTENT_SUCCESS:
-   if (opened_path) {
-   *opened_path = realpath;
-   realpath = NULL;
-   }
-   if (realpath) {
-   efree(realpath);
-   }
-   /* fall through */
-
-   case PHP_STREAM_PERSISTENT_FAILURE:
-   efree(persistent_id);;
-   return ret;
-   }
-   }
-   
-   fd = open(realpath, open_flags, 0666);
-
-   if (fd != -1)   {
-   /* sanity checks for include/require */
-   if (options  STREAM_OPEN_FOR_INCLUDE  (fstat(fd, st) == -1 || 
!S_ISREG(st.st_mode))) {
-#ifdef PHP_WIN32
-   /* skip the sanity check; fstat doesn't appear to work on
-* UNC paths */
-   if (!IS_UNC_PATH(filename, strlen(filename)))
-#endif
-   goto err;
-   } 
-   
-   ret = php_stream_fopen_from_fd_rel(fd, mode, persistent_id);
-
-   if (ret){
-   if (opened_path) {
-   *opened_path = realpath;
-   realpath = NULL;
-   }
-   if (realpath) {
-   efree(realpath);
-   }
-   if (persistent_id) {
-   efree(persistent_id);
-   }
-   return ret;
-   }
-err:
-   close(fd);
-   }
-   efree(realpath);
-   if (persistent_id) {
-   efree(persistent_id);
-   }
-   return NULL;
-}
-/* }}} */
-
 /* {{{ --- STDIO stream implementation ---*/
 
 typedef struct {
FILE *file;
int fd; /* underlying file descriptor */
-   int is_process_pipe;/* use pclose instead of fclose */
-   int is_pipe;/* don't try and seek */
+   unsigned is_process_pipe:1; /* use pclose instead of fclose */
+   unsigned is_pipe:1; /* don't try and seek */
+   unsigned cached_fstat:1;/* sb is valid */
+   unsigned _reserved:29;
+   
int lock_flag;  /* stores the lock state */
char *temp_file_name;   /* if non-null, this is the path to a temporary file 
that
 * is to be deleted when the 
stream is closed */
@@ -185,7 +108,25 @@
char *last_mapped_addr;
HANDLE file_mapping;
 #endif
+
+   struct stat sb;
 } php_stdio_stream_data;
+#define PHP_STDIOP_GET_FD(anfd, data)  anfd = (data)-file ? fileno((data)-file) : 
(data)-fd
+
+static int do_fstat(php_stdio_stream_data *d, int force)
+{
+   if (!d-cached_fstat || force) {
+   int fd;
+   int r;
+

[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-05-25 Thread Wez Furlong
wez Tue May 25 09:00:25 2004 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  check if it matches... not if it doesn't...
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.36r2=1.37ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.36 
php-src/main/streams/plain_wrapper.c:1.37
--- php-src/main/streams/plain_wrapper.c:1.36   Tue May 25 08:59:15 2004
+++ php-src/main/streams/plain_wrapper.cTue May 25 09:00:25 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.36 2004/05/25 12:59:15 wez Exp $ */
+/* $Id: plain_wrapper.c,v 1.37 2004/05/25 13:00:25 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -429,7 +429,7 @@
}
} else if (data-fd != -1) {
 #ifdef DEBUG
-   if (data-fd == 2  strcmp(sapi_module.name, cli)) {
+   if (data-fd == 2  0 == strcmp(sapi_module.name, cli)) {
/* don't close stderr in CLI in DEBUG mode, as we want 
to see any leaks */
ret = 0;
} else {

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



Re: [PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-05-25 Thread Andi Gutmans
You should use PHP_DEBUG.
Isn't dup() a more robust fix?
Andi
At 12:59 PM 5/25/2004 +, Wez Furlong wrote:
wez Tue May 25 08:59:15 2004 EDT
  Modified files:
/php-src/main/streams   plain_wrapper.c
  Log:
  In debug mode, under CLI don't close stderr.
  This is so that we can see any error reports.
  # for extra paranoia, could limit this check to happen only after the 
script is
  # finished running.


http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.35r2=1.36ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.35 
php-src/main/streams/plain_wrapper.c:1.36
--- php-src/main/streams/plain_wrapper.c:1.35   Tue Mar 16 18:23:16 2004
+++ php-src/main/streams/plain_wrapper.cTue May 25 08:59:15 2004
@@ -16,7 +16,7 @@
+--+
  */

-/* $Id: plain_wrapper.c,v 1.35 2004/03/16 23:23:16 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.36 2004/05/25 12:59:15 wez Exp $ */
 #include php.h
 #include php_globals.h
@@ -428,7 +428,16 @@
data-file = NULL;
}
} else if (data-fd != -1) {
+#ifdef DEBUG
+   if (data-fd == 2  strcmp(sapi_module.name, 
cli)) {
+   /* don't close stderr in CLI in DEBUG 
mode, as we want to see any leaks */
+   ret = 0;
+   } else {
+   ret = close(data-fd);
+   }
+#else
ret = close(data-fd);
+#endif
data-fd = -1;
} else {
return 0; /* everything should be closed already 
- success */

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


RE: [PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-05-25 Thread Wez Furlong
 You should use PHP_DEBUG.

OK.

 Isn't dup() a more robust fix?

Not really, since the goal is to be able to manually close the descriptors
that might be connected to the network; dup() prevents that.

If there is some other way, I'm open to ideas.

--Wez.

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-05-25 Thread Wez Furlong
wez Tue May 25 09:17:01 2004 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  DEBUG - PHP_DEBUG
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.37r2=1.38ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.37 
php-src/main/streams/plain_wrapper.c:1.38
--- php-src/main/streams/plain_wrapper.c:1.37   Tue May 25 09:00:25 2004
+++ php-src/main/streams/plain_wrapper.cTue May 25 09:17:01 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.37 2004/05/25 13:00:25 wez Exp $ */
+/* $Id: plain_wrapper.c,v 1.38 2004/05/25 13:17:01 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -428,7 +428,7 @@
data-file = NULL;
}
} else if (data-fd != -1) {
-#ifdef DEBUG
+#ifdef PHP_DEBUG
if (data-fd == 2  0 == strcmp(sapi_module.name, cli)) {
/* don't close stderr in CLI in DEBUG mode, as we want 
to see any leaks */
ret = 0;

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



RE: [PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-05-25 Thread Andi Gutmans
Well as it's only relevant to PHP_DEBUG right now, I don't really mind.
If this issue comes up again, with output failing in non-debug during 
shutdown, we should revisit this.
Thanks,
Andi

At 02:16 PM 5/25/2004 +0100, Wez Furlong wrote:
 You should use PHP_DEBUG.
OK.
 Isn't dup() a more robust fix?
Not really, since the goal is to be able to manually close the descriptors
that might be connected to the network; dup() prevents that.
If there is some other way, I'm open to ideas.
--Wez.
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-05-25 Thread Wez Furlong
wez Tue May 25 09:23:20 2004 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  *sigh*, obviously, we need this to be able to use sapi_module.name
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.38r2=1.39ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.38 
php-src/main/streams/plain_wrapper.c:1.39
--- php-src/main/streams/plain_wrapper.c:1.38   Tue May 25 09:17:01 2004
+++ php-src/main/streams/plain_wrapper.cTue May 25 09:23:20 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.38 2004/05/25 13:17:01 wez Exp $ */
+/* $Id: plain_wrapper.c,v 1.39 2004/05/25 13:23:20 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -35,6 +35,7 @@
 #ifdef HAVE_SYS_MMAN_H
 #include sys/mman.h
 #endif
+#include SAPI.h
 
 #include php_streams_int.h
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2004-01-20 Thread Ilia Alshanetsky
iliaa   Tue Jan 20 21:28:51 2004 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Fixed bug #26974 (rename() doesn't check the destination file 
  against safe_mode/open_basedir).
  
  
http://cvs.php.net/diff.php/php-src/main/streams/plain_wrapper.c?r1=1.33r2=1.34ty=u
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.33 
php-src/main/streams/plain_wrapper.c:1.34
--- php-src/main/streams/plain_wrapper.c:1.33   Thu Jan  8 03:17:59 2004
+++ php-src/main/streams/plain_wrapper.cTue Jan 20 21:28:50 2004
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.33 2004/01/08 08:17:59 andi Exp $ */
+/* $Id: plain_wrapper.c,v 1.34 2004/01/21 02:28:50 iliaa Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -973,11 +973,12 @@
url_to = p + 3;
}
 
-   if (PG(safe_mode) (!php_checkuid(url_from, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
+   if (PG(safe_mode)  (!php_checkuid(url_from, NULL, 
CHECKUID_CHECK_FILE_AND_DIR) ||
+   !php_checkuid(url_to, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
return 0;
}
 
-   if (php_check_open_basedir(url_from TSRMLS_CC)) {
+   if (php_check_open_basedir(url_from TSRMLS_CC) || 
php_check_open_basedir(url_to TSRMLS_CC)) {
return 0;
}
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2003-12-01 Thread Sara Golemon
pollita Mon Dec  1 20:04:15 2003 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  CS
  
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.29 
php-src/main/streams/plain_wrapper.c:1.30
--- php-src/main/streams/plain_wrapper.c:1.29   Mon Dec  1 14:47:04 2003
+++ php-src/main/streams/plain_wrapper.cMon Dec  1 20:04:14 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.29 2003/12/01 19:47:04 pollita Exp $ */
+/* $Id: plain_wrapper.c,v 1.30 2003/12/02 01:04:14 pollita Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -899,8 +899,8 @@
 static int php_plain_files_url_stater(php_stream_wrapper *wrapper, char *url, int 
flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC)
 {
 
-   if (strncmp(url, file://, 7) == 0) {
-   url += 7;
+   if (strncmp(url, file://, sizeof(file://) - 1) == 0) {
+   url += sizeof(file://) - 1;
}
 
if (PG(safe_mode) (!php_checkuid_ex(url, NULL, CHECKUID_CHECK_FILE_AND_DIR, 
(flags  PHP_STREAM_URL_STAT_QUIET) ? CHECKUID_NO_ERRORS : 0))) {

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2003-10-19 Thread Shane Caraveo
shane   Sun Oct 19 16:57:21 2003 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  revert file: support in preparation for simpler patch
  
  
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.24 
php-src/main/streams/plain_wrapper.c:1.25
--- php-src/main/streams/plain_wrapper.c:1.24   Sun Oct 19 16:04:33 2003
+++ php-src/main/streams/plain_wrapper.cSun Oct 19 16:57:20 2003
@@ -16,13 +16,12 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.24 2003/10/19 20:04:33 shane Exp $ */
+/* $Id: plain_wrapper.c,v 1.25 2003/10/19 20:57:20 shane Exp $ */
 
 #include php.h
 #include php_globals.h
 #include php_network.h
 #include php_open_temporary_file.h
-#include ext/standard/url.h
 #include ext/standard/file.h
 #include ext/standard/flock_compat.h
 #include stddef.h
@@ -87,18 +86,13 @@
 PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, char 
**opened_path, int options STREAMS_DC TSRMLS_DC)
 {
char *realpath = NULL;
-   php_url *url = NULL;
struct stat st;
int open_flags;
int fd;
-   php_stream *ret = NULL;
+   php_stream *ret;
int persistent = options  STREAM_OPEN_PERSISTENT;
char *persistent_id = NULL;
 
-   if(!filename) {
-   return NULL;
-   }
-
if (FAILURE == php_stream_parse_fopen_modes(mode, open_flags)) {
if (options  REPORT_ERRORS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, `%s' is not a 
valid mode for fopen, mode);
@@ -106,13 +100,8 @@
return NULL;
}

-   if (!strncasecmp(filename, file, 4)) {
-   url = php_url_parse((char *)filename);
-   filename = url-path;
-   }
-
if ((realpath = expand_filepath(filename, NULL TSRMLS_CC)) == NULL) {
-   goto stream_fopen_done;
+   return NULL;
}
 
if (persistent) {
@@ -123,10 +112,14 @@
*opened_path = realpath;
realpath = NULL;
}
+   if (realpath) {
+   efree(realpath);
+   }
/* fall through */
 
case PHP_STREAM_PERSISTENT_FAILURE:
-   goto stream_fopen_done;
+   efree(persistent_id);;
+   return ret;
}
}

@@ -150,22 +143,22 @@
*opened_path = realpath;
realpath = NULL;
}
-   goto stream_fopen_done;
+   if (realpath) {
+   efree(realpath);
+   }
+   if (persistent_id) {
+   efree(persistent_id);
+   }
+   return ret;
}
 err:
close(fd);
}
-stream_fopen_done:
-   if (realpath) {
-   efree(realpath);
-   }
-   if (url) {
-   efree(url);
-   }
+   efree(realpath);
if (persistent_id) {
efree(persistent_id);
}
-   return ret;
+   return NULL;
 }
 /* }}} */
 
@@ -966,7 +959,6 @@
 {
/* code ripped off from fopen_wrappers.c */
char *pathbuf, *ptr, *end;
-   php_url *url = NULL;
char *exec_fname;
char trypath[MAXPATHLEN];
struct stat sb;
@@ -983,11 +975,6 @@
return NULL;
}
 
-   if (!strncasecmp(filename, file, 4)) {
-   url = php_url_parse((char *)filename);
-   filename = url-path;
-   }
-
filename_length = strlen(filename);
 
/* Relative path open */
@@ -1003,16 +990,13 @@
 
 
if (((options  STREAM_DISABLE_OPEN_BASEDIR) == 0)  
php_check_open_basedir(filename TSRMLS_CC)) {
-   stream = NULL;
-   goto stream_done;
+   return NULL;
}
 
if (PG(safe_mode)  (!php_checkuid(filename, mode, 
CHECKUID_CHECK_MODE_PARAM))) {
-   stream = NULL;
-   goto stream_done;
+   return NULL;
}
-   stream = php_stream_fopen_rel(filename, mode, opened_path, options);
-   goto stream_done;
+   return php_stream_fopen_rel(filename, mode, opened_path, options);
}
 
/*
@@ -1026,23 +1010,17 @@
if (IS_ABSOLUTE_PATH(filename, filename_length)) {
 
if (((options  STREAM_DISABLE_OPEN_BASEDIR) == 0)  
php_check_open_basedir(filename TSRMLS_CC)) {
- 

[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c streams.c

2003-10-19 Thread Shane Caraveo
shane   Sun Oct 19 16:59:12 2003 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c streams.c 
  Log:
  A simpler patch to add file uri support
  
  
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.25 
php-src/main/streams/plain_wrapper.c:1.26
--- php-src/main/streams/plain_wrapper.c:1.25   Sun Oct 19 16:57:20 2003
+++ php-src/main/streams/plain_wrapper.cSun Oct 19 16:59:12 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.25 2003/10/19 20:57:20 shane Exp $ */
+/* $Id: plain_wrapper.c,v 1.26 2003/10/19 20:59:12 shane Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -882,6 +882,16 @@
 static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, char 
*path, char *mode,
int options, char **opened_path, php_stream_context *context 
STREAMS_DC TSRMLS_DC)
 {
+   char *filename = path;
+   if (!strncasecmp(filename, file:, sizeof(file:)-1)) {
+   filename += 6;
+   while (*(++filename)=='/');
+#ifdef PHP_WIN32
+   if (*(filename + 1) != ':')
+#endif
+   filename--;
+   }
+
if ((options  USE_PATH)  PG(include_path) != NULL) {
return php_stream_fopen_with_path_rel(path, mode, PG(include_path), 
opened_path, options);
}
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.37 php-src/main/streams/streams.c:1.38
--- php-src/main/streams/streams.c:1.37 Sat Sep 13 15:56:38 2003
+++ php-src/main/streams/streams.c  Sun Oct 19 16:59:12 2003
@@ -19,7 +19,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.37 2003/09/13 19:56:38 helly Exp $ */
+/* $Id: streams.c,v 1.38 2003/10/19 20:59:12 shane Exp $ */
 
 #define _GNU_SOURCE
 #include php.h
@@ -1415,14 +1415,20 @@
}
/* TODO: curl based streams probably support file:// properly */
if (!protocol || !strncasecmp(protocol, file, n)) {
-   if (protocol  path[n+1] == '/'  path[n+2] == '/')   {
+   if (protocol  path[n+1] == '/'  path[n+2] == '/'  path[n+3] != 
'/')   {
if (options  REPORT_ERRORS) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, remote 
host file access not supported, %s, path);
}
return NULL;
}
if (protocol  path_for_open) {
+   /* skip past protocol and :/, but handle windows correctly */
*path_for_open = (char*)path + n + 1;
+   while (*(++*path_for_open)=='/');
+#ifdef PHP_WIN32
+   if (*(*path_for_open + 1) != ':')
+#endif
+   *path_for_open--;
}

/* fall back on regular file access */

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2003-10-19 Thread Shane Caraveo
shane   Sun Oct 19 17:19:54 2003 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  finish file uri support, this stuff was unecessary.
  
  
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.26 
php-src/main/streams/plain_wrapper.c:1.27
--- php-src/main/streams/plain_wrapper.c:1.26   Sun Oct 19 16:59:12 2003
+++ php-src/main/streams/plain_wrapper.cSun Oct 19 17:19:54 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.26 2003/10/19 20:59:12 shane Exp $ */
+/* $Id: plain_wrapper.c,v 1.27 2003/10/19 21:19:54 shane Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -882,16 +882,6 @@
 static php_stream *php_plain_files_stream_opener(php_stream_wrapper *wrapper, char 
*path, char *mode,
int options, char **opened_path, php_stream_context *context 
STREAMS_DC TSRMLS_DC)
 {
-   char *filename = path;
-   if (!strncasecmp(filename, file:, sizeof(file:)-1)) {
-   filename += 6;
-   while (*(++filename)=='/');
-#ifdef PHP_WIN32
-   if (*(filename + 1) != ':')
-#endif
-   filename--;
-   }
-
if ((options  USE_PATH)  PG(include_path) != NULL) {
return php_stream_fopen_with_path_rel(path, mode, PG(include_path), 
opened_path, options);
}

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c xp_socket.c

2003-10-08 Thread Wez Furlong
wez Wed Oct  8 06:55:52 2003 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c xp_socket.c 
  Log:
  Set the EOF indicator after each read attempt.
  This prevents it getting stuck in the on position.
  
  
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.22 
php-src/main/streams/plain_wrapper.c:1.23
--- php-src/main/streams/plain_wrapper.c:1.22   Sat Sep 13 15:43:39 2003
+++ php-src/main/streams/plain_wrapper.cWed Oct  8 06:55:51 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.22 2003/09/13 19:43:39 abies Exp $ */
+/* $Id: plain_wrapper.c,v 1.23 2003/10/08 10:55:51 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -370,8 +370,7 @@
if (data-fd = 0) {
ret = read(data-fd, buf, count);

-   if (ret == 0 || (ret == -1  errno != EWOULDBLOCK))
-   stream-eof = 1;
+   stream-eof = (ret == 0 || (ret == -1  errno != EWOULDBLOCK));

} else {
 #if HAVE_FLUSHIO
@@ -382,8 +381,7 @@
 
ret = fread(buf, 1, count, data-file);
 
-   if (feof(data-file))
-   stream-eof = 1;
+   stream-eof = feof(data-file);
}
return ret;
 }
Index: php-src/main/streams/xp_socket.c
diff -u php-src/main/streams/xp_socket.c:1.14 php-src/main/streams/xp_socket.c:1.15
--- php-src/main/streams/xp_socket.c:1.14   Sat Jun 28 07:24:47 2003
+++ php-src/main/streams/xp_socket.cWed Oct  8 06:55:51 2003
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: xp_socket.c,v 1.14 2003/06/28 11:24:47 wez Exp $ */
+/* $Id: xp_socket.c,v 1.15 2003/10/08 10:55:51 wez Exp $ */
 
 #include php.h
 #include ext/standard/file.h
@@ -124,9 +124,7 @@
 
nr_bytes = recv(sock-socket, buf, count, 0);
 
-   if (nr_bytes == 0 || (nr_bytes == -1  php_socket_errno() != EWOULDBLOCK)) {
-   stream-eof = 1;
-   }
+   stream-eof = (nr_bytes == 0 || (nr_bytes == -1  php_socket_errno() != 
EWOULDBLOCK));
 
if (nr_bytes  0) {
php_stream_notify_progress_increment(stream-context, nr_bytes, 0);

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2003-09-13 Thread Ard Biesheuvel
abies   Sat Sep 13 15:43:40 2003 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  Pointer size fix
  
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.21 
php-src/main/streams/plain_wrapper.c:1.22
--- php-src/main/streams/plain_wrapper.c:1.21   Tue Aug 26 21:10:10 2003
+++ php-src/main/streams/plain_wrapper.cSat Sep 13 15:43:39 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.21 2003/08/27 01:10:10 iliaa Exp $ */
+/* $Id: plain_wrapper.c,v 1.22 2003/09/13 19:43:39 abies Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -629,7 +629,7 @@
return -1;
}
 
-   if ((int) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
+   if ((long) ptrparam == PHP_STREAM_LOCK_SUPPORTED) {
return 0;
}
 

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



[PHP-CVS] cvs: php-src /main/streams plain_wrapper.c

2003-07-05 Thread Wez Furlong
wez Sat Jul  5 04:25:25 2003 EDT

  Modified files:  
/php-src/main/streams   plain_wrapper.c 
  Log:
  MFB: binary mode by default under win32.
  
  
Index: php-src/main/streams/plain_wrapper.c
diff -u php-src/main/streams/plain_wrapper.c:1.19 
php-src/main/streams/plain_wrapper.c:1.20
--- php-src/main/streams/plain_wrapper.c:1.19   Sat Jun 28 07:24:47 2003
+++ php-src/main/streams/plain_wrapper.cSat Jul  5 04:25:25 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: plain_wrapper.c,v 1.19 2003/06/28 11:24:47 wez Exp $ */
+/* $Id: plain_wrapper.c,v 1.20 2003/07/05 08:25:25 wez Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -69,16 +69,14 @@
flags |= O_RDONLY;
}
 
-#ifdef O_BINARY
-   if (strchr(mode, 'b')) {
-   flags |= O_BINARY;
-   }
-#endif
-#ifdef _O_TEXT
+#if defined(_O_TEXT)  defined(O_BINARY)
if (strchr(mode, 't')) {
flags |= _O_TEXT;
+   } else {
+   flags |= O_BINARY;
}
 #endif
+
*open_flags = flags;
return SUCCESS;
 }



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