function _security_review_check_file_perms_scan in Security Review 7
Same name and namespace in other branches
- 6 security_review.inc \_security_review_check_file_perms_scan()
1 call to _security_review_check_file_perms_scan()
- security_review_check_file_perms in ./
security_review.inc - Check that files aren't writeable by the server.
File
- ./
security_review.inc, line 269 - Stand-alone security checks and review system.
Code
function _security_review_check_file_perms_scan($directory, &$parsed, $ignore) {
$items = array();
if ($handle = opendir($directory)) {
while (($file = readdir($handle)) !== FALSE) {
// Don't check hidden files or ones we said to ignore.
$path = $directory . "/" . $file;
if ($file[0] != "." && !in_array($file, $ignore) && !in_array(realpath($path), $ignore)) {
if (is_dir($path) && !in_array(realpath($path), $parsed)) {
$parsed[] = realpath($path);
$items = array_merge($items, _security_review_check_file_perms_scan($path, $parsed, $ignore));
if (is_writable($path)) {
$items[] = preg_replace("/\\/\\//si", "/", $path);
}
}
elseif (is_writable($path)) {
$items[] = preg_replace("/\\/\\//si", "/", $path);
}
}
}
closedir($handle);
}
return $items;
}