DevZone

sqlite2 v1.0.3 for PHP 5.4 (FreeBSD, Linux)

May 20th, 2012
439
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- sqlite.c    2012-05-20 07:36:59.000000000 +0300
  2. +++ sqlite.c    2012-05-20 08:47:46.000000000 +0300
  3. @@ -526,7 +526,7 @@ const zend_function_entry sqlite_functio
  4.     PHP_FE(sqlite_udf_encode_binary,    arginfo_sqlite_udf_encode_binary)
  5.     PHP_FE(sqlite_udf_decode_binary,    arginfo_sqlite_udf_decode_binary)
  6.     PHP_FE(sqlite_fetch_column_types,   arginfo_sqlite_fetch_column_types)
  7. -   {NULL, NULL, NULL}
  8. +   PHP_FE_END
  9.  };
  10.  
  11.  const zend_function_entry sqlite_funcs_db[] = {
  12. @@ -1066,10 +1066,6 @@ static int php_sqlite_authorizer(void *a
  13.         case SQLITE_COPY:
  14.             if (strncmp(arg4, ":memory:", sizeof(":memory:") - 1)) {
  15.                 TSRMLS_FETCH();
  16. -               if (PG(safe_mode) && (!php_checkuid(arg4, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
  17. -                   return SQLITE_DENY;
  18. -               }
  19. -
  20.                 if (php_check_open_basedir(arg4 TSRMLS_CC)) {
  21.                     return SQLITE_DENY;
  22.                 }
  23. @@ -1079,10 +1075,6 @@ static int php_sqlite_authorizer(void *a
  24.         case SQLITE_ATTACH:
  25.             if (strncmp(arg3, ":memory:", sizeof(":memory:") - 1)) {
  26.                 TSRMLS_FETCH();
  27. -               if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
  28. -                   return SQLITE_DENY;
  29. -               }
  30. -
  31.                 if (php_check_open_basedir(arg3 TSRMLS_CC)) {
  32.                     return SQLITE_DENY;
  33.                 }
  34. @@ -1166,7 +1158,7 @@ static void sqlite_object_new(zend_class
  35.     memset(intern, 0, sizeof(sqlite_object));
  36.  
  37.     zend_object_std_init(&intern->std, class_type TSRMLS_CC);
  38. -   zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
  39. +   object_properties_init(&intern->std, class_type);
  40.  
  41.     retval->handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) sqlite_object_free_storage, NULL TSRMLS_CC);
  42.     retval->handlers = handlers;
  43. @@ -1510,7 +1502,7 @@ static struct php_sqlite_db *php_sqlite_
  44.     /* authorizer hook so we can enforce safe mode
  45.      * Note: the declaration of php_sqlite_authorizer is correct for 2.8.2 of libsqlite,
  46.      * and IS backwards binary compatible with earlier versions */
  47. -   if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
  48. +   if ((PG(open_basedir) && *PG(open_basedir))) {
  49.         sqlite_set_authorizer(sdb, php_sqlite_authorizer, NULL);
  50.     }
  51.  
  52. @@ -1569,8 +1561,7 @@ PHP_FUNCTION(sqlite_popen)
  53.             RETURN_FALSE;
  54.         }
  55.  
  56. -       if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
  57. -               php_check_open_basedir(fullpath TSRMLS_CC)) {
  58. +       if (php_check_open_basedir(fullpath TSRMLS_CC)) {
  59.             efree(fullpath);
  60.             RETURN_FALSE;
  61.         }
  62. @@ -1656,8 +1647,7 @@ PHP_FUNCTION(sqlite_open)
  63.             }
  64.         }
  65.  
  66. -       if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
  67. -               php_check_open_basedir(fullpath TSRMLS_CC)) {
  68. +       if (php_check_open_basedir(fullpath TSRMLS_CC)) {
  69.             efree(fullpath);
  70.             zend_restore_error_handling(&error_handling TSRMLS_CC);
  71.             if (object) {
  72. @@ -1688,7 +1678,7 @@ PHP_FUNCTION(sqlite_factory)
  73.     zend_error_handling error_handling;
  74.  
  75.     zend_replace_error_handling(EH_THROW, sqlite_ce_exception, &error_handling TSRMLS_CC);
  76. -   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz/",
  77. +   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|lz/",
  78.                 &filename, &filename_len, &mode, &errmsg)) {
  79.         zend_restore_error_handling(&error_handling TSRMLS_CC);
  80.         RETURN_NULL();
  81. @@ -1710,8 +1700,7 @@ PHP_FUNCTION(sqlite_factory)
  82.             RETURN_NULL();
  83.         }
  84.  
  85. -       if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
  86. -               php_check_open_basedir(fullpath TSRMLS_CC)) {
  87. +       if (php_check_open_basedir(fullpath TSRMLS_CC)) {
  88.             efree(fullpath);
  89.             zend_restore_error_handling(&error_handling TSRMLS_CC);
  90.             RETURN_NULL();
RAW Paste Data