diff --git a/.udisks2.metadata b/.udisks2.metadata index 0a1f26f..f16e80d 100644 --- a/.udisks2.metadata +++ b/.udisks2.metadata @@ -1 +1 @@ -09b6dcab5ccda04c85f4ed7ea7426897898d15af SOURCES/udisks-2.1.0.tar.bz2 +093dc9a32752b63819e5d6856a8b0e3ba6d6d902 SOURCES/udisks-2.1.2.tar.bz2 diff --git a/SOURCES/udisks-2.1.1-chromeos-partition-types.patch b/SOURCES/udisks-2.1.1-chromeos-partition-types.patch deleted file mode 100644 index 935fac3..0000000 --- a/SOURCES/udisks-2.1.1-chromeos-partition-types.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7c550c39641deccdd491faf3b93eb71f9bc92d1f Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Tue, 21 May 2013 16:31:11 +0000 -Subject: Add ChromeOS partition types - -This is helpful when working with ChromeOS disk images. - -Signed-off-by: David Zeuthen ---- -diff --git a/udisks/udisksclient.c b/udisks/udisksclient.c -index f7eaa04..b571360 100644 ---- a/udisks/udisksclient.c -+++ b/udisks/udisksclient.c -@@ -2267,6 +2267,11 @@ static const struct - /* VMWare, see http://blogs.vmware.com/vsphere/2011/08/vsphere-50-storage-features-part-7-gpt.html */ - {"gpt", "other", "aa31e02a-400f-11db-9590-000c2911d1b8", NC_("part-type", "VMWare VMFS"), 0}, - {"gpt", "other", "9d275380-40ad-11db-bf97-000c2911d1b8", NC_("part-type", "VMWare vmkcore"), 0}, -+ /* ChromeOS, see http://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format */ -+ {"gpt", "other", "cab6e88e-abf3-4102-a07a-d4bb9be3c1d3", NC_("part-type", "ChromeOS Firmware"), 0}, -+ {"gpt", "other", "fe3a2a5d-4f32-41a7-b725-accc3285a309", NC_("part-type", "ChromeOS Kernel"), 0}, -+ {"gpt", "other", "3cb8e202-3b7e-47dd-8a3c-7ff2a13cfcec", NC_("part-type", "ChromeOS Root Filesystem"), 0}, -+ {"gpt", "other", "2e0a753d-9e48-43b0-8337-b15192cb1b5e", NC_("part-type", "ChromeOS Reserved"), 0}, - - /* see http://developer.apple.com/documentation/mac/devices/devices-126.html - * http://lists.apple.com/archives/Darwin-drivers/2003/May/msg00021.html */ --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.1-desc-part-table-subtype.patch b/SOURCES/udisks-2.1.1-desc-part-table-subtype.patch deleted file mode 100644 index dd7a141..0000000 --- a/SOURCES/udisks-2.1.1-desc-part-table-subtype.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 68e0d368fb5d3088c5e7d7513607d24dbcb50e02 Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Tue, 21 May 2013 16:06:19 +0000 -Subject: UDisksClient: Make it possible to get part desc based on the part table subtype - -Otherwise, Disks can't populate the partition table combobox correctly -for GPT because "Generic", "Apple" and "Other" subtypes all have the -same partition type (ZFS) but with different descriptions ("ZFS", -"Apple ZFS", "Solaris /usr"). - -Signed-off-by: David Zeuthen ---- -diff --git a/doc/udisks2-sections.txt b/doc/udisks2-sections.txt -index 9dbeef6..897f48a 100644 ---- a/doc/udisks2-sections.txt -+++ b/doc/udisks2-sections.txt -@@ -70,6 +70,7 @@ udisks_partition_type_info_free - udisks_client_get_partition_type_infos - udisks_client_get_partition_table_subtypes - udisks_client_get_partition_type_for_display -+udisks_client_get_partition_type_and_subtype_for_display - udisks_client_get_partition_table_type_for_display - udisks_client_get_partition_table_subtype_for_display - -diff --git a/udisks/udisksclient.c b/udisks/udisksclient.c -index aca946c..f7eaa04 100644 ---- a/udisks/udisksclient.c -+++ b/udisks/udisksclient.c -@@ -2395,6 +2395,48 @@ udisks_client_get_partition_type_for_display (UDisksClient *client, - return ret; - } - -+/** -+ * udisks_client_get_partition_type_and_subtype_for_display: -+ * @client: A #UDisksClient. -+ * @partition_table_type: A partitioning type e.g. 'dos' or 'gpt'. -+ * @partition_table_subtype: A partitioning subtype or %NULL. -+ * @partition_type: A partition type. -+ * -+ * Like udisks_client_get_partition_type_for_display() but also takes -+ * the partition table subtype into account, if available. This is -+ * useful in scenarios where different subtypes is using the same -+ * partition type. -+ * -+ * Returns: A description of @partition_type or %NULL if unknown. -+ * -+ * Since: 2.1.1 -+ */ -+const gchar * -+udisks_client_get_partition_type_and_subtype_for_display (UDisksClient *client, -+ const gchar *partition_table_type, -+ const gchar *partition_table_subtype, -+ const gchar *partition_type) -+{ -+ const gchar *ret = NULL; -+ guint n; -+ -+ for (n = 0; known_partition_types[n].name != NULL; n++) -+ { -+ if (g_strcmp0 (known_partition_types[n].table_type, partition_table_type) == 0 && -+ g_strcmp0 (known_partition_types[n].type, partition_type) == 0) -+ { -+ if (partition_table_subtype != NULL && -+ g_strcmp0 (known_partition_types[n].table_subtype, partition_table_subtype) != 0) -+ continue; -+ ret = g_dpgettext2 (GETTEXT_PACKAGE, "part-type", known_partition_types[n].name); -+ goto out; -+ } -+ } -+ -+ out: -+ return ret; -+} -+ - /* ---------------------------------------------------------------------------------------------------- */ - - /** -diff --git a/udisks/udisksclient.h b/udisks/udisksclient.h -index 93dfddf..121efc3 100644 ---- a/udisks/udisksclient.h -+++ b/udisks/udisksclient.h -@@ -136,6 +136,12 @@ const gchar *udisks_client_get_partition_type_for_display (UDisksCl - const gchar *partition_table_type, - const gchar *partition_type); - -+const gchar *udisks_client_get_partition_type_and_subtype_for_display (UDisksClient *client, -+ const gchar *partition_table_type, -+ const gchar *partition_table_subtype, -+ const gchar *partition_type); -+ -+ - const gchar *udisks_client_get_partition_table_type_for_display (UDisksClient *client, - const gchar *partition_table_type); - --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.1-firewire-ident.patch b/SOURCES/udisks-2.1.1-firewire-ident.patch deleted file mode 100644 index 9df3ad4..0000000 --- a/SOURCES/udisks-2.1.1-firewire-ident.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b841e30a98459816dfc49a735d3db4355a88edcd Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Tue, 19 Mar 2013 04:31:40 +0000 -Subject: Properly identify firewire devices as non-system devices - -This was reported in bug 62077. - -https://bugs.freedesktop.org/show_bug.cgi?id=62077 - -Signed-off-by: David Zeuthen ---- -diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c -index a1781cf..d619850 100644 ---- a/src/udiskslinuxblock.c -+++ b/src/udiskslinuxblock.c -@@ -354,7 +354,7 @@ update_hints (UDisksLinuxBlock *block, - connection_bus = udisks_drive_get_connection_bus (drive); - removable = udisks_drive_get_media_removable (drive); - if (removable || -- (g_strcmp0 (connection_bus, "usb") == 0 || g_strcmp0 (connection_bus, "firewire") == 0) || -+ (g_strcmp0 (connection_bus, "usb") == 0 || g_strcmp0 (connection_bus, "ieee1394") == 0) || - (g_str_has_prefix (device_file, "/dev/mmcblk") || g_str_has_prefix (device_file, "/dev/mspblk"))) - { - hint_system = FALSE; --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.1-lexar-usb3-reader.patch b/SOURCES/udisks-2.1.1-lexar-usb3-reader.patch deleted file mode 100644 index 9140baf..0000000 --- a/SOURCES/udisks-2.1.1-lexar-usb3-reader.patch +++ /dev/null @@ -1,26 +0,0 @@ -From aac687085c2ea84d3148815854fc5d7bd3f170be Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Thu, 16 May 2013 06:47:11 +0000 -Subject: Identify Lexar Dual Slot USB 3.0 Reader Professional as a card reader - -Just got one of these. - -Signed-off-by: David Zeuthen ---- -diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules -index 5541b4e..997525d 100644 ---- a/data/80-udisks2.rules -+++ b/data/80-udisks2.rules -@@ -71,6 +71,10 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="8403", ENV{ID_DRI - DRIVERS=="rts_pstor", ENV{ID_DRIVE_FLASH_SD}="1" - DRIVERS=="rts5229", ENV{ID_DRIVE_FLASH_SD}="1" - -+# Lexar Dual Slot USB 3.0 Reader Professional -+SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="05dc",ENV{ID_MODEL_ID}=="b049", ENV{ID_INSTANCE}=="0:0", ENV{ID_DRIVE_FLASH_CF}="1" -+SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="05dc",ENV{ID_MODEL_ID}=="b049", ENV{ID_INSTANCE}=="0:1", ENV{ID_DRIVE_FLASH_SD}="1" -+ - # Common theme - # - SUBSYSTEMS=="usb", ENV{ID_MODEL}=="*Reader*SD*", ENV{ID_DRIVE_FLASH_SD}="1" --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.1-logind-test.patch b/SOURCES/udisks-2.1.1-logind-test.patch deleted file mode 100644 index 0eb0feb..0000000 --- a/SOURCES/udisks-2.1.1-logind-test.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 266bae418f6f55e0061b089c5bbfdeac2598f155 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Thu, 21 Mar 2013 06:23:59 +0000 -Subject: Fix test for logind availability - -sd_booted() is not an appropriate check for whether we should talk to logind, -test for /run/systemd/seats/ instead. - -For details, see: - ---- -diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c -index 4c23906..fb50a0f 100644 ---- a/src/udisksdaemonutil.c -+++ b/src/udisksdaemonutil.c -@@ -44,6 +44,8 @@ - #if defined(HAVE_LIBSYSTEMD_LOGIN) - #include - #include -+ -+#define LOGIND_AVAILABLE() (access("/run/systemd/seats/", F_OK) >= 0) - #endif - - /** -@@ -1039,8 +1041,8 @@ udisks_daemon_util_on_same_seat (UDisksDaemon *daemon, - UDisksObject *drive_object = NULL; - UDisksDrive *drive = NULL; - -- /* if we haven't booted with systemd, assume it's always the same seat */ -- if (sd_booted () <= 0) -+ /* if we don't have logind, assume it's always the same seat */ -+ if (!LOGIND_AVAILABLE()) - return TRUE; - - if (UDISKS_IS_LINUX_BLOCK_OBJECT (object)) --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.1-transcend-usb3-reader.patch b/SOURCES/udisks-2.1.1-transcend-usb3-reader.patch deleted file mode 100644 index 0e9f1f2..0000000 --- a/SOURCES/udisks-2.1.1-transcend-usb3-reader.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 7bb9d6714ff496c7ee5f2b477e22b90b2d8c8010 Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Sat, 18 May 2013 16:43:49 +0000 -Subject: Identify Transcend USB 3.0 Multi-Card reader as such - ---- -diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules -index 997525d..02376e7 100644 ---- a/data/80-udisks2.rules -+++ b/data/80-udisks2.rules -@@ -75,6 +75,11 @@ DRIVERS=="rts5229", ENV{ID_DRIVE_FLASH_SD}="1" - SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="05dc",ENV{ID_MODEL_ID}=="b049", ENV{ID_INSTANCE}=="0:0", ENV{ID_DRIVE_FLASH_CF}="1" - SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="05dc",ENV{ID_MODEL_ID}=="b049", ENV{ID_INSTANCE}=="0:1", ENV{ID_DRIVE_FLASH_SD}="1" - -+# Transcend USB 3.0 Multi-Card Reader (TS-RDF8K) -+SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="8564",ENV{ID_MODEL_ID}=="4000", ENV{ID_INSTANCE}=="0:0", ENV{ID_DRIVE_FLASH_CF}="1" -+SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="8564",ENV{ID_MODEL_ID}=="4000", ENV{ID_INSTANCE}=="0:1", ENV{ID_DRIVE_FLASH_SD}="1" -+SUBSYSTEMS=="usb", ENV{ID_VENDOR_ID}=="8564",ENV{ID_MODEL_ID}=="4000", ENV{ID_INSTANCE}=="0:2", ENV{ID_DRIVE_FLASH_MS}="1" -+ - # Common theme - # - SUBSYSTEMS=="usb", ENV{ID_MODEL}=="*Reader*SD*", ENV{ID_DRIVE_FLASH_SD}="1" --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.1-wd-smartware-hiding.patch b/SOURCES/udisks-2.1.1-wd-smartware-hiding.patch deleted file mode 100644 index 49c6b0f..0000000 --- a/SOURCES/udisks-2.1.1-wd-smartware-hiding.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 51857ca68c1f45137c27591c1b535b18a6b4ab09 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Mon, 25 Mar 2013 13:58:18 +0000 -Subject: Fix hiding of "WD SmartWare" partitions - -These might have a _ or a space as word separator. - -https://launchpad.net/bugs/732365 ---- -diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules -index 90e4fc2..5541b4e 100644 ---- a/data/80-udisks2.rules -+++ b/data/80-udisks2.rules -@@ -114,7 +114,7 @@ ENV{ID_PART_ENTRY_SCHEME}=="gpt", \ - - # MAC recovery/tool partitions which are useless on Linux - ENV{ID_PART_ENTRY_SCHEME}=="mac", \ -- ENV{ID_CDROM}=="?*", ENV{ID_FS_TYPE}=="udf", ENV{ID_FS_LABEL}=="WD_SmartWare", \ -+ ENV{ID_CDROM}=="?*", ENV{ID_FS_TYPE}=="udf", ENV{ID_FS_LABEL}=="WD*SmartWare", \ - ENV{UDISKS_IGNORE}="1" - - # recovery partitions --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.1-zfs-generic.patch b/SOURCES/udisks-2.1.1-zfs-generic.patch deleted file mode 100644 index ca41259..0000000 --- a/SOURCES/udisks-2.1.1-zfs-generic.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 21b24071250f232f85b1853ddef428c76a83ad4d Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Tue, 21 May 2013 16:05:21 +0000 -Subject: Promote ZFS partition type to generic - -In addition to Mac OS X and Solaris, It's also used in Linux. - -Signed-off-by: David Zeuthen ---- -diff --git a/udisks/udisksclient.c b/udisks/udisksclient.c -index 18f3590..aca946c 100644 ---- a/udisks/udisksclient.c -+++ b/udisks/udisksclient.c -@@ -2210,6 +2210,7 @@ static const struct - {"gpt", "generic", "024dee41-33e7-11d3-9d69-0008c781f39f", NC_("part-type", "MBR Partition Scheme"), F_SYSTEM}, - {"gpt", "generic", "c12a7328-f81f-11d2-ba4b-00a0c93ec93b", NC_("part-type", "EFI System"), F_SYSTEM}, - {"gpt", "generic", "21686148-6449-6e6f-744e-656564454649", NC_("part-type", "BIOS Boot"), F_SYSTEM}, -+ {"gpt", "generic", "6a898cc3-1dd2-11b2-99a6-080020736631", NC_("part-type", "ZFS"), 0}, /* see also Apple, Sol. */ - /* Linux */ - {"gpt", "linux", "0fc63daf-8483-4772-8e79-3d69d8477de4", NC_("part-type", "Linux Filesystem"), 0}, - {"gpt", "linux", "a19d880f-05fc-4d3b-a006-743f0f84911e", NC_("part-type", "Linux RAID"), F_RAID}, -@@ -2225,7 +2226,7 @@ static const struct - /* Apple OS X */ - {"gpt", "apple", "48465300-0000-11aa-aa11-00306543ecac", NC_("part-type", "Apple HFS/HFS+"), 0}, - {"gpt", "apple", "55465300-0000-11aa-aa11-00306543ecac", NC_("part-type", "Apple UFS"), 0}, -- {"gpt", "apple", "6a898cc3-1dd2-11b2-99a6-080020736631", NC_("part-type", "Apple ZFS"), 0}, /* same as Solaris /usr */ -+ {"gpt", "apple", "6a898cc3-1dd2-11b2-99a6-080020736631", NC_("part-type", "Apple ZFS"), 0}, /* same as ZFS */ - {"gpt", "apple", "52414944-0000-11aa-aa11-00306543ecac", NC_("part-type", "Apple RAID"), F_RAID}, - {"gpt", "apple", "52414944-5f4f-11aa-aa11-00306543ecac", NC_("part-type", "Apple RAID (offline)"), F_RAID}, - {"gpt", "apple", "426f6f74-0000-11aa-aa11-00306543ecac", NC_("part-type", "Apple Boot"), F_SYSTEM}, -@@ -2247,7 +2248,7 @@ static const struct - {"gpt", "other", "6a85cf4d-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris Root"), 0}, - {"gpt", "other", "6a87c46f-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris Swap"), F_SWAP}, - {"gpt", "other", "6a8b642b-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris Backup"), 0}, -- {"gpt", "other", "6a898cc3-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris /usr"), 0}, /* same as Apple ZFS */ -+ {"gpt", "other", "6a898cc3-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris /usr"), 0}, /* same as ZFS */ - {"gpt", "other", "6a8ef2e9-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris /var"), 0}, - {"gpt", "other", "6a90ba39-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris /home"), 0}, - {"gpt", "other", "6a9283a5-1dd2-11b2-99a6-080020736631", NC_("part-type", "Solaris Alternate Sector"), 0}, --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.3-getpwuid-thread-safety.patch b/SOURCES/udisks-2.1.3-getpwuid-thread-safety.patch new file mode 100644 index 0000000..b9c06c7 --- /dev/null +++ b/SOURCES/udisks-2.1.3-getpwuid-thread-safety.patch @@ -0,0 +1,108 @@ +From 89229c2b0b139c527e98fc3bf1a829bc2b68394e Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Wed, 15 Jan 2014 16:16:34 +0000 +Subject: Use reentrant version of getpwuid() for thread safety + +...and get rid of static variables. + +https://bugs.freedesktop.org/show_bug.cgi?id=73669 + +Signed-off-by: David Zeuthen +--- +diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c +index 574bf2c..b3a3acb 100644 +--- a/src/udisksdaemonutil.c ++++ b/src/udisksdaemonutil.c +@@ -830,7 +830,7 @@ udisks_daemon_util_get_caller_uid_sync (UDisksDaemon *daemon, + { + struct passwd pwstruct; + gchar pwbuf[8192]; +- static struct passwd *pw; ++ struct passwd *pw = NULL; + int rc; + + rc = getpwuid_r (uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); +diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c +index 4c8d8aa..f243046 100644 +--- a/src/udiskslinuxfilesystem.c ++++ b/src/udiskslinuxfilesystem.c +@@ -348,13 +348,16 @@ find_mount_options_for_fs (const gchar *fstype) + static gid_t + find_primary_gid (uid_t uid) + { +- struct passwd *pw; ++ struct passwd *pw = NULL; ++ struct passwd pwstruct; ++ gchar pwbuf[8192]; ++ int rc; + gid_t gid; + + gid = (gid_t) - 1; + +- pw = getpwuid (uid); +- if (pw == NULL) ++ rc = getpwuid_r (uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); ++ if (rc != 0 || pw == NULL) + { + udisks_warning ("Error looking up uid %d: %m", uid); + goto out; +@@ -370,7 +373,10 @@ is_uid_in_gid (uid_t uid, + gid_t gid) + { + gboolean ret; +- struct passwd *pw; ++ struct passwd *pw = NULL; ++ struct passwd pwstruct; ++ gchar pwbuf[8192]; ++ int rc; + static gid_t supplementary_groups[128]; + int num_supplementary_groups = 128; + int n; +@@ -379,8 +385,8 @@ is_uid_in_gid (uid_t uid, + + ret = FALSE; + +- pw = getpwuid (uid); +- if (pw == NULL) ++ rc = getpwuid_r (uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); ++ if (rc != 0 || pw == NULL) + { + udisks_warning ("Error looking up uid %d: %m", uid); + goto out; +diff --git a/src/udisksspawnedjob.c b/src/udisksspawnedjob.c +index 802551f..b181933 100644 +--- a/src/udisksspawnedjob.c ++++ b/src/udisksspawnedjob.c +@@ -371,22 +371,25 @@ static void + child_setup (gpointer user_data) + { + UDisksSpawnedJob *job = UDISKS_SPAWNED_JOB (user_data); +- struct passwd *pw; ++ struct passwd pwstruct; ++ gchar pwbuf[8192]; ++ struct passwd *pw = NULL; ++ int rc; + gid_t egid; + + if (job->run_as_uid == getuid () && job->run_as_euid == geteuid ()) + goto out; + +- pw = getpwuid (job->run_as_euid); +- if (pw == NULL) ++ rc = getpwuid_r (job->run_as_euid, &pwstruct, pwbuf, sizeof pwbuf, &pw); ++ if (rc != 0 || pw == NULL) + { + g_printerr ("No password record for uid %d: %m\n", (gint) job->run_as_euid); + abort (); + } + egid = pw->pw_gid; + +- pw = getpwuid (job->run_as_uid); +- if (pw == NULL) ++ rc = getpwuid_r (job->run_as_uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); ++ if (rc != 0 || pw == NULL) + { + g_printerr ("No password record for uid %d: %m\n", (gint) job->run_as_uid); + abort (); +-- +cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch b/SOURCES/udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch new file mode 100644 index 0000000..1a0e70e --- /dev/null +++ b/SOURCES/udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch @@ -0,0 +1,21 @@ +From 3a384047123abc4a4fe2e81eb5dc4050746aa9e8 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Fri, 17 Jan 2014 16:10:33 +0000 +Subject: udisks_daemon_util_get_caller_uid_sync(): Add missing goto + +Signed-off-by: David Zeuthen +--- +diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c +index b3a3acb..a588580 100644 +--- a/src/udisksdaemonutil.c ++++ b/src/udisksdaemonutil.c +@@ -840,6 +840,7 @@ udisks_daemon_util_get_caller_uid_sync (UDisksDaemon *daemon, + UDISKS_ERROR, + UDISKS_ERROR_FAILED, + "User with uid %d does not exist", (gint) uid); ++ goto out; + } + else if (pw == NULL) + { +-- +cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.3-udisksctl-loop-delete-crash.patch b/SOURCES/udisks-2.1.3-udisksctl-loop-delete-crash.patch new file mode 100644 index 0000000..e4206e9 --- /dev/null +++ b/SOURCES/udisks-2.1.3-udisksctl-loop-delete-crash.patch @@ -0,0 +1,32 @@ +From 4d867ff2a454a155828a2616cd674b1a8d018260 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Tue, 14 Jan 2014 17:20:19 +0000 +Subject: Fix crash when loop-deleting non-loop device + +When a non-loop device file is specified, a lookup succeeds but it's not +a UDisks2.Loop object. This change prevents a crash when null pointer is +passed further in the calls. + +https://bugzilla.redhat.com/show_bug.cgi?id=1036076 + +Signed-off-by: David Zeuthen +--- +diff --git a/tools/udisksctl.c b/tools/udisksctl.c +index 97b0f17..209c0a3 100644 +--- a/tools/udisksctl.c ++++ b/tools/udisksctl.c +@@ -1691,6 +1691,12 @@ handle_command_loop (gint *argc, + goto out; + } + ++ if (udisks_object_peek_loop (object) == NULL) ++ { ++ g_printerr ("Error: specified object is not a loop device\n"); ++ goto out; ++ } ++ + delete_try_again: + error = NULL; + if (!udisks_loop_call_delete_sync (udisks_object_peek_loop (object), +-- +cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.3-uninitialized-vars.patch b/SOURCES/udisks-2.1.3-uninitialized-vars.patch new file mode 100644 index 0000000..a757e91 --- /dev/null +++ b/SOURCES/udisks-2.1.3-uninitialized-vars.patch @@ -0,0 +1,100 @@ +From 5075166d63aaa9d8c6f441d6073a72b24431408b Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Wed, 22 Jan 2014 14:29:05 +0100 +Subject: [PATCH 1/3] Properly initialize all used variables + +--- + src/udiskslinuxblock.c | 8 ++++---- + src/udiskslinuxdriveata.c | 2 +- + src/udiskslinuxfilesystem.c | 2 +- + src/udisksstate.c | 2 +- + tools/udisksctl.c | 1 + + 5 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c +index 22bcfd0..c72dded 100644 +--- a/src/udiskslinuxblock.c ++++ b/src/udiskslinuxblock.c +@@ -1521,7 +1521,7 @@ handle_add_configuration_item (UDisksBlock *_block, + UDisksLinuxBlockObject *object; + UDisksDaemon *daemon; + const gchar *type; +- GVariant *details; ++ GVariant *details = NULL; + GError *error; + + error = NULL; +@@ -1598,7 +1598,7 @@ handle_remove_configuration_item (UDisksBlock *_block, + UDisksLinuxBlockObject *object; + UDisksDaemon *daemon; + const gchar *type; +- GVariant *details; ++ GVariant *details = NULL; + GError *error; + + error = NULL; +@@ -1677,8 +1677,8 @@ handle_update_configuration_item (UDisksBlock *_block, + UDisksDaemon *daemon; + const gchar *old_type; + const gchar *new_type; +- GVariant *old_details; +- GVariant *new_details; ++ GVariant *old_details = NULL; ++ GVariant *new_details = NULL; + GError *error; + + error = NULL; +diff --git a/src/udiskslinuxdriveata.c b/src/udiskslinuxdriveata.c +index 534ef4d..5c36078 100644 +--- a/src/udiskslinuxdriveata.c ++++ b/src/udiskslinuxdriveata.c +@@ -637,7 +637,7 @@ udisks_linux_drive_ata_smart_selftest_sync (UDisksLinuxDriveAta *drive, + GError **error) + { + UDisksLinuxDriveObject *object; +- UDisksLinuxDevice *device; ++ UDisksLinuxDevice *device = NULL; + SkDisk *d = NULL; + gboolean ret = FALSE; + SkSmartSelfTest test; +diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c +index f243046..4503b51 100644 +--- a/src/udiskslinuxfilesystem.c ++++ b/src/udiskslinuxfilesystem.c +@@ -1558,7 +1558,7 @@ handle_unmount (UDisksFilesystem *filesystem, + GError *error; + uid_t mounted_by_uid; + uid_t caller_uid; +- gint status; ++ gint status = 0; + gchar *error_message; + const gchar *const *mount_points; + gboolean opt_force; +diff --git a/src/udisksstate.c b/src/udisksstate.c +index e7b549a..4dfe393 100644 +--- a/src/udisksstate.c ++++ b/src/udisksstate.c +@@ -530,7 +530,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, + const gchar *mount_point; + GVariant *details; + GVariant *block_device_value; +- dev_t block_device; ++ dev_t block_device = 0; + GVariant *fstab_mount_value; + gboolean fstab_mount; + gboolean keep; +diff --git a/tools/udisksctl.c b/tools/udisksctl.c +index 209c0a3..bb1182c 100644 +--- a/tools/udisksctl.c ++++ b/tools/udisksctl.c +@@ -890,6 +890,7 @@ read_passphrase (void) + gchar *ret; + + ret = NULL; ++ str = NULL; + + tty_name = ctermid (NULL); + if (tty_name == NULL) +-- +1.8.1.5 + diff --git a/SOURCES/udisks-2.1.3-uninitialized-wait_data.patch b/SOURCES/udisks-2.1.3-uninitialized-wait_data.patch new file mode 100644 index 0000000..3f4cb23 --- /dev/null +++ b/SOURCES/udisks-2.1.3-uninitialized-wait_data.patch @@ -0,0 +1,36 @@ +From 951472a6f5914bbc56587d56e97fa40ff1908794 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Wed, 22 Jan 2014 14:42:09 +0100 +Subject: [PATCH 2/3] udiskslinuxmanager.c: Don't use uninitialized wait_data + struct + +--- + src/udiskslinuxmanager.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/udiskslinuxmanager.c b/src/udiskslinuxmanager.c +index d15eba6..53703d1 100644 +--- a/src/udiskslinuxmanager.c ++++ b/src/udiskslinuxmanager.c +@@ -538,7 +538,6 @@ handle_mdraid_create (UDisksManager *_object, + { + UDisksLinuxManager *manager = UDISKS_LINUX_MANAGER (_object); + UDisksObject *array_object = NULL; +- WaitForArrayData wait_data; + uid_t caller_uid; + GError *error = NULL; + const gchar *message; +@@ -778,8 +777,8 @@ handle_mdraid_create (UDisksManager *_object, + if (array_object == NULL) + { + g_prefix_error (&error, +- "Error waiting for array object after creating /dev/md%d", +- wait_data.md_num); ++ "Error waiting for array object after creating %s", ++ raid_device_file); + g_dbus_method_invocation_take_error (invocation, error); + goto out; + } +-- +1.8.1.5 + diff --git a/SOURCES/udisks-2.x.x-CVE-2014-0004.patch b/SOURCES/udisks-2.x.x-CVE-2014-0004.patch new file mode 100644 index 0000000..5794dfd --- /dev/null +++ b/SOURCES/udisks-2.x.x-CVE-2014-0004.patch @@ -0,0 +1,96 @@ +From 4cd35a8db2c6a0b94218a89cb183f50e8550de0e Mon Sep 17 00:00:00 2001 +From: David Zeuthen +Date: Wed, 12 Feb 2014 20:01:41 -0800 +Subject: [PATCH] CVE-2014-0004: Stack-based buffer overflow when handling long + path names + +Fix this by being more careful when parsing strings. + +Acknowledgements: This issue was discovered by Florian Weimer of the +Red Hat Product Security Team. + +Signed-off-by: David Zeuthen +--- + src/udisksmountmonitor.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/src/udisksmountmonitor.c b/src/udisksmountmonitor.c +index 8af1028..77cf94c 100644 +--- a/src/udisksmountmonitor.c ++++ b/src/udisksmountmonitor.c +@@ -416,8 +416,8 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, + guint mount_id; + guint parent_id; + guint major, minor; +- gchar encoded_root[PATH_MAX]; +- gchar encoded_mount_point[PATH_MAX]; ++ gchar encoded_root[4096]; ++ gchar encoded_mount_point[4096]; + gchar *mount_point; + dev_t dev; + +@@ -425,7 +425,7 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, + continue; + + if (sscanf (lines[n], +- "%d %d %d:%d %s %s", ++ "%d %d %d:%d %4095s %4095s", + &mount_id, + &parent_id, + &major, +@@ -436,6 +436,8 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, + udisks_warning ("Error parsing line '%s'", lines[n]); + continue; + } ++ encoded_root[sizeof encoded_root - 1] = '\0'; ++ encoded_mount_point[sizeof encoded_mount_point - 1] = '\0'; + + /* Temporary work-around for btrfs, see + * +@@ -450,15 +452,17 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, + sep = strstr (lines[n], " - "); + if (sep != NULL) + { +- gchar fstype[PATH_MAX]; +- gchar mount_source[PATH_MAX]; ++ gchar fstype[4096]; ++ gchar mount_source[4096]; + struct stat statbuf; + +- if (sscanf (sep + 3, "%s %s", fstype, mount_source) != 2) ++ if (sscanf (sep + 3, "%4095s %4095s", fstype, mount_source) != 2) + { + udisks_warning ("Error parsing things past - for '%s'", lines[n]); + continue; + } ++ fstype[sizeof fstype - 1] = '\0'; ++ mount_source[sizeof mount_source - 1] = '\0'; + + if (g_strcmp0 (fstype, "btrfs") != 0) + continue; +@@ -546,7 +550,7 @@ udisks_mount_monitor_get_swaps (UDisksMountMonitor *monitor, + lines = g_strsplit (contents, "\n", 0); + for (n = 0; lines[n] != NULL; n++) + { +- gchar filename[PATH_MAX]; ++ gchar filename[4096]; + struct stat statbuf; + dev_t dev; + +@@ -557,11 +561,12 @@ udisks_mount_monitor_get_swaps (UDisksMountMonitor *monitor, + if (strlen (lines[n]) == 0) + continue; + +- if (sscanf (lines[n], "%s", filename) != 1) ++ if (sscanf (lines[n], "%4095s", filename) != 1) + { + udisks_warning ("Error parsing line '%s'", lines[n]); + continue; + } ++ filename[sizeof filename - 1] = '\0'; + + if (stat (filename, &statbuf) != 0) + { +-- +1.8.5.3 + diff --git a/SOURCES/udisks-2.x.x-cleanup-cdrom.patch b/SOURCES/udisks-2.x.x-cleanup-cdrom.patch new file mode 100644 index 0000000..5ade5b7 --- /dev/null +++ b/SOURCES/udisks-2.x.x-cleanup-cdrom.patch @@ -0,0 +1,80 @@ +From 95929aea77992077ea8725c54c4d861f08edbd46 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Thu, 16 Jan 2014 17:37:27 +0100 +Subject: [PATCH] Check if cdrom drive has media on cleanup + +When cleanup is run, it is supposed to remove lingering mounts. +That probably works fine for card readers etc. since there's +a partition exposed for the drive but fails for optical media. +As a result, when mounted and user presses the drive eject +button, tray is ejected but mounts lives on. + +This patch adds a special check for CDROM drives and looks for +active media. + +https://bugs.freedesktop.org/show_bug.cgi?id=72206 +--- + src/udisksstate.c | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/src/udisksstate.c b/src/udisksstate.c +index e7b549a..73aba4f 100644 +--- a/src/udisksstate.c ++++ b/src/udisksstate.c +@@ -541,6 +541,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, + gboolean device_exists; + gboolean device_to_be_cleaned; + gboolean attempt_no_cleanup; ++ gboolean empty_cd_drive; + UDisksMountMonitor *monitor; + GUdevClient *udev_client; + GUdevDevice *udev_device; +@@ -552,6 +553,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, + device_exists = FALSE; + device_to_be_cleaned = FALSE; + attempt_no_cleanup = FALSE; ++ empty_cd_drive = FALSE; + block_device_value = NULL; + fstab_mount_value = NULL; + fstab_mount = FALSE; +@@ -651,6 +653,16 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, + g_object_unref (udev_device_disk); + } + } ++ /* for disk, check if it's a cd-rom drive and has media */ ++ else if (g_strcmp0 (g_udev_device_get_devtype (udev_device), "disk") == 0) ++ { ++ device_exists = TRUE; ++ ++ /* taken from udisks_daemon_util_block_get_size() */ ++ if (g_udev_device_get_property_as_boolean (udev_device, "ID_CDROM") && ++ !g_udev_device_get_property_as_boolean (udev_device, "ID_CDROM_MEDIA")) ++ empty_cd_drive = TRUE; ++ } + else + { + device_exists = TRUE; +@@ -670,7 +682,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, + } + } + +- if (is_mounted && device_exists && !device_to_be_cleaned) ++ if (is_mounted && device_exists && !device_to_be_cleaned && !empty_cd_drive) + keep = TRUE; + + out: +@@ -679,6 +691,11 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, + { + if (!device_exists) + { ++ udisks_notice ("Cleaning up mount point %s (device %d:%d is CDROM and has no media)", ++ mount_point, major (block_device), minor (block_device)); ++ } ++ else if (!device_exists) ++ { + udisks_notice ("Cleaning up mount point %s (device %d:%d no longer exist)", + mount_point, major (block_device), minor (block_device)); + } +-- +1.8.1.5 + diff --git a/SPECS/udisks2.spec b/SPECS/udisks2.spec index ca94727..6b2c3e3 100644 --- a/SPECS/udisks2.spec +++ b/SPECS/udisks2.spec @@ -7,8 +7,8 @@ Summary: Disk Manager Name: udisks2 -Version: 2.1.0 -Release: 4%{?dist} +Version: 2.1.2 +Release: 5%{?dist} License: GPLv2+ Group: System Environment/Libraries URL: http://www.freedesktop.org/wiki/Software/udisks @@ -38,8 +38,6 @@ Requires: e2fsprogs Requires: xfsprogs # for mkfs.vfat Requires: dosfstools -# for mlabel -Requires: mtools # for partitioning Requires: parted Requires: gdisk @@ -65,31 +63,38 @@ Conflicts: kernel < 2.6.26 # https://bugzilla.redhat.com/show_bug.cgi?id=976796 # ensure smooth upgrade path from udisks(1) -Provides: udisks = %{version}-%{release} -Obsoletes: udisks < %{version}-%{release} +Obsoletes: udisks # Some patch touches Makefile.am BuildRequires: automake autoconf BuildRequires: gnome-common -# Cannot mount external firewire hard drive or usb thumb drive as normal user, root required -# https://bugzilla.redhat.com/show_bug.cgi?id=909010 -Patch0: udisks-2.1.1-firewire-ident.patch - -# from upstream -Patch1: udisks-2.1.1-chromeos-partition-types.patch -Patch2: udisks-2.1.1-desc-part-table-subtype.patch -Patch3: udisks-2.1.1-lexar-usb3-reader.patch -Patch4: udisks-2.1.1-logind-test.patch -Patch5: udisks-2.1.1-transcend-usb3-reader.patch -Patch6: udisks-2.1.1-wd-smartware-hiding.patch -Patch7: udisks-2.1.1-zfs-generic.patch - # add a man page for umount.udisks2 # https://bugzilla.redhat.com/show_bug.cgi?id=948926 Patch8: umount.udisks2-manpage.patch +# udisks2: udiskctl loop-delete crash +# https://bugzilla.redhat.com/show_bug.cgi?id=1036076 +Patch9: udisks-2.1.3-udisksctl-loop-delete-crash.patch + +# udisks2: thread safety issues +# https://bugzilla.redhat.com/show_bug.cgi?id=1036099 +Patch10: udisks-2.1.3-getpwuid-thread-safety.patch +Patch11: udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch + +# udisks2 doesn't unmount /dev/sr0 when optical media is ejected using optical drive button +# https://bugzilla.redhat.com/show_bug.cgi?id=835120 +Patch12: udisks-2.x.x-cleanup-cdrom.patch + +# Issues found by clang static analyzer +# https://bugzilla.redhat.com/show_bug.cgi?id=1056580 +Patch13: udisks-2.1.3-uninitialized-vars.patch +Patch14: udisks-2.1.3-uninitialized-wait_data.patch + +# CVE-2014-0004 +# https://bugzilla.redhat.com/show_bug.cgi?id=1070144 +Patch15: udisks-2.x.x-CVE-2014-0004.patch %description udisks provides a daemon, D-Bus API and command line tools for @@ -120,16 +125,14 @@ daemon. This package is for the udisks 2.x series. %prep %setup -q -n udisks-%{version} -%patch0 -p1 -b .firewire-ident -%patch1 -p1 -b .chromeos-partition-types -%patch2 -p1 -b .desc-part-table-subtype -%patch3 -p1 -b .lexar-usb3-reader -%patch4 -p1 -b .logind-test -%patch5 -p1 -b .transcend-usb3-reader -%patch6 -p1 -b .wd-smartware-hiding -%patch7 -p1 -b .zfs-generic %patch8 -p1 -b .umount.udisks2-manpage - +%patch9 -p1 -b .udisksctl-loop-delete-crash +%patch10 -p1 -b .getpwuid-thread-safety +%patch11 -p1 -b .udisks_daemon_util_get_caller_uid_sync-missing-goto +%patch12 -p1 -b .cleanup-cdrom +%patch13 -p1 -b .uninitialized-vars +%patch14 -p1 -b .uninitialized-wait_data +%patch15 -p1 -b .cve-2014-0004 %build # umount.udisks2-manpage.patch touches Makefile.am @@ -199,6 +202,28 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.a # Note: please don't forget the %{?dist} in the changelog. Thanks %changelog +* Wed Feb 26 2014 Jan Safranek - 2.1.2-5 +- Fix CVE-2014-0004: stack-based buffer overflow when handling long path names + (#1070144) + +* Fri Jan 24 2014 Daniel Mach - 2.1.2-4 +- Mass rebuild 2014-01-24 + +* Wed Jan 22 2014 Tomas Bzatek - 2.1.2-3%{?dist} +- Fix upgrade path from old udisks + +* Wed Jan 22 2014 Tomas Bzatek - 2.1.2-2%{?dist} +- Fix crash when loop-deleting non-loop device (#1036076) +- Fix some thread safety issues (#1036099) +- Fix lingering mount after CD-ROM drive is ejected (#835120) +- Fix some uninitializes variables (#1056580) + +* Thu Jan 16 2014 Tomas Bzatek - 2.1.2-1%{?dist} +- Update to 2.1.2 + +* Fri Dec 27 2013 Daniel Mach - 2.1.0-5 +- Mass rebuild 2013-12-27 + * Thu Jul 25 2013 Tomas Bzatek - 2.1.0-4%{?dist} - Add a man page for umount.udisks2 (#948926)