Commit 9dc33dd9 authored by anarcat's avatar anarcat Committed by anarcat

fix regression in handling of symlinks in recursive functions: last...

fix regression in handling of symlinks in recursive functions: last recursivity fix made it so regular files were not affected
parent b97c68ee
......@@ -382,15 +382,17 @@ function _provision_call_recursive($func, $path, $arg) {
$status = 1;
// do not follow symlinks as it could lead to a DOS attack
// consider someone creating a symlink from files/foo to ..: it would create an infinite loop
if (!is_link($path) && ($dh = @opendir($path))) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
$status = _provision_call_recursive($func, $path . "/" . $file, $arg) && $status;
if (!is_link($path)) {
if ($dh = @opendir($path)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
$status = _provision_call_recursive($func, $path . "/" . $file, $arg) && $status;
}
}
closedir($dh);
}
closedir($dh);
$status = $func($path, $arg) && $status;
}
$status = $func($path, $arg) && $status;
return $status;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment