Improved "open_basedir" handling

This commit is contained in:
Loïc Chapeaux
2002-06-01 18:51:36 +00:00
parent b8fb6cc591
commit 4dc307b572
2 changed files with 7 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ $Source$
- updated the FPDF library to the 1.5 revision;
- rewrote it to make it PHP3 and xhtml compliant;
- coding standards.
* read_dump.php3, lines 245-252: improved the "open_basedir" handling.
2002-06-01 Alexander M. Turek <rabus@users.sourceforge.net>
* lang/indonesian.inc.php3: Updates, thanks to Rachim Tamsjadi.

View File

@@ -229,7 +229,7 @@ if ($sql_file != 'none') {
if (file_exists($sql_file) && is_uploaded_file($sql_file)) {
$open_basedir = '';
if (PMA_PHP_INT_VERSION >= 40000 ) {
if (PMA_PHP_INT_VERSION >= 40000) {
$open_basedir = @ini_get('open_basedir');
}
if (empty($open_basedir)) {
@@ -242,12 +242,14 @@ if ($sql_file != 'none') {
if (!empty($open_basedir)) {
// check if '.' is in open_basedir
$pos = strpos(' ' . $open_basedir, '.');
$split_char = (PMA_IS_WINDOWS ? ';' : ':');
$pos = ereg('(^|' . $split_char . ')\\.(' . $split_char . '|$)', $open_basedir);
// from the PHP annotated manual
if (!$pos) {
// if no '.' in openbasedir, do not move the file, force the
// error and let PHP report it
// if no '.' in openbasedir, do not move the file (open_basedir
// may only be a prefix), force the error and let PHP reports
// it
error_reporting(E_ALL);
$sql_query = fread(fopen($sql_file, 'r'), filesize($sql_file));
}