[telepathy-salut/master] tube-dbus: actually implement the LocalHost access control

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Jun 26 07:28:18 PDT 2009


---
 src/tube-dbus.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/tube-dbus.c b/src/tube-dbus.c
index 9862b44..bab0e96 100644
--- a/src/tube-dbus.c
+++ b/src/tube-dbus.c
@@ -322,6 +322,14 @@ out:
   return DBUS_HANDLER_RESULT_HANDLED;
 }
 
+static dbus_bool_t
+allow_all_connections (DBusConnection *conn,
+                       unsigned long uid,
+                       void *data)
+{
+  return TRUE;
+}
+
 static void
 new_connection_cb (DBusServer *server,
                    DBusConnection *conn,
@@ -344,6 +352,14 @@ new_connection_cb (DBusServer *server,
   dbus_connection_add_filter (conn, filter_cb, tube, NULL);
   priv->dbus_conn = conn;
 
+  if (priv->access_control == TP_SOCKET_ACCESS_CONTROL_LOCALHOST)
+    {
+      /* By default libdbus use Credentials access control. If user wants
+       * to use the Localhost access control, we need to bypass this check. */
+      dbus_connection_set_unix_user_function (conn, allow_all_connections,
+          NULL, NULL);
+    }
+
   /* We may have received messages to deliver before the local connection is
    * established. Theses messages are kept in the dbus_msg_queue list and are
    * delivered as soon as we get the connection. */
-- 
1.5.6.5



More information about the telepathy-commits mailing list