summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-06-09 20:36:55 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-06-09 20:36:55 +0000
commitd3ad6e640da41951f6cf13d30d3238b1e1589e1f (patch)
tree2fe1948c8411112a2f843e13145d9a564c675697 /ext/sqlite/sqlite.c
parentf2957721af2795a2d72116e736647796cdc9bceb (diff)
downloadphp-git-d3ad6e640da41951f6cf13d30d3238b1e1589e1f.tar.gz
Do not perform safe_mode & open_basedir checks for memory-only databases.
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r--ext/sqlite/sqlite.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 40e71c8298..84d5307aaa 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -733,15 +733,19 @@ PHP_FUNCTION(sqlite_popen)
return;
}
- /* resolve the fully-qualified path name to use as the hash key */
- fullpath = expand_filepath(filename, NULL TSRMLS_CC);
+ if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
+ /* resolve the fully-qualified path name to use as the hash key */
+ fullpath = expand_filepath(filename, NULL TSRMLS_CC);
- if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
+ if (PG(safe_mode) && (!php_checkuid(fullpath, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ RETURN_FALSE;
+ }
- if (php_check_open_basedir(fullpath TSRMLS_CC)) {
- RETURN_FALSE;
+ if (php_check_open_basedir(fullpath TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ } else {
+ fullpath = estrndup(filename, filename_len);
}
hashkeylen = spprintf(&hashkey, 0, "sqlite_pdb_%s:%d", fullpath, mode);
@@ -791,12 +795,14 @@ PHP_FUNCTION(sqlite_open)
return;
}
- if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
- RETURN_FALSE;
- }
+ if (strncmp(filename, ":memory:", sizeof(":memory:") - 1)) {
+ if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ RETURN_FALSE;
+ }
- if (php_check_open_basedir(filename TSRMLS_CC)) {
- RETURN_FALSE;
+ if (php_check_open_basedir(filename TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
}
php_sqlite_open(filename, mode, NULL, return_value, errmsg TSRMLS_CC);