summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-09-10 08:27:13 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-09-10 08:27:13 (GMT)
commit27d3905f3d08ef0498ceba1eeb367403cf9f2980 (patch)
tree21595c15c4b2ed101cbe6d14a9d90382f3154075 /src/corelib/plugin
parent20a61e1cf39ee66cf0880c6f8f36634115cf610e (diff)
downloadQt-27d3905f3d08ef0498ceba1eeb367403cf9f2980.zip
Qt-27d3905f3d08ef0498ceba1eeb367403cf9f2980.tar.gz
Qt-27d3905f3d08ef0498ceba1eeb367403cf9f2980.tar.bz2
Fixed various PlatSec violations when app had no AllFiles capability.
Fixed QtCore in various places that caused Platform Security violations in Symbian if AllFiles capability was missing from the application. All of these these were caused by trying to access /private folder unnecessarily, either by Qt code or Open C. Task-number: 249008 Reviewed-by: Janne Koskinen
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qpluginloader.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index eb963d0..7b3f011 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -48,6 +48,11 @@
#include "qdebug.h"
#include "qdir.h"
+#if defined(Q_OS_SYMBIAN)
+# include <f32file.h>
+# include "private/qcore_symbian_p.h"
+#endif
+
#ifndef QT_NO_LIBRARY
QT_BEGIN_NAMESPACE
@@ -309,10 +314,18 @@ void QPluginLoader::setFileName(const QString &fileName)
if (stubPath.at(1).toAscii() == ':')
stubPath.remove(0,2);
QFileInfoList driveList(QDir::drives());
+ RFs rfs = qt_s60GetRFs();
foreach(const QFileInfo& drive, driveList) {
QString testFilePath(drive.absolutePath() + stubPath);
testFilePath = QDir::cleanPath(testFilePath);
- if (QFile::exists(testFilePath)) {
+ // Use native Symbian code to check for file existence, because checking
+ // for file from under non-existent protected dir like E:/private/<uid> using
+ // QFile::exists causes platform security violations on most apps.
+ QString nativePath = QDir::toNativeSeparators(testFilePath);
+ TPtrC ptr(qt_QString2TPtrC(nativePath));
+ TUint attributes;
+ TInt err = rfs.Att(ptr, attributes);
+ if (err == KErrNone) {
fn = testFilePath;
break;
}