qt5base-lts/tests/auto/corelib/io
Thiago Macieira ad5a65b6a2 QStandardPaths/Unix: improve the XDG_RUNTIME_DIR creation/detection
First, use QT_MKDIR instead of QFileSystemEngine::createDirectory(), as
the latter can't create a directory with the right permissions. That
would allow an attacker to briefly obtain access to the runtime dir
between the mkdir() and chmod() system calls.

Second, make sure that if the target already exists that it is a
directory and not a symlink (even to a directory). If it is a symlink
that belongs to another user, it can be changed to point to another
place, which we won't like.

And as a bonus, we're printing more information to the user in case
something went wrong. Sample outputs:

 QStandardPaths: runtime directory '/root' is not owned by UID 1000, but a directory permissions 0700 owned by UID 0 GID 0

 QStandardPaths: runtime directory '/dev/null' is not a directory, but a character device, socket or FIFO permissions 0666 owned by UID 0 GID 0

 QStandardPaths: runtime directory '/etc/passwd' is not a directory, but a regular file permissions 0644 owned by UID 0 GID 0

 QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-tjmaciei'
 QStandardPaths: runtime directory '/tmp/runtime-tjmaciei' is not a directory, but a symbolic link to a directory permissions 0755 owned by UID 1000 GID 100

Pick-to: 5.15 5.12 5.9
Change-Id: Iea47e0f8fc8b40378df7fffd16248b663794c613
Reviewed-by: David Faure <david.faure@kdab.com>
2020-08-25 16:13:44 -07:00
..
largefile CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qabstractfileengine CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qbuffer CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qdataurl CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qdebug Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
qdir Disable warning about self-move and self-assign-overload 2020-07-26 18:06:34 +02:00
qdiriterator CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qfile CMake: Regenerate subdir test projects 2020-07-09 09:38:39 +02:00
qfileinfo QFileInfo: purge deprecated API 2020-08-07 17:44:51 +02:00
qfileselector Remove winrt 2020-06-06 20:25:49 +02:00
qfilesystementry CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qfilesystemmetadata CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qfilesystemwatcher CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qiodevice CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qipaddress CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qlockfile CMake: Regenerate subdir test projects 2020-07-09 09:38:39 +02:00
qloggingcategory CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qloggingregistry CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qnodebug CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qprocess Use QList instead of QVector in corelib tests 2020-07-07 11:48:45 +02:00
qprocess-noapplication CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qprocessenvironment CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qresourceengine Purge QResource of some deprecated API 2020-08-07 17:44:13 +02:00
qsavefile CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qsettings Implement QMetaType::canConvert() and use it in QVariant 2020-08-24 00:18:24 +02:00
qstandardpaths QStandardPaths/Unix: improve the XDG_RUNTIME_DIR creation/detection 2020-08-25 16:13:44 -07:00
qstorageinfo CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qtemporarydir CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qtemporaryfile Fix test with cmake build 2020-08-16 11:53:29 +02:00
qurl QUrl: purge deprecated API 2020-07-20 16:06:28 +02:00
qurlinternal Purge redundant recoding of URL fragments from QByteArray 2020-07-27 11:25:49 +02:00
qurlquery CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
.prev_CMakeLists.txt Remove winrt 2020-06-06 20:25:49 +02:00
CMakeLists.txt CMake: Skip building tst_qprocess test when cross compiling 2020-06-26 14:54:32 +02:00
io.pro Remove winrt 2020-06-06 20:25:49 +02:00