#include "utils.h"
#include "signals.h"
#include "expirelist.h"
+#include "selinux.h"
#include <dbus/dbus-list.h>
#include <dbus/dbus-hash.h>
#include <dbus/dbus-timeout.h>
DBusPreallocatedSend *oom_preallocated;
BusClientPolicy *policy;
+ BusSELinuxID *selinux_id;
+
long connection_tv_sec; /**< Time when we connected (seconds component) */
long connection_tv_usec; /**< Time when we connected (microsec component) */
int stamp; /**< connections->stamp last time we were traversed */
if (d->policy)
bus_client_policy_unref (d->policy);
+
+ if (d->selinux_id)
+ bus_selinux_id_unref (d->selinux_id);
dbus_free (d->name);
{
BusConnectionData *d;
dbus_bool_t retval;
+ DBusError error;
d = dbus_new0 (BusConnectionData, 1);
}
retval = FALSE;
+
+ dbus_error_init (&error);
+ d->selinux_id = bus_selinux_init_connection_id (connection,
+ &error);
+ if (dbus_error_is_set (&error))
+ {
+ /* This is a bit bogus because we pretend all errors
+ * are OOM; this is done because we know that in bus.c
+ * an OOM error disconnects the connection, which is
+ * the same thing we want on any other error.
+ */
+ dbus_error_free (&error);
+ goto out;
+ }
if (!dbus_connection_set_watch_functions (connection,
add_connection_watch,
out:
if (!retval)
- {
+ {
+ if (d->selinux_id)
+ bus_selinux_id_unref (d->selinux_id);
+ d->selinux_id = NULL;
+
if (!dbus_connection_set_watch_functions (connection,
NULL, NULL, NULL,
connection,
return bus_context_get_matchmaker (d->connections->context);
}
+BusSELinuxID*
+bus_connection_get_selinux_id (DBusConnection *connection)
+{
+ BusConnectionData *d;
+
+ d = BUS_CONNECTION_DATA (connection);
+
+ _dbus_assert (d != NULL);
+
+ return d->selinux_id;
+}
+
/**
* Checks whether the connection is registered with the message bus.
*