Changeset View
Changeset View
Standalone View
Standalone View
wayland_server.cpp
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Line(s) | 214 | if (f.open(QFile::ReadOnly)) { | |||
---|---|---|---|---|---|
216 | if (hash.addData(&f)) { | 216 | if (hash.addData(&f)) { | ||
217 | return hash.result(); | 217 | return hash.result(); | ||
218 | } | 218 | } | ||
219 | } | 219 | } | ||
220 | return QByteArray(); | 220 | return QByteArray(); | ||
221 | } | 221 | } | ||
222 | 222 | | |||
223 | bool isTrustedOrigin(KWayland::Server::ClientConnection *client) const { | 223 | bool isTrustedOrigin(KWayland::Server::ClientConnection *client) const { | ||
224 | const auto fullPathSha = sha256(QStringLiteral("/proc/") + QString::number(client->processId()) + QLatin1String("/root") + client->executablePath()); | 224 | const auto fullPathSha = sha256(client->executablePath()); | ||
225 | const auto localSha = sha256(QLatin1String("/proc/") + QString::number(client->processId()) + QLatin1String("/exe")); | 225 | const auto localSha = sha256(QLatin1String("/proc/") + QString::number(client->processId()) + QLatin1String("/exe")); | ||
226 | const bool trusted = !localSha.isEmpty() && fullPathSha == localSha; | 226 | const bool trusted = !localSha.isEmpty() && fullPathSha == localSha; | ||
227 | 227 | | |||
228 | if (!trusted) { | 228 | if (!trusted) { | ||
229 | qCWarning(KWIN_CORE) << "Could not trust" << client->executablePath() << "sha" << localSha << fullPathSha; | 229 | qCWarning(KWIN_CORE) << "Could not trust" << client->executablePath() << "sha" << localSha << fullPathSha; | ||
230 | } | 230 | } | ||
231 | 231 | | |||
232 | return trusted; | 232 | return trusted; | ||
▲ Show 20 Lines • Show All 599 Lines • Show Last 20 Lines |