summaryrefslogtreecommitdiffstats
path: root/src/manager-lib
diff options
context:
space:
mode:
authorRobert Griebl <[email protected]>2025-02-23 02:39:05 +0100
committerRobert Griebl <[email protected]>2025-06-06 15:27:52 +0200
commit6408f5a017ef3d1328a8e4a4a8e9c65fe9e90e07 (patch)
treec16ac74831dadfc289ebe44a3950e29472b82b97 /src/manager-lib
parent14986b7c2f700d15303c5ee425f98943b36f3d73 (diff)
bwrap: move the DBus and Wayland socket parsing to ContainerHelpersHEADdev
We had to bump the plugin iid for the stop() change, so now's the perfect time to extend the Helpers API. Change-Id: I3070bbb12c721027594d629311f67890c6924696 Pick-to: 6.10 Reviewed-by: Dominik Holland <[email protected]>
Diffstat (limited to 'src/manager-lib')
-rw-r--r--src/manager-lib/plugincontainer.cpp26
-rw-r--r--src/manager-lib/plugincontainer.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/src/manager-lib/plugincontainer.cpp b/src/manager-lib/plugincontainer.cpp
index daabe0e4..63a8792a 100644
--- a/src/manager-lib/plugincontainer.cpp
+++ b/src/manager-lib/plugincontainer.cpp
@@ -206,6 +206,32 @@ int PluginContainerHelperFunctions::watchdogSignal()
return UnixSignalHandler::watchdogSignal();
}
+QString PluginContainerHelperFunctions::checkDBusSocketPath(const QString &dbusAddress, const QByteArray &typeHint)
+{
+ // parse the actual socket file name from the DBus address specification
+ QString socketPath = dbusAddress;
+ socketPath = socketPath.mid(socketPath.indexOf(u'=') + 1);
+ socketPath = socketPath.left(socketPath.indexOf(u','));
+ QFileInfo socketInfo(socketPath);
+ if (!socketInfo.exists()) {
+ QByteArray err = typeHint + " DBus socket doesn't exist: " + socketPath.toLocal8Bit();
+ throw std::runtime_error(err);
+ }
+ return socketInfo.absoluteFilePath();
+}
+
+QString PluginContainerHelperFunctions::checkWaylandSocketPath(const QString &xdgRuntimeDir, const QString &waylandDisplay)
+{
+ // parse the wayland socket name from wayland env variables
+ QString socketPath = xdgRuntimeDir + u'/' + waylandDisplay;
+ QFileInfo socketInfo(socketPath);
+ if (!socketInfo.exists()) {
+ QByteArray err = "Wayland socket doesn't exist: " + socketPath.toLocal8Bit();
+ throw std::runtime_error(err);
+ }
+ return socketInfo.absoluteFilePath();
+}
+
QT_END_NAMESPACE_AM
#include "moc_plugincontainer.cpp"
diff --git a/src/manager-lib/plugincontainer.h b/src/manager-lib/plugincontainer.h
index ddb575c0..5aa98c56 100644
--- a/src/manager-lib/plugincontainer.h
+++ b/src/manager-lib/plugincontainer.h
@@ -24,6 +24,9 @@ public:
quint64 namespacePid) override;
int watchdogSignal() override;
+
+ QString checkDBusSocketPath(const QString &dbusAddress, const QByteArray &typeHint) override;
+ QString checkWaylandSocketPath(const QString &xdgRuntimeDir, const QString &waylandDisplay) override;
};
class PluginContainerManager : public AbstractContainerManager