Diff for /embedaddon/php/ext/session/mod_files.c between versions 1.1 and 1.1.1.3

version 1.1, 2012/02/21 23:48:01 version 1.1.1.3, 2013/07/22 01:32:00
Line 2 Line 2
    +----------------------------------------------------------------------+     +----------------------------------------------------------------------+
    | PHP Version 5                                                        |     | PHP Version 5                                                        |
    +----------------------------------------------------------------------+     +----------------------------------------------------------------------+
   | Copyright (c) 1997-2012 The PHP Group                                |   | Copyright (c) 1997-2013 The PHP Group                                |
    +----------------------------------------------------------------------+     +----------------------------------------------------------------------+
    | This source file is subject to version 3.01 of the PHP license,      |     | This source file is subject to version 3.01 of the PHP license,      |
    | that is bundled with this package in the file LICENSE, and is        |     | that is bundled with this package in the file LICENSE, and is        |
Line 171  static void ps_files_open(ps_files *data, const char * Line 171  static void ps_files_open(ps_files *data, const char *
                 if (data->fd != -1) {                  if (data->fd != -1) {
 #ifndef PHP_WIN32  #ifndef PHP_WIN32
                         /* check to make sure that the opened file is not a symlink, linking to data outside of allowable dirs */                          /* check to make sure that the opened file is not a symlink, linking to data outside of allowable dirs */
                        if (PG(safe_mode) || PG(open_basedir)) {                        if (PG(open_basedir)) {
                                 struct stat sbuf;                                  struct stat sbuf;
   
                                 if (fstat(data->fd, &sbuf)) {                                  if (fstat(data->fd, &sbuf)) {
                                         close(data->fd);                                          close(data->fd);
                                         return;                                          return;
                                 }                                  }
                                if (                                if (S_ISLNK(sbuf.st_mode) && php_check_open_basedir(buf TSRMLS_CC)) {
                                        S_ISLNK(sbuf.st_mode) && 
                                        ( 
                                                php_check_open_basedir(buf TSRMLS_CC) || 
                                                (PG(safe_mode) && !php_checkuid(buf, NULL, CHECKUID_CHECK_FILE_AND_DIR)) 
                                        ) 
                                ) { 
                                         close(data->fd);                                          close(data->fd);
                                         return;                                          return;
                                 }                                  }
Line 274  PS_OPEN_FUNC(files) Line 268  PS_OPEN_FUNC(files)
                 /* if save path is an empty string, determine the temporary dir */                  /* if save path is an empty string, determine the temporary dir */
                 save_path = php_get_temporary_directory();                  save_path = php_get_temporary_directory();
   
                 if (PG(safe_mode) && (!php_checkuid(save_path, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {  
                         return FAILURE;  
                 }  
                 if (php_check_open_basedir(save_path TSRMLS_CC)) {                  if (php_check_open_basedir(save_path TSRMLS_CC)) {
                         return FAILURE;                          return FAILURE;
                 }                  }
Line 320  PS_OPEN_FUNC(files) Line 311  PS_OPEN_FUNC(files)
         data->basedir_len = strlen(save_path);          data->basedir_len = strlen(save_path);
         data->basedir = estrndup(save_path, data->basedir_len);          data->basedir = estrndup(save_path, data->basedir_len);
   
           if (PS_GET_MOD_DATA()) {
                   ps_close_files(mod_data TSRMLS_CC);
           }
         PS_SET_MOD_DATA(data);          PS_SET_MOD_DATA(data);
   
         return SUCCESS;          return SUCCESS;
Line 399  PS_WRITE_FUNC(files) Line 393  PS_WRITE_FUNC(files)
         /* Truncate file if the amount of new data is smaller than the existing data set. */          /* Truncate file if the amount of new data is smaller than the existing data set. */
   
         if (vallen < (int)data->st_size) {          if (vallen < (int)data->st_size) {
                ftruncate(data->fd, 0);                php_ignore_value(ftruncate(data->fd, 0));
         }          }
   
 #if defined(HAVE_PWRITE)  #if defined(HAVE_PWRITE)

Removed from v.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>