summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-04-07 06:12:42 (GMT)
committerMartin Pitt <martin.pitt@ubuntu.com>2010-04-07 06:12:42 (GMT)
commit0fcc7cb3b66f23fac53ae08647aa0007a2bd56c4 (patch)
treeb9269f89f701fc5dd0ffe9b45f76c61f712a169c
parent20434375cf9244a33f40c15bbb59431923de1c43 (diff)
Bug 27494 — publicly exports dm key information
Change udisks-dm-export to only export UDISKS_DM_TARGETS_PARAMS for "linear" types. It is the only one we care about for now and know how to interpret. "crypto" types have information about the encryption key in the target parameters, which we must not leak. Also add appropriate comments to the two places which currently evaluate UDISKS_DM_TARGETS_PARAMS.
-rw-r--r--src/device.c2
-rw-r--r--src/probers/part-id.c2
-rw-r--r--src/probers/udisks-dm-export.c5
3 files changed, 8 insertions, 1 deletions
diff --git a/src/device.c b/src/device.c
index bac971d..12cab7c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3336,6 +3336,8 @@ update_info_partition_on_linux_dmmp (Device *device)
goto out;
targets_type = g_udev_device_get_property_as_strv (device->priv->d, "UDISKS_DM_TARGETS_TYPE");
+ /* If we ever need this for other types than "linear", remember to update
+ udisks-dm-export.c as well. */
if (targets_type == NULL || g_strcmp0 (targets_type[0], "linear") != 0)
goto out;
diff --git a/src/probers/part-id.c b/src/probers/part-id.c
index b61ea07..306eb44 100644
--- a/src/probers/part-id.c
+++ b/src/probers/part-id.c
@@ -246,6 +246,8 @@ get_part_table_device_file (struct udev_device *given_device,
//g_printerr ("targets_type=`%s'\n", targets_type);
//g_printerr ("encoded_targets_params=`%s'\n", encoded_targets_params);
+ /* If we ever need this for other types than "linear", remember to update
+ udisks-dm-export.c as well. */
if (g_strcmp0 (targets_type, "linear") == 0)
{
gint partition_slave_major;
diff --git a/src/probers/udisks-dm-export.c b/src/probers/udisks-dm-export.c
index b950c32..8fff4f9 100644
--- a/src/probers/udisks-dm-export.c
+++ b/src/probers/udisks-dm-export.c
@@ -287,7 +287,10 @@ dm_export (int major, int minor)
g_string_append (target_types_str, target_type);
g_string_append_printf (start_str, "%" G_GUINT64_FORMAT, start);
g_string_append_printf (length_str, "%" G_GUINT64_FORMAT, length);
- if (params != NULL && strlen (params) > 0)
+ /* Set target_params for known-safe and known-needed target types only. In particular,
+ * we must not export it for "crypto", since that would expose
+ * information about the key. */
+ if (g_strcmp0 (target_type, "linear") == 0 && params != NULL && strlen (params) > 0)
{
_udev_util_encode_string (params, buf, sizeof (buf));
g_string_append (params_str, buf);