summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendafc.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2019-04-28 19:26:06 -0700
committerPhilip Langdale <philipl@overt.org>2019-04-29 20:12:37 -0700
commita021631a2509ca84b54ed399819a0a4c5734ca70 (patch)
tree87411acc9459ec73e978b54177a2bdd805c6cb84 /daemon/gvfsbackendafc.c
parented09378304e4e043e94234a03befe27b34e8dd2c (diff)
downloadgvfs-a021631a2509ca84b54ed399819a0a4c5734ca70.tar.gz
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.
Diffstat (limited to 'daemon/gvfsbackendafc.c')
-rw-r--r--daemon/gvfsbackendafc.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 653b1297..b6e6a106 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);
}