1
From 2d1901f74725da29c7af7602e1c74faf55f14672 Mon Sep 17 00:00:00 2001
2
From: Martin Pitt <martin.pitt@ubuntu.com>
3
Date: Thu, 24 Feb 2011 13:39:52 +0100
4
Subject: [PATCH] Ignore broken directory permissions on UDF media
6
Some broken DVDs come with 0400 directory permissions, making them unreadable;
7
according to the UDF spec (http://www.osta.org/specs/pdf/udf260.pdf) directory
8
permissions are to be respected, but apparently Windows ignores those.
10
To work around this, override readonly UDF media with a dmode=0500, as on those
11
it doesn't really make sense to hide anything.
13
https://launchpad.net/bugs/635499
15
src/device.c | 21 ++++++++++++++++++---
16
1 files changed, 18 insertions(+), 3 deletions(-)
18
diff --git a/src/device.c b/src/device.c
19
index c4a83ff..21d9530 100644
22
@@ -5874,7 +5874,7 @@ static const char *iso9660_allow_gid_self[] = { "gid=", NULL };
23
/* ---------------------- udf -------------------- */
25
static const char *udf_defaults[] = { "uid=", "gid=", "iocharset=utf8", "umask=0077", NULL };
26
-static const char *udf_allow[] = { "iocharset=", "umask=", NULL };
27
+static const char *udf_allow[] = { "iocharset=", "umask=", "mode=", "dmode=", NULL };
28
static const char *udf_allow_uid_self[] = { "uid=", NULL };
29
static const char *udf_allow_gid_self[] = { "gid=", NULL };
31
@@ -6088,7 +6088,8 @@ is_mount_option_allowed (const FSMountOptions *fsmo,
35
-prepend_default_mount_options (const FSMountOptions *fsmo,
36
+prepend_default_mount_options (Device *device,
37
+ const FSMountOptions *fsmo,
41
@@ -6097,6 +6098,7 @@ prepend_default_mount_options (const FSMountOptions *fsmo,
45
+ /* static default options from FSMountOptions */
46
options = g_ptr_array_new ();
49
@@ -6124,6 +6126,19 @@ prepend_default_mount_options (const FSMountOptions *fsmo,
54
+ /* dynamic default options */
56
+ /* some broken DVDs come with 0400 directory permissions, making them
57
+ * unreadable; overwrite readonly UDF media with a 0500 dmode. */
58
+ if (g_strcmp0 (device->priv->id_type, "udf") == 0 && device->priv->device_is_optical_disc &&
59
+ device->priv->drive_media != NULL &&
60
+ strstr(device->priv->drive_media, "_rw") == NULL && strstr(device->priv->drive_media, "_ram") == NULL)
62
+ g_ptr_array_add (options, g_strdup("dmode=0500"));
65
+ /* user supplied options */
66
for (n = 0; given_options[n] != NULL; n++)
68
g_ptr_array_add (options, g_strdup (given_options[n]));
69
@@ -6304,7 +6319,7 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
70
/* always prepend some reasonable default mount options; these are
71
* chosen here; the user can override them if he wants to
73
- options = prepend_default_mount_options (fsmo, caller_uid, given_options);
74
+ options = prepend_default_mount_options (device, fsmo, caller_uid, given_options);
76
/* validate mount options and check for authorizations */
77
s = g_string_new ("uhelper=udisks,nodev,nosuid");