* Filemanager/Sharing: deny rename, move, mkdir and rmdir on readonly share

This commit is contained in:
Ralf Becker 2017-11-02 13:16:46 +01:00
parent 3a24416eb9
commit 3689b3d645

View File

@ -584,6 +584,11 @@ class StreamWrapper implements StreamWrapperIface
{
return false;
}
// refuse to modify readonly target (eg. readonly share)
if (self::url_is_readonly($url_to))
{
return false;
}
// if file is moved from one filesystem / wrapper to an other --> copy it (rename fails cross wrappers)
if (Vfs::parse_url($url_from,PHP_URL_SCHEME) == Vfs::parse_url($url_to,PHP_URL_SCHEME))
{
@ -636,6 +641,11 @@ class StreamWrapper implements StreamWrapperIface
{
return false;
}
// refuse to modify readonly target (eg. readonly share)
if (self::url_is_readonly($url))
{
return false;
}
// check if recursive option is set and needed
if (($options & STREAM_MKDIR_RECURSIVE) &&
($parent_url = Vfs::dirname($url)) &&
@ -908,7 +918,7 @@ class StreamWrapper implements StreamWrapperIface
while (($rel_path = Vfs::basename($url).($rel_path ? '/'.$rel_path : '')) &&
($url = Vfs::dirname($url)))
{
if (($stat = $this->url_stat($url,0,true,false)))
if (($stat = $this->url_stat($url, 0, false, false)))
{
if (is_link($url) && ($lpath = Vfs::readlink($url)))
{