D5394: KAuth integration in document saving - vol. 2
Martin Kostolný
noreply at phabricator.kde.org
Sun Apr 16 15:38:58 UTC 2017
martinkostolny updated this revision to Diff 13517.
martinkostolny added a comment.
Updated diff based on Fabian's advisory. Thanks, Fabian!
I've implemented the first option: checksum -> tempfile1 -> read in privileged action -> checksum -> tempfile2 -> permissions -> rename. It works with big (e.g. 50MiB) files. I hope I didn't miss something.
Known issues:
- Using std::rename only for unix systems while using racy QFile's remove && rename for windows as fallback. I cannot test on windows otherwise I'd implemented an atomic rename there as well.
- I'm now using QBuffer to buffer all file bytes before making the first checksum. Probably the best solution (memory-wise) would be to use QTemporaryFile directly and capture all written bytes right before they are written to the file and make the checksum from it. But I didn't find an easy way to do that.
REPOSITORY
R39 KTextEditor
CHANGES SINCE LAST UPDATE
https://phabricator.kde.org/D5394?vs=13314&id=13517
REVISION DETAIL
https://phabricator.kde.org/D5394
AFFECTED FILES
src/buffer/katesecuretextbuffer.cpp
src/buffer/katesecuretextbuffer_p.h
src/buffer/katetextbuffer.cpp
src/buffer/katetextbuffer.h
To: martinkostolny, #ktexteditor, fvogt
Cc: elvisangelaccio, aacid, ivan, lbeltrame, fvogt, apol, anthonyfieroni, cullmann, ltoscano, dhaumann, graesslin, davidedmundson, palant, kwrite-devel, dfaure, #frameworks, head7, kfunk, sars
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170416/2a15eec4/attachment.html>
More information about the Kde-frameworks-devel
mailing list