-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix file permissions for SMB (read-only folders will be writeable) #25301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
By analyzing the blame information on this pull request, we identified @icewind1991, @blizzz, @jmaciasportela and @Xenopathic to be potential reviewers |
|
Shouldn't this also include a check if the path is the share root? |
|
It doesn't seems to be needed |
|
ok, 👍 |
| try { | ||
| $info = $this->getFileInfo($path); | ||
| return !$info->isHidden() && !$info->isReadOnly(); | ||
| return !$info->isHidden() && (!$info->isReadOnly() || $this->is_dir($path)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does readonly still work if the share itself is readonly ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uploads will fail anywhere in the share if it's set as read-only. Anyway, I don't think we can't get the share configuration from the client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems I'm able to stat the share directly, getting this from $this->share->getStat('') =>
$result[0] = (int) '2094732529';
$result[1] = (int) '-676439979';
$result[2] = (int) '16877';
$result[3] = (int) '2';
$result[4] = (int) '30';
$result[5] = (int) '8';
$result[6] = (int) '0';
$result[7] = (int) '0';
$result[8] = (int) '1467378490';
$result[9] = (int) '1466774556';
$result[10] = (int) '1466774556';
$result[11] = (int) '512';
$result[12] = (int) '0';
$result['dev'] = (int) '2094732529';
$result['ino'] = (int) '-676439979';
$result['mode'] = (int) '16877';
$result['nlink'] = (int) '2';
$result['uid'] = (int) '30';
$result['gid'] = (int) '8';
$result['rdev'] = (int) '0';
$result['size'] = (int) '0';
$result['atime'] = (int) '1467378490';
$result['mtime'] = (int) '1466774556';
$result['ctime'] = (int) '1466774556';
$result['blksize'] = (int) '512';
$result['blocks'] = (int) '0';
Not sure which is the permission.
But as I see on master we also don't handle share permissions, so might be something to do separately.
|
Tested, works 👍 However I tested only against a Linux Samba server. And to make permissions read-only I did I hope someone can test against a Windows Server. |
|
👍 Using a WND backend located in a windows 2003 server Now applying the patch, it is possible to add files in the R/O Subfolders @jvillafanez will comment ASAP about other scenarios in this PR in order to clarify if it is needed more changes |
|
I'm checking if read-only folder can be deleted or not. As it is right now with this PR, all folders can be deleted from ownCloud, but there are errors deleting read-only folders. We might need to adjust the delete permission. |
|
https://support.microsoft.com/en-us/kb/326549
I wonder if this still applies if we're accessing through SMB... |
|
It seems that it's possible to delete the folder from the windows explorer, but not from the windows console nor from smbclient. Note that with the current ownCloud implementation, even though the folder isn't being deleted, its contents are deleted (or at least tried to) |
|
@jvillafanez how does Mac OS behave in regards to deleting the mount ? |
|
@jvillafanez any update ? Any risks ? |
|
If the SMB server is in windows, the server rejects the deletion of the read-only folder. Regarding the mounts, they shouldn't be deleted anyway. I'll have to have a look at the delete permissions. |
| } | ||
|
|
||
| public function isUpdatable($path) { | ||
| try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a quick comment here would be nice to avoid future devs to scratch their head trying to understand why we allow writing for read-only folders
|
@davitol mind doing another test against a Windows server in regards to the deletable part ? |
|
SMB tests against a Windows Server still pass: Ideally we should add unit tests here, would require to mock the file info bit. |
|
👍 |
|
Will there be backports for 9.1 and 9.0? |
|
@jvillafanez yes, would be good to backport this to 9.1 and 9.0 if possible. |
Yes, would be great to have them in those versions too! Thanks! |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |


Fix #24608
Backport for OC9 should follow.