Changeset View
Changeset View
Standalone View
Standalone View
src/core/kdesktopfile.cpp
Show All 29 Lines | |||||
30 | #include <QUrl> | 30 | #include <QUrl> | ||
31 | #include <qstandardpaths.h> | 31 | #include <qstandardpaths.h> | ||
32 | 32 | | |||
33 | #include "kauthorized.h" | 33 | #include "kauthorized.h" | ||
34 | #include "kconfig_p.h" | 34 | #include "kconfig_p.h" | ||
35 | #include "kconfiggroup.h" | 35 | #include "kconfiggroup.h" | ||
36 | #include "kconfigini_p.h" | 36 | #include "kconfigini_p.h" | ||
37 | 37 | | |||
38 | #include <QLoggingCategory> | ||||
39 | Q_LOGGING_CATEGORY(kconfigLoggingDesktop, "kf5.kconfig.kdesktopfile") | ||||
40 | | ||||
38 | class KDesktopFilePrivate : public KConfigPrivate | 41 | class KDesktopFilePrivate : public KConfigPrivate | ||
39 | { | 42 | { | ||
40 | public: | 43 | public: | ||
41 | KDesktopFilePrivate(QStandardPaths::StandardLocation resourceType, const QString &fileName); | 44 | KDesktopFilePrivate(QStandardPaths::StandardLocation resourceType, const QString &fileName); | ||
42 | KConfigGroup desktopGroup; | 45 | KConfigGroup desktopGroup; | ||
43 | }; | 46 | }; | ||
44 | 47 | | |||
45 | KDesktopFilePrivate::KDesktopFilePrivate(QStandardPaths::StandardLocation resourceType, const QString &fileName) | 48 | KDesktopFilePrivate::KDesktopFilePrivate(QStandardPaths::StandardLocation resourceType, const QString &fileName) | ||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 154 | if (QDir(xdgDataPrefix).exists()) { | |||
153 | if (realPath.startsWith(prefix + QLatin1Char('/') + autostartDir, sensitivity)) { | 156 | if (realPath.startsWith(prefix + QLatin1Char('/') + autostartDir, sensitivity)) { | ||
154 | return true; | 157 | return true; | ||
155 | } | 158 | } | ||
156 | } | 159 | } | ||
157 | } | 160 | } | ||
158 | 161 | | |||
159 | // Forbid desktop files outside of standard locations if kiosk is set so | 162 | // Forbid desktop files outside of standard locations if kiosk is set so | ||
160 | if (!KAuthorized::authorize(QStringLiteral("run_desktop_files"))) { | 163 | if (!KAuthorized::authorize(QStringLiteral("run_desktop_files"))) { | ||
161 | qWarning() << "Access to '" << path << "' denied because of 'run_desktop_files' restriction." << endl; | 164 | qCWarning(kconfigLoggingDesktop) << "Access to '" << path << "' denied because of 'run_desktop_files' restriction." << endl; | ||
162 | return false; | 165 | return false; | ||
163 | } | 166 | } | ||
164 | 167 | | |||
165 | // Not otherwise permitted, so only allow if the file is executable, or if | 168 | // Not otherwise permitted, so only allow if the file is executable, or if | ||
166 | // owned by root (uid == 0) | 169 | // owned by root (uid == 0) | ||
167 | QFileInfo entryInfo(path); | 170 | QFileInfo entryInfo(path); | ||
168 | if (entryInfo.isExecutable() || entryInfo.ownerId() == 0) { | 171 | if (entryInfo.isExecutable() || entryInfo.ownerId() == 0) { | ||
169 | return true; | 172 | return true; | ||
170 | } | 173 | } | ||
171 | 174 | | |||
172 | qWarning() << "Access to '" << path << "' denied, not owned by root, executable flag not set." << endl; | 175 | qCWarning(kconfigLoggingDesktop) << "Access to '" << path << "' denied, not owned by root, executable flag not set." << endl; | ||
173 | return false; | 176 | return false; | ||
174 | } | 177 | } | ||
175 | 178 | | |||
176 | QString KDesktopFile::readType() const | 179 | QString KDesktopFile::readType() const | ||
177 | { | 180 | { | ||
178 | Q_D(const KDesktopFile); | 181 | Q_D(const KDesktopFile); | ||
179 | return d->desktopGroup.readEntry("Type", QString()); | 182 | return d->desktopGroup.readEntry("Type", QString()); | ||
180 | } | 183 | } | ||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |