udisks-2.0.91-udf-dvd-fix-dmask.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --- udisks-2.0.91.orig/src/udiskslinuxfilesystem.c
  2. +++ udisks-2.0.91/src/udiskslinuxfilesystem.c
  3. @@ -298,7 +298,7 @@ static const gchar *iso9660_allow_gid_se
  4. /* ---------------------- udf -------------------- */
  5. static const gchar *udf_defaults[] = { "uid=", "gid=", "iocharset=utf8", "umask=0077", NULL };
  6. -static const gchar *udf_allow[] = { "iocharset=", "umask=", NULL };
  7. +static const gchar *udf_allow[] = { "iocharset=", "umask=", "mode=", "dmode=", NULL };
  8. static const gchar *udf_allow_uid_self[] = { "uid=", NULL };
  9. static const gchar *udf_allow_gid_self[] = { "gid=", NULL };
  10. @@ -512,7 +512,8 @@ is_mount_option_allowed (const FSMountOp
  11. }
  12. static gchar **
  13. -prepend_default_mount_options (const FSMountOptions *fsmo,
  14. +prepend_default_mount_options (UDisksBlock *block,
  15. + const FSMountOptions *fsmo,
  16. uid_t caller_uid,
  17. GVariant *given_options)
  18. {
  19. @@ -520,6 +521,8 @@ prepend_default_mount_options (const FSM
  20. gint n;
  21. gchar *s;
  22. gid_t gid;
  23. + const gchar *probed_fs_type;
  24. + /* static default options from FSMountOptions */
  25. const gchar *option_string;
  26. options = g_ptr_array_new ();
  27. @@ -552,6 +555,17 @@ prepend_default_mount_options (const FSM
  28. }
  29. }
  30. + /* dynamic default options */
  31. + /* some broken DVDs come with 0400 directory permissions, making them
  32. + * unreadable; overwrite readonly UDF media with a 0500 dmode. */
  33. + probed_fs_type = udisks_block_get_id_type(block);
  34. + if (g_strcmp0 (probed_fs_type, "udf") == 0 &&
  35. + udisks_block_get_read_only(block))
  36. + {
  37. + g_ptr_array_add (options, g_strdup("dmode=0500"));
  38. + }
  39. +
  40. + /* user supplied options */
  41. if (g_variant_lookup (given_options,
  42. "options",
  43. "&s", &option_string))
  44. @@ -709,7 +723,7 @@ calculate_mount_options (UDisksDaemon
  45. /* always prepend some reasonable default mount options; these are
  46. * chosen here; the user can override them if he wants to
  47. */
  48. - options_to_use = prepend_default_mount_options (fsmo, caller_uid, options);
  49. + options_to_use = prepend_default_mount_options (block, fsmo, caller_uid, options);
  50. /* validate mount options */
  51. str = g_string_new ("uhelper=udisks2,nodev,nosuid");