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