Commit c08eb927 authored by Matti Kosola's avatar Matti Kosola

Merge branch 'jb49389' into 'master'

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

See merge request !53
parents ee518870 c11e2f19
[Unit]
Description=Nemo device lock socket
DefaultDependencies=no
After=local-fs.target
Before=shutdown.target
Conflicts=shutdown.target
[Socket]
ListenStream=/run/nemo-devicelock/socket
Accept=false
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.nemomobile.devicelock" />
</policy>
<policy context="default">
<allow send_destination="org.nemomobile.devicelock" />
</policy>
</busconfig>
......@@ -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