[telepathy-gabble/master] tube-dbus: implement Localhost access control

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue May 26 03:11:20 PDT 2009


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

diff --git a/src/tube-dbus.c b/src/tube-dbus.c
index 3a5357d..3ab93f9 100644
--- a/src/tube-dbus.c
+++ b/src/tube-dbus.c
@@ -288,6 +288,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,
@@ -310,6 +318,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. */
@@ -1881,6 +1897,7 @@ gabble_tube_dbus_check_access_control (GabbleTubeDBus *self,
   switch (access_control)
     {
       case TP_SOCKET_ACCESS_CONTROL_CREDENTIALS:
+      case TP_SOCKET_ACCESS_CONTROL_LOCALHOST:
         break;
 
       default:
-- 
1.5.6.5




More information about the telepathy-commits mailing list