[gnome-builder/gnome-builder-3-32] gui: restrict accepted auth mechanisms



commit 6b1b3b271120956674bb6afe0a5fccd7c7e13570
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 5 10:42:50 2019 -0700

    gui: restrict accepted auth mechanisms
    
    We only need to support EXTERNAL here given our use-case.

 src/libide/gui/ide-worker-manager.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/libide/gui/ide-worker-manager.c b/src/libide/gui/ide-worker-manager.c
index 048c0ad3b..21caa909b 100644
--- a/src/libide/gui/ide-worker-manager.c
+++ b/src/libide/gui/ide-worker-manager.c
@@ -47,6 +47,17 @@ G_DEFINE_TYPE (IdeWorkerManager, ide_worker_manager, G_TYPE_OBJECT)
 
 DZL_DEFINE_COUNTER (instances, "IdeWorkerManager", "Instances", "Number of IdeWorkerManager instances")
 
+static gboolean
+ide_worker_manager_allow_mechanism_cb (IdeWorkerManager  *self,
+                                       const gchar       *mechanism,
+                                       GDBusAuthObserver *auth_observer)
+{
+  g_assert (IDE_IS_WORKER_MANAGER (self));
+  g_assert (G_IS_DBUS_AUTH_OBSERVER (auth_observer));
+
+  return ide_str_equal0 ("EXTERNAL", mechanism);
+}
+
 static gboolean
 ide_worker_manager_authorize_authenticated_peer_cb (IdeWorkerManager  *self,
                                                     GIOStream         *stream,
@@ -141,6 +152,12 @@ ide_worker_manager_constructed (GObject *object)
 
   self->auth_observer = g_dbus_auth_observer_new ();
 
+  g_signal_connect_object (self->auth_observer,
+                           "allow-mechanism",
+                           G_CALLBACK (ide_worker_manager_allow_mechanism_cb),
+                           self,
+                           G_CONNECT_SWAPPED);
+
   g_signal_connect_object (self->auth_observer,
                            "authorize-authenticated-peer",
                            G_CALLBACK (ide_worker_manager_authorize_authenticated_peer_cb),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]