Removed authenticate the connection for kdbus transport
authorLukasz Skalski <l.skalski@partner.samsung.com>
Fri, 25 Oct 2013 11:44:36 +0000 (13:44 +0200)
committerLukasz Skalski <l.skalski@partner.samsung.com>
Fri, 25 Oct 2013 14:03:51 +0000 (16:03 +0200)
gio/gdbusconnection.c

index f4c63a9..ae654a5 100644 (file)
 #include "gdbusaddress.h"
 #include "gdbusmessage.h"
 #include "gdbusconnection.h"
+#include "gkdbusconnection.h"
 #include "gdbuserror.h"
 #include "gioenumtypes.h"
 #include "gdbusintrospection.h"
@@ -2579,44 +2580,46 @@ initable_init (GInitable     *initable,
       g_assert_not_reached ();
     }
 
-  /* Authenticate the connection */
-  if (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER)
-    {
-      g_assert (!(connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT));
-      g_assert (connection->guid != NULL);
-      connection->auth = _g_dbus_auth_new (connection->stream);
-      if (!_g_dbus_auth_run_server (connection->auth,
-                                    connection->authentication_observer,
-                                    connection->guid,
-                                    (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS),
-                                    get_offered_capabilities_max (connection),
-                                    &connection->capabilities,
-                                    &connection->credentials,
-                                    cancellable,
-                                    &connection->initialization_error))
-        goto out;
-    }
-  else if (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT)
+  if (!G_IS_KDBUS_CONNECTION (connection->stream))
     {
-      g_assert (!(connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER));
-      g_assert (connection->guid == NULL);
-      connection->auth = _g_dbus_auth_new (connection->stream);
-      connection->guid = _g_dbus_auth_run_client (connection->auth,
-                                                  connection->authentication_observer,
-                                                  get_offered_capabilities_max (connection),
-                                                  &connection->capabilities,
-                                                  cancellable,
-                                                  &connection->initialization_error);
-      if (connection->guid == NULL)
-        goto out;
-    }
-
-  if (connection->authentication_observer != NULL)
-    {
-      g_object_unref (connection->authentication_observer);
-      connection->authentication_observer = NULL;
-    }
+      /* Authenticate the connection */
+      if (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER)
+        {
+          g_assert (!(connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT));
+          g_assert (connection->guid != NULL);
+          connection->auth = _g_dbus_auth_new (connection->stream);
+          if (!_g_dbus_auth_run_server (connection->auth,
+                                        connection->authentication_observer,
+                                        connection->guid,
+                                        (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS),
+                                        get_offered_capabilities_max (connection),
+                                        &connection->capabilities,
+                                        &connection->credentials,
+                                        cancellable,
+                                        &connection->initialization_error))
+            goto out;
+        }
+      else if (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT)
+        {
+          g_assert (!(connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER));
+          g_assert (connection->guid == NULL);
+          connection->auth = _g_dbus_auth_new (connection->stream);
+          connection->guid = _g_dbus_auth_run_client (connection->auth,
+                                                      connection->authentication_observer,
+                                                      get_offered_capabilities_max (connection),
+                                                      &connection->capabilities,
+                                                      cancellable,
+                                                      &connection->initialization_error);
+          if (connection->guid == NULL)
+            goto out;
+        }
 
+      if (connection->authentication_observer != NULL)
+        {
+          g_object_unref (connection->authentication_observer);
+          connection->authentication_observer = NULL;
+        }
+  }
   //g_output_stream_flush (G_SOCKET_CONNECTION (connection->stream)
 
   //g_debug ("haz unix fd passing powers: %d", connection->capabilities & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING);