Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
our_own_cloud_project
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
e34d6e02
Commit
e34d6e02
authored
Mar 28, 2017
by
Vincent Petry
Committed by
GitHub
Mar 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #27504 from owncloud/smb_remove_rename_permission
Adjust SMB permissions on the root
parents
2259f7f7
03ae5f1b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
apps/files_external/lib/Lib/Storage/SMB.php
apps/files_external/lib/Lib/Storage/SMB.php
+19
-1
apps/files_external/tests/Storage/SmbTest.php
apps/files_external/tests/Storage/SmbTest.php
+19
-0
No files found.
apps/files_external/lib/Lib/Storage/SMB.php
View file @
e34d6e02
...
...
@@ -242,7 +242,7 @@ class SMB extends \OCP\Files\Storage\StorageAdapter {
}
/**
* Rename the files
* Rename the files
. If the source or the target is the root, the rename won't happen.
*
* @param string $source the old name of the path
* @param string $target the new name of the path
...
...
@@ -250,6 +250,12 @@ class SMB extends \OCP\Files\Storage\StorageAdapter {
*/
public
function
rename
(
$source
,
$target
)
{
$this
->
log
(
"enter: rename('
$source
', '
$target
')"
,
Util
::
DEBUG
);
if
(
$this
->
isRootDir
(
$source
)
||
$this
->
isRootDir
(
$target
))
{
$this
->
log
(
"refusing to rename
\"
$source
\"
to
\"
$target
\"
"
);
return
$this
->
leave
(
__FUNCTION__
,
false
);
}
try
{
$result
=
$this
->
share
->
rename
(
$this
->
root
.
$source
,
$this
->
root
.
$target
);
$this
->
removeFromCache
(
$this
->
root
.
$source
);
...
...
@@ -330,6 +336,12 @@ class SMB extends \OCP\Files\Storage\StorageAdapter {
*/
public
function
unlink
(
$path
)
{
$this
->
log
(
'enter: '
.
__FUNCTION__
.
"(
$path
)"
);
if
(
$this
->
isRootDir
(
$path
))
{
$this
->
log
(
"refusing to unlink
\"
$path
\"
"
);
return
$this
->
leave
(
__FUNCTION__
,
false
);
}
$result
=
false
;
try
{
if
(
$this
->
is_dir
(
$path
))
{
...
...
@@ -442,6 +454,12 @@ class SMB extends \OCP\Files\Storage\StorageAdapter {
public
function
rmdir
(
$path
)
{
$this
->
log
(
'enter: '
.
__FUNCTION__
.
"(
$path
)"
);
if
(
$this
->
isRootDir
(
$path
))
{
$this
->
log
(
"refusing to delete
\"
$path
\"
"
);
return
$this
->
leave
(
__FUNCTION__
,
false
);
}
$result
=
false
;
try
{
$this
->
removeFromCache
(
$path
);
...
...
apps/files_external/tests/Storage/SmbTest.php
View file @
e34d6e02
...
...
@@ -87,4 +87,23 @@ class SmbTest extends \Test\Files\Storage\Storage {
$this
->
assertEquals
(
'smb::testuser@testhost//someshare//someroot/'
,
$this
->
instance
->
getId
());
$this
->
instance
=
null
;
}
public
function
testRenameRoot
()
{
// root can't be renamed
$this
->
assertFalse
(
$this
->
instance
->
rename
(
''
,
'foo1'
));
$this
->
instance
->
mkdir
(
'foo2'
);
$this
->
assertFalse
(
$this
->
instance
->
rename
(
'foo2'
,
''
));
$this
->
instance
->
rmdir
(
'foo2'
);
}
public
function
testUnlinkRoot
()
{
// root can't be deleted
$this
->
assertFalse
(
$this
->
instance
->
unlink
(
''
));
}
public
function
testRmdirRoot
()
{
// root can't be deleted
$this
->
assertFalse
(
$this
->
instance
->
rmdir
(
''
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment