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

View File

@@ -242,12 +242,14 @@ if ($sql_file != 'none') {
if (!empty($open_basedir)) { if (!empty($open_basedir)) {
// check if '.' is in 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 // from the PHP annotated manual
if (!$pos) { if (!$pos) {
// if no '.' in openbasedir, do not move the file, force the // if no '.' in openbasedir, do not move the file (open_basedir
// error and let PHP report it // may only be a prefix), force the error and let PHP reports
// it
error_reporting(E_ALL); error_reporting(E_ALL);
$sql_query = fread(fopen($sql_file, 'r'), filesize($sql_file)); $sql_query = fread(fopen($sql_file, 'r'), filesize($sql_file));
} }