Commit c11e2f19 authored by NotKit's avatar NotKit

[devicelock] use systemd-provided socket for hostservice. Fixes JB#49389

Adjust socket permissions for nemo-sevicelock.socket to make it
accessible by root:privileged.
parent 95c06847
......@@ -80,7 +80,7 @@ private:
};
HostService::HostService(const QVector<HostObject *> objects, QObject *parent)
: QDBusServer(QStringLiteral("unix:path=/run/nemo-devicelock/socket"), parent)
: QDBusServer(HostService::socketAddress(), parent)
, m_objects(objects)
{
setAnonymousAuthenticationAllowed(true);
......@@ -175,6 +175,15 @@ void HostService::connectionReady(const QDBusConnection &newConnection)
}
}
QString HostService::socketAddress()
{
// Check if socket-based activation logic is enabled and at least one fd is provided
if (sd_listen_fds(0) > 0)
return QStringLiteral("systemd:");
return QStringLiteral("unix:path=/run/nemo-devicelock/socket");
}
}
#include "hostservice.moc"
......@@ -69,6 +69,7 @@ private:
friend class ConnectionMonitor;
void connectionReady(const QDBusConnection &connection);
static QString socketAddress();
const QVector<HostObject *> m_objects;
};
......
......@@ -8,3 +8,6 @@ Conflicts=shutdown.target
[Socket]
ListenStream=/run/nemo-devicelock/socket
Accept=false
SocketUser=root
SocketGroup=privileged
SocketMode=0660
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment