make is-directory check more robust, by checking for PHP's directory-mode / Sqlfs::DIR_MODE too, not only for mime-type which is set eg. by stylite.links to "egs/$app"

This commit is contained in:
Ralf Becker 2016-07-28 11:11:34 +02:00
parent abf87b63c9
commit 86823a7e8c

View File

@ -1066,11 +1066,12 @@ class StreamWrapper extends Api\Db\Pdo implements Vfs\StreamWrapperIface
$path = Vfs::parse_url($url,PHP_URL_PATH); $path = Vfs::parse_url($url,PHP_URL_PATH);
if (!($stat = $this->url_stat($url,0)) || // dir not found if (!($stat = $this->url_stat($url,0)) || // dir not found
$stat['mime'] != self::DIR_MIME_TYPE || // no dir !($stat['mode'] & self::MODE_DIR) && $stat['mime'] != self::DIR_MIME_TYPE || // no dir
!Vfs::check_access($url,Vfs::EXECUTABLE|Vfs::READABLE,$stat)) // no access !Vfs::check_access($url,Vfs::EXECUTABLE|Vfs::READABLE,$stat)) // no access
{ {
self::_remove_password($url); self::_remove_password($url);
$msg = $stat['mime'] != self::DIR_MIME_TYPE ? "$url is no directory" : 'permission denied'; $msg = !($stat['mode'] & self::MODE_DIR) && $stat['mime'] != self::DIR_MIME_TYPE ?
"$url is no directory" : 'permission denied';
if (self::LOG_LEVEL) error_log(__METHOD__."('$url',$options) $msg!"); if (self::LOG_LEVEL) error_log(__METHOD__."('$url',$options) $msg!");
$this->opened_dir = null; $this->opened_dir = null;
return false; return false;