Skip to content
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

Windows: Additional write permissions check #5510

Closed
wants to merge 8 commits into from

Conversation

Alkl58
Copy link
Contributor

@Alkl58 Alkl58 commented Mar 9, 2023

The Problem: The isWritable() function checks only(?) for write permissions for the user, owner, group or anyone(?).

Its technically correct - when opening the folder permissions of an SMB share in Explorer, it shows that the user doesn't have those permissions. The actual permission for being able to read/write/delete is not covered by the "base" permissions of Explorer, it's covered by the "special permissions".

It looks similar to this (just imageine it being an SMB share):

For more info check my comment: #3910 (comment)

This PR adds an additional actual write test for Windows hosts.

This PR fixes #3910

First time using C++, comments/improvements welcome!

@Alkl58
Copy link
Contributor Author

Alkl58 commented Mar 9, 2023

Also closes/fixes: #3201

@Alkl58
Copy link
Contributor Author

Alkl58 commented Mar 9, 2023

Test on SMB share:
grafik

Test on normal folder:
grafik

Test on protected system folder:
grafik

Test on write protected folder:
grafik

@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Merging #5510 (d72c932) into master (406bad8) will decrease coverage by 1.63%.
Report is 10 commits behind head on master.
The diff coverage is n/a.

❗ Current head d72c932 differs from pull request most recent head 67205a2. Consider uploading reports for the commit 67205a2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5510      +/-   ##
==========================================
- Coverage   60.56%   58.94%   -1.63%     
==========================================
  Files         145      143       -2     
  Lines       18846    18313     -533     
==========================================
- Hits        11414    10794     -620     
- Misses       7432     7519      +87     

see 78 files with indirect coverage changes

@Alkl58
Copy link
Contributor Author

Alkl58 commented Mar 13, 2023

Will this be merged at some point? Or should I close it?

Copy link
Collaborator

@claucambra claucambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good at first glance, but need to find time to test

Copy link
Collaborator

@claucambra claucambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small comments

src/gui/folderman.cpp Outdated Show resolved Hide resolved
src/gui/folderman.cpp Outdated Show resolved Hide resolved
src/gui/folderman.cpp Outdated Show resolved Hide resolved
src/gui/folderman.cpp Outdated Show resolved Hide resolved
src/gui/folderman.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@claucambra claucambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Alkl58 are you able to make the requested changes? If not we are happy to take over the PR and include your changes with our own fixes :)

Alkl58 and others added 6 commits November 6, 2023 16:39
Co-authored-by: Claudio Cambra <[email protected]>
Signed-off-by: Alkl58 <[email protected]>
Co-authored-by: Claudio Cambra <[email protected]>
Signed-off-by: Alkl58 <[email protected]>
Co-authored-by: Claudio Cambra <[email protected]>
Signed-off-by: Alkl58 <[email protected]>
Co-authored-by: Claudio Cambra <[email protected]>
Signed-off-by: Alkl58 <[email protected]>
Co-authored-by: Claudio Cambra <[email protected]>
Signed-off-by: Alkl58 <[email protected]>
@Alkl58
Copy link
Contributor Author

Alkl58 commented Nov 6, 2023

Hi @Alkl58 are you able to make the requested changes? If not we are happy to take over the PR and include your changes with our own fixes :)

Sorry for the delay. Should be all good now :)

src/gui/folderman.cpp Outdated Show resolved Hide resolved
src/gui/folderman.cpp Outdated Show resolved Hide resolved
Signed-off-by: Alkl58 <[email protected]>
@nextcloud-desktop-bot
Copy link

AppImage file: nextcloud-PR-5510-67205a2cec923c441ec1e962388e287219073afa-x86_64.AppImage

To test this change/fix you can simply download above AppImage file and test it.

Please make sure to quit your existing Nextcloud app and backup your data.

@Alkl58
Copy link
Contributor Author

Alkl58 commented Nov 7, 2023

Just a FYI: Apparently I completely broke my local dev environment after trying to install all qt dependencies. I'll reinstall my system / use a VM, will take some time so I can properly debug / fix things.

@allexzander
Copy link
Contributor

Just a FYI: Apparently I completely broke my local dev environment after trying to install all qt dependencies. I'll reinstall my system / use a VM, will take some time so I can properly debug / fix things.

sure, no worries, I've noticed you're using fopen function from C, that only takes const char* as filename. We need to use QFile instead. If you are ok, I can take over the PR and incorporate changes.

@Alkl58
Copy link
Contributor Author

Alkl58 commented Nov 7, 2023

@allexzander sure, thats probably faster, sorry for the hassle

@allexzander
Copy link
Contributor

Moved to #6209

@allexzander allexzander closed this Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

You have no permission to write to the selected folder checkPathValidityForNewFolder failes for SMB-folders
5 participants