// enable bus daemon usage statistics
DBUS_ENABLE_STATS:BOOL=OFF
+// enable restricted servers for app containers
+DBUS_ENABLE_CONTAINERS:BOOL=OFF
+
// support verbose debug mode
DBUS_ENABLE_VERBOSE_MODE:BOOL=ON
config-parser-common.h \
connection.c \
connection.h \
+ containers.c \
+ containers.h \
desktop-file.c \
desktop-file.h \
$(DIR_WATCH_SOURCE) \
--- /dev/null
+/* containers.c - restricted bus servers for containers
+ *
+ * Copyright © 2017 Collabora Ltd.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <config.h>
+#include "containers.h"
+
+#ifdef DBUS_ENABLE_CONTAINERS
+
+#ifndef DBUS_UNIX
+# error DBUS_ENABLE_CONTAINERS requires DBUS_UNIX
+#endif
+
+dbus_bool_t
+bus_containers_handle_add_server (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented");
+ return FALSE;
+}
+
+dbus_bool_t
+bus_containers_supported_arguments_getter (BusContext *context,
+ DBusMessageIter *var_iter)
+{
+ DBusMessageIter arr_iter;
+
+ /* There are none so far */
+ return dbus_message_iter_open_container (var_iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING,
+ &arr_iter) &&
+ dbus_message_iter_close_container (var_iter, &arr_iter);
+}
+
+#endif /* DBUS_ENABLE_CONTAINERS */
--- /dev/null
+/* containers.h - restricted bus servers for containers
+ *
+ * Copyright © 2017 Collabora Ltd.
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef BUS_CONTAINERS_H
+#define BUS_CONTAINERS_H
+
+#include "bus.h"
+
+dbus_bool_t bus_containers_handle_add_server (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error);
+dbus_bool_t bus_containers_supported_arguments_getter (BusContext *context,
+ DBusMessageIter *var_iter);
+
+#endif /* multiple-inclusion guard */
#include "activation.h"
#include "apparmor.h"
#include "connection.h"
+#include "containers.h"
#include "driver.h"
#include "dispatch.h"
#include "services.h"
{ NULL, NULL, NULL, NULL }
};
+#ifdef DBUS_ENABLE_CONTAINERS
+static const MessageHandler containers_message_handlers[] = {
+ { "AddServer", "ssa{sv}a{sv}", "oays", bus_containers_handle_add_server,
+ METHOD_FLAG_PRIVILEGED },
+ { NULL, NULL, NULL, NULL }
+};
+static const PropertyHandler containers_property_handlers[] = {
+ { "SupportedArguments", "as", bus_containers_supported_arguments_getter },
+ { NULL, NULL, NULL }
+};
+#endif
+
static const MessageHandler monitoring_message_handlers[] = {
{ "BecomeMonitor", "asu", "", bus_driver_handle_become_monitor,
METHOD_FLAG_PRIVILEGED },
#ifdef DBUS_ENABLE_STATS
{ BUS_INTERFACE_STATS, stats_message_handlers, NULL,
INTERFACE_FLAG_NONE },
+#endif
+#ifdef DBUS_ENABLE_CONTAINERS
+ { DBUS_INTERFACE_CONTAINERS1, containers_message_handlers, NULL,
+ INTERFACE_FLAG_NONE, containers_property_handlers },
#endif
{ DBUS_INTERFACE_PEER, peer_message_handlers, NULL,
/* Not in the Interfaces property because it's a pseudo-interface
option (DBUS_DISABLE_ASSERT "Disable assertion checking" OFF)
option (DBUS_ENABLE_STATS "enable bus daemon usage statistics" OFF)
+option (DBUS_ENABLE_CONTAINERS "enable restricted servers for app-containers" OFF)
if(WIN32)
set(FD_SETSIZE "8192" CACHE STRING "The maximum number of connections that can be handled at once")
# ${BUS_DIR}/config-parser-trivial.c
${BUS_DIR}/connection.c
${BUS_DIR}/connection.h
+ ${BUS_DIR}/containers.c
+ ${BUS_DIR}/containers.h
${BUS_DIR}/desktop-file.c
${BUS_DIR}/desktop-file.h
${BUS_DIR}/dir-watch.h
#cmakedefine DBUS_RUNSTATEDIR "@DBUS_RUNSTATEDIR@"
#cmakedefine DBUS_ENABLE_STATS
+#cmakedefine DBUS_ENABLE_CONTAINERS
#define TEST_LISTEN "@TEST_LISTEN@"
AM_CONDITIONAL([DBUS_ENABLE_USER_SESSION],
[test "x$enable_user_session" = xyes])
+AC_ARG_ENABLE([containers],
+ [AS_HELP_STRING([--enable-containers],
+ [enable restricted servers for app containers])],
+ [], [enable_containers=no])
+AS_IF([test "x$enable_containers" = xyes && test "x$dbus_unix" != xyes],
+ [AC_MSG_ERROR([Restricted servers for app containers require Unix])])
+AS_IF([test "x$enable_containers" = xyes],
+ [AC_DEFINE([DBUS_ENABLE_CONTAINERS], [1],
+ [Define to enable restricted servers for app containers])])
+
AC_CONFIG_FILES([
Doxyfile
dbus/Version
Building assertions: ${enable_asserts}
Building checks: ${enable_checks}
Building bus stats API: ${enable_stats}
+ Building container API: ${enable_containers}
Building SELinux support: ${have_selinux}
Building AppArmor support: ${have_apparmor}
Building inotify support: ${have_inotify}
*/
/** The interface exported by the object with #DBUS_SERVICE_DBUS and #DBUS_PATH_DBUS */
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
+/** The restricted container interface exported by the dbus-daemon */
+#define DBUS_INTERFACE_CONTAINERS1 "org.freedesktop.DBus.Containers1"
/** The monitoring interface exported by the dbus-daemon */
#define DBUS_INTERFACE_MONITORING "org.freedesktop.DBus.Monitoring"