[gvfs/gnome-3-32] afc: Remove assumptions about length of device UUID
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-32] afc: Remove assumptions about length of device UUID
- Date: Tue, 30 Apr 2019 07:36:45 +0000 (UTC)
commit 042acffb15bcebecce1f75d1b0deb94ae66cce7c
Author: Philip Langdale <philipl overt org>
Date: Sun Apr 28 19:26:06 2019 -0700
afc: Remove assumptions about length of device UUID
Modern Apple devices have UUIDs that are not 40 digits long, as used
to be the case. Accordingly, a recent change in libimobiledevice
removed any assumptions around the UUID length, and we should do the
same in the afc backend. Without this change, we see a symptom where
the volume monitor and backend disagree on the expected mount root.
I have tested this on a 2018 iPad pro (iPad8,3) which has a 24 digit
UUID.
daemon/gvfsbackendafc.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 79c7911a..bcc1f79c 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -9,7 +9,6 @@
#include <limits.h>
#include <stdint.h>
-#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -73,7 +72,7 @@ typedef struct {
struct _GVfsBackendAfc {
GVfsBackend backend;
- char uuid[41];
+ char *uuid;
char *service;
char *model;
gboolean connected;
@@ -472,16 +471,11 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
{
g_vfs_job_failed (G_VFS_JOB (job),
G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
- _("Invalid mount spec"));
- return;
- }
- if (G_UNLIKELY(sscanf(str, "%40s", (char *) &self->uuid) < 1))
- {
- g_vfs_job_failed (G_VFS_JOB(job), G_IO_ERROR, G_IO_ERROR_FAILED,
_("Invalid AFC location: must be in the form of "
"afc://uuid:port-number"));
return;
}
+ self->uuid = g_strdup (str);
str = g_mount_spec_get (spec, "port");
if (str == NULL)
@@ -519,9 +513,7 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
display_name = NULL;
real_spec = g_mount_spec_new ("afc");
- tmp = g_strdup_printf ("%40s", (char *) &self->uuid);
- g_mount_spec_set (real_spec, "host", tmp);
- g_free (tmp);
+ g_mount_spec_set (real_spec, "host", self->uuid);
/* INFO: Don't ever set the DefaultPort again or everything goes crazy */
if (virtual_port != VIRTUAL_PORT_AFC)
@@ -2752,6 +2744,8 @@ g_vfs_backend_afc_finalize (GObject *obj)
self->force_umount_id = 0;
}
+ g_free (self->uuid);
+
if (G_OBJECT_CLASS(g_vfs_backend_afc_parent_class)->finalize)
(*G_OBJECT_CLASS(g_vfs_backend_afc_parent_class)->finalize) (obj);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]