[gvfs/gnome-3-20] afc: Fix volume init with a locked device



commit 423e57649c856e18d776aa80955db385f70df2bb
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jun 8 15:50:04 2016 +0200

    afc: Fix volume init with a locked device
    
    The first time we connect the device, we won't be able to create a
    lockdown client with a handshake, so the volume won't be created at all
    and will not show up in nautilus.
    
    Furthermore, we were checking the OS version with a paired lockdown
    client (which is not needed, an unpaired one will do just as well)
    and checking whether HouseArrest was supported even if the service was
    different.
    
    So, we never needed to have a paired lockdown client in the first place,
    and we only need to check for the OS version if HouseArrest is what was
    requested.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767399

 monitor/afc/afcvolume.c |   32 ++++++++++----------------------
 1 files changed, 10 insertions(+), 22 deletions(-)
---
diff --git a/monitor/afc/afcvolume.c b/monitor/afc/afcvolume.c
index e1731ee..11871bf 100644
--- a/monitor/afc/afcvolume.c
+++ b/monitor/afc/afcvolume.c
@@ -142,32 +142,20 @@ _g_vfs_afc_volume_update_metadata (GVfsAfcVolume *self)
   if (err != IDEVICE_E_SUCCESS)
     return 0;
 
-  if (self->service != NULL)
+  lerr = lockdownd_client_new (dev, &lockdown_cli, "gvfs-afc-volume-monitor");
+  if (lerr != LOCKDOWN_E_SUCCESS)
     {
-      if (lockdownd_client_new_with_handshake (dev, &lockdown_cli, "gvfs-afc-volume-monitor") != 
LOCKDOWN_E_SUCCESS)
-        {
-          idevice_free (dev);
-          return 0;
-        }
-      if (!_g_vfs_afc_volume_check_house_arrest_version (lockdown_cli))
-        {
-          lockdownd_service_descriptor_free (lockdown_service);
-          idevice_free (dev);
-          return 0;
-        }
-      lerr = lockdownd_start_service(lockdown_cli, "com.apple.mobile.house_arrest", &lockdown_service);
-      lockdownd_service_descriptor_free (lockdown_service);
-      if (lerr != LOCKDOWN_E_SUCCESS)
-        {
-          g_warning ("Couldn't start com.apple.mobile.house_arrest for UUID %s: %d", self->uuid, lerr);
-          idevice_free (dev);
-          return 0;
-        }
+      g_debug ("Failed to create a client with handshake (%d)\n", lerr);
+      idevice_free (dev);
+      return 0;
     }
-  else
+
+  if (g_strcmp0 (self->service, HOUSE_ARREST_SERVICE_PORT) == 0)
     {
-      if (lockdownd_client_new (dev, &lockdown_cli, "gvfs-afc-volume-monitor") != LOCKDOWN_E_SUCCESS)
+      if (!_g_vfs_afc_volume_check_house_arrest_version (lockdown_cli))
         {
+          g_debug ("Failed to check HouseArrest version\n");
+          lockdownd_service_descriptor_free (lockdown_service);
           idevice_free (dev);
           return 0;
         }


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