[gnome-bluetooth/gnome-3-10] wizard: Don't handle remote-initiated pairings



commit 60b39bce9f49e2a0cefd0c47e94dfb326caf0150
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Nov 27 15:26:54 2013 +0100

    wizard: Don't handle remote-initiated pairings
    
    For now. We didn't in the past, and we don't have the UI for it
    either.

 wizard/main.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 51b2316..fb76a16 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -203,10 +203,35 @@ replace_target_properties_for_device (GDBusProxy *device)
 }
 
 static gboolean
+is_target_device (GDBusProxy *device)
+{
+       GVariant *value;
+       gboolean ret = FALSE;
+
+       value = g_dbus_proxy_get_cached_property (device, "Address");
+       if (!value)
+               return FALSE;
+
+       if (g_strcmp0 (g_variant_get_string (value, NULL), target_address) == 0)
+               ret = TRUE;
+       g_variant_unref (value);
+
+       return ret;
+}
+
+static gboolean
 pincode_callback (GDBusMethodInvocation *invocation,
                  GDBusProxy *device,
                  gpointer user_data)
 {
+       if (create_started == FALSE ||
+           !is_target_device (device)) {
+               g_dbus_method_invocation_return_dbus_error (invocation,
+                                                           "org.bluez.Error.Rejected",
+                                                           "Rejected remote-initiated pairing");
+               return TRUE;
+       }
+
        replace_target_properties_for_device (device);
 
        if (user_pincode == NULL) {


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