D6830: Make use of kauth helper in copy method of file ioslave
Chinmoy Ranjan Pradhan
noreply at phabricator.kde.org
Tue Jan 2 12:19:16 UTC 2018
chinmoyr updated this revision to Diff 24583.
chinmoyr added a comment.
Changes:
1. Added method tryChangeAttr. This will call chown/chmod/utime in copy with elevated privileges only during the brief period authorization is kept.
2.Added check for unit test mode at beginning of copy. "copy" calls execWihElevatedPrivileges number of times but for unit test once is enough.
3.Replaced dest_file.setPermissions(...) with the static version. This will ensure that the error code set when using file decriptor is either EACCES or EPERM.
@dfaure I was curious about this block of code
if (!src_file.open(QIODevice::ReadOnly)) {
if (auto err = tryOpen(src_file, _src, O_RDONLY, S_IRUSR)) {
if (!err.wasCanceled()) {
error(KIO::ERR_CANNOT_OPEN_FOR_READING, src);
}
return;
}
}
In case the operation is canceled the function returns without calling error or finished. While testing these changes with dolphin I never got any warning so I ignored.
But isn't it wrong? If that's the case then I have fix every block similar to this and with "copy" and "put" changes will definitely look ugly.
REPOSITORY
R241 KIO
CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D6830?vs=20366&id=24583
BRANCH
6830
REVISION DETAIL
https://phabricator.kde.org/D6830
AFFECTED FILES
src/ioslaves/file/file.h
src/ioslaves/file/file_unix.cpp
src/ioslaves/file/file_win.cpp
To: chinmoyr, dfaure, #frameworks
Cc: elvisangelaccio, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180102/ea2eeb7f/attachment.html>
More information about the Kde-frameworks-devel
mailing list