Changeset View
Changeset View
Standalone View
Standalone View
wayland_server.cpp
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 211 | bool isTrustedOrigin(KWayland::Server::ClientConnection *client) const { | |||
---|---|---|---|---|---|
220 | return trusted; | 220 | return trusted; | ||
221 | } | 221 | } | ||
222 | 222 | | |||
223 | QStringList fetchRequestedInterfaces(KWayland::Server::ClientConnection *client) const { | 223 | QStringList fetchRequestedInterfaces(KWayland::Server::ClientConnection *client) const { | ||
224 | const auto serviceQuery = QStringLiteral("exist Exec and exist [X-KDE-Wayland-Interfaces] and '%1' =~ Exec").arg(client->executablePath()); | 224 | const auto serviceQuery = QStringLiteral("exist Exec and exist [X-KDE-Wayland-Interfaces] and '%1' =~ Exec").arg(client->executablePath()); | ||
225 | const auto servicesFound = KServiceTypeTrader::self()->query(QStringLiteral("Application"), serviceQuery); | 225 | const auto servicesFound = KServiceTypeTrader::self()->query(QStringLiteral("Application"), serviceQuery); | ||
226 | 226 | | |||
227 | if (servicesFound.isEmpty()) { | 227 | if (servicesFound.isEmpty()) { | ||
228 | qCDebug(KWIN_CORE) << "Could not find the desktop file for" << client->executablePath(); | ||||
zzag: Capitalize the message please. | |||||
228 | return {}; | 229 | return {}; | ||
229 | } | 230 | } | ||
230 | 231 | | |||
231 | return servicesFound.first()->property("X-KDE-Wayland-Interfaces").toStringList(); | 232 | const auto interfaces = servicesFound.first()->property("X-KDE-Wayland-Interfaces").toStringList(); | ||
233 | qCDebug(KWIN_CORE) << "Interfaces for" << client->executablePath() << interfaces; | ||||
234 | return interfaces; | ||||
232 | } | 235 | } | ||
233 | 236 | | |||
234 | QSet<QByteArray> interfacesBlackList = {"org_kde_kwin_remote_access_manager", "org_kde_plasma_window_management", "org_kde_kwin_fake_input", "org_kde_kwin_keystate"}; | 237 | QSet<QByteArray> interfacesBlackList = {"org_kde_kwin_remote_access_manager", "org_kde_plasma_window_management", "org_kde_kwin_fake_input", "org_kde_kwin_keystate"}; | ||
235 | 238 | | |||
236 | bool allowInterface(KWayland::Server::ClientConnection *client, const QByteArray &interfaceName) override { | 239 | bool allowInterface(KWayland::Server::ClientConnection *client, const QByteArray &interfaceName) override { | ||
237 | if (client->processId() == getpid()) { | 240 | if (client->processId() == getpid()) { | ||
238 | return true; | 241 | return true; | ||
239 | } | 242 | } | ||
240 | 243 | | |||
241 | if (!interfacesBlackList.contains(interfaceName)) { | 244 | if (!interfacesBlackList.contains(interfaceName)) { | ||
242 | return true; | 245 | return true; | ||
243 | } | 246 | } | ||
244 | 247 | | |||
245 | if (client->executablePath().isEmpty()) { | 248 | if (client->executablePath().isEmpty()) { | ||
246 | qCWarning(KWIN_CORE) << "Could not identify process with pid" << client->processId(); | 249 | qCWarning(KWIN_CORE) << "Could not identify process with pid" << client->processId(); | ||
247 | return false; | 250 | return false; | ||
248 | } | 251 | } | ||
249 | 252 | | |||
250 | { | 253 | { | ||
251 | auto requestedInterfaces = client->property("requestedInterfaces"); | 254 | auto requestedInterfaces = client->property("requestedInterfaces"); | ||
252 | if (requestedInterfaces.isNull()) { | 255 | if (requestedInterfaces.isNull()) { | ||
253 | requestedInterfaces = fetchRequestedInterfaces(client); | 256 | requestedInterfaces = fetchRequestedInterfaces(client); | ||
254 | client->setProperty("requestedInterfaces", requestedInterfaces); | 257 | client->setProperty("requestedInterfaces", requestedInterfaces); | ||
255 | } | 258 | } | ||
256 | qCDebug(KWIN_CORE) << "interfaces for" << client->executablePath() << requestedInterfaces << interfaceName << requestedInterfaces.toStringList().contains(QString::fromUtf8(interfaceName)); | | |||
257 | if (!requestedInterfaces.toStringList().contains(QString::fromUtf8(interfaceName))) { | 259 | if (!requestedInterfaces.toStringList().contains(QString::fromUtf8(interfaceName))) { | ||
258 | qCWarning(KWIN_CORE) << "Did not grant the interface" << interfaceName << "to" << client->executablePath() << ". Please request it under X-KDE-Wayland-Interfaces"; | 260 | qCWarning(KWIN_CORE) << "Did not grant the interface" << interfaceName << "to" << client->executablePath() << ". Please request it under X-KDE-Wayland-Interfaces"; | ||
259 | return false; | 261 | return false; | ||
260 | } | 262 | } | ||
261 | } | 263 | } | ||
262 | 264 | | |||
263 | { | 265 | { | ||
264 | auto trustedOrigin = client->property("isPrivileged"); | 266 | auto trustedOrigin = client->property("isPrivileged"); | ||
▲ Show 20 Lines • Show All 514 Lines • Show Last 20 Lines |
Capitalize the message please.