You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.6 KiB

  1. --- a/ext/sqlite/pdo_sqlite2.c
  2. +++ b/ext/sqlite/pdo_sqlite2.c
  3. @@ -522,11 +522,6 @@ static char *make_filename_safe(const ch
  4. return NULL;
  5. }
  6. - if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
  7. - efree(fullpath);
  8. - return NULL;
  9. - }
  10. -
  11. if (php_check_open_basedir(fullpath TSRMLS_CC)) {
  12. efree(fullpath);
  13. return NULL;
  14. @@ -585,7 +580,7 @@ static int pdo_sqlite2_handle_factory(pd
  15. if (!filename) {
  16. zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
  17. - "safe_mode/open_basedir prohibits opening %s",
  18. + "open_basedir prohibits opening %s",
  19. dbh->data_source);
  20. goto cleanup;
  21. }
  22. --- a/ext/sqlite/sqlite.c
  23. +++ b/ext/sqlite/sqlite.c
  24. @@ -1066,10 +1066,6 @@ static int php_sqlite_authorizer(void *a
  25. case SQLITE_COPY:
  26. if (strncmp(arg4, ":memory:", sizeof(":memory:") - 1)) {
  27. TSRMLS_FETCH();
  28. - if (PG(safe_mode) && (!php_checkuid(arg4, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
  29. - return SQLITE_DENY;
  30. - }
  31. -
  32. if (php_check_open_basedir(arg4 TSRMLS_CC)) {
  33. return SQLITE_DENY;
  34. }
  35. @@ -1079,10 +1075,6 @@ static int php_sqlite_authorizer(void *a
  36. case SQLITE_ATTACH:
  37. if (strncmp(arg3, ":memory:", sizeof(":memory:") - 1)) {
  38. TSRMLS_FETCH();
  39. - if (PG(safe_mode) && (!php_checkuid(arg3, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
  40. - return SQLITE_DENY;
  41. - }
  42. -
  43. if (php_check_open_basedir(arg3 TSRMLS_CC)) {
  44. return SQLITE_DENY;
  45. }
  46. @@ -1160,13 +1152,12 @@ static void sqlite_object_free_storage(v
  47. static void sqlite_object_new(zend_class_entry *class_type, zend_object_handlers *handlers, zend_object_value *retval TSRMLS_DC)
  48. {
  49. sqlite_object *intern;
  50. - zval *tmp;
  51. intern = emalloc(sizeof(sqlite_object));
  52. memset(intern, 0, sizeof(sqlite_object));
  53. zend_object_std_init(&intern->std, class_type TSRMLS_CC);
  54. - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
  55. + object_properties_init(&intern->std, class_type);
  56. 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);
  57. retval->handlers = handlers;
  58. @@ -1510,7 +1501,7 @@ static struct php_sqlite_db *php_sqlite_
  59. /* authorizer hook so we can enforce safe mode
  60. * Note: the declaration of php_sqlite_authorizer is correct for 2.8.2 of libsqlite,
  61. * and IS backwards binary compatible with earlier versions */
  62. - if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) {
  63. + if (PG(open_basedir) && *PG(open_basedir)) {
  64. sqlite_set_authorizer(sdb, php_sqlite_authorizer, NULL);
  65. }
  66. @@ -1569,8 +1560,7 @@ PHP_FUNCTION(sqlite_popen)
  67. RETURN_FALSE;
  68. }
  69. - if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
  70. - php_check_open_basedir(fullpath TSRMLS_CC)) {
  71. + if (php_check_open_basedir(fullpath TSRMLS_CC)) {
  72. efree(fullpath);
  73. RETURN_FALSE;
  74. }
  75. @@ -1656,8 +1646,7 @@ PHP_FUNCTION(sqlite_open)
  76. }
  77. }
  78. - if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
  79. - php_check_open_basedir(fullpath TSRMLS_CC)) {
  80. + if (php_check_open_basedir(fullpath TSRMLS_CC)) {
  81. efree(fullpath);
  82. zend_restore_error_handling(&error_handling TSRMLS_CC);
  83. if (object) {
  84. @@ -1710,8 +1699,7 @@ PHP_FUNCTION(sqlite_factory)
  85. RETURN_NULL();
  86. }
  87. - if ((PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) ||
  88. - php_check_open_basedir(fullpath TSRMLS_CC)) {
  89. + if (php_check_open_basedir(fullpath TSRMLS_CC)) {
  90. efree(fullpath);
  91. zend_restore_error_handling(&error_handling TSRMLS_CC);
  92. RETURN_NULL();