diff options
author | David Zeuthen <david@fubar.dk> | 2006-02-24 04:29:06 +0000 |
---|---|---|
committer | David Zeuthen <david@fubar.dk> | 2006-02-24 04:29:06 +0000 |
commit | 6f6be51ff03d2a047cc672f3b8705223fd0304f8 (patch) | |
tree | 3a6a04821f9a6d82558caa5a26b10b51bd61d06e | |
parent | 9703fbe7f1c349b2943ead881bfb4fe057f1b2ee (diff) |
Add some useful debugging on errors
Sleep three seconds on error to avoid attacks for cracking the password
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | hald/linux2/blockdev.c | 16 | ||||
-rwxr-xr-x | tools/hal-luks-setup | 19 |
3 files changed, 31 insertions, 12 deletions
@@ -1,3 +1,11 @@ +2006-02-23 David Zeuthen <davidz@redhat.com> + + * hald/linux2/blockdev.c (hotplug_event_begin_add_blockdev): Add + some useful debugging on errors + + * tools/hal-luks-setup: Sleep three seconds on error to avoid + attacks for cracking the password + 2006-02-23 Richard Hughes <richard@hughsie.com> * hald/linux2/probing/probe-input.c: Add the bustype for ADB keyboards diff --git a/hald/linux2/blockdev.c b/hald/linux2/blockdev.c index b9c2a9a1..97bc3f00 100644 --- a/hald/linux2/blockdev.c +++ b/hald/linux2/blockdev.c @@ -784,13 +784,17 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f } /* needs physical device */ - if (physdev_udi == NULL) + if (physdev_udi == NULL) { + HAL_WARNING (("No physical device?")); goto error; + } hal_device_property_set_string (d, "storage.physical_device", physdev_udi); - if (!hal_util_get_int_from_file (sysfs_path, "removable", (gint *) &is_removable, 10)) + if (!hal_util_get_int_from_file (sysfs_path, "removable", (gint *) &is_removable, 10)) { + HAL_WARNING (("Cannot get 'removable' file")); goto error; + } hal_device_property_set_bool (d, "storage.removable", is_removable); @@ -823,6 +827,7 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f strcmp (media, "floppy") == 0) { hal_device_property_set_string (d, "storage.drive_type", media); } else { + HAL_WARNING (("Cannot determine IDE drive type from file %s/media", buf)); goto error; } @@ -838,8 +843,10 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f } } else if (strcmp (parent_bus, "scsi") == 0) { - if (strcmp (hal_device_property_get_string (parent, "scsi.type"), "unknown") == 0) + if (strcmp (hal_device_property_get_string (parent, "scsi.type"), "unknown") == 0) { + HAL_WARNING (("scsi.type is unknown")); goto error; + } hal_device_copy_property (parent, "scsi.type", d, "storage.drive_type"); hal_device_copy_property (parent, "scsi.vendor", d, "storage.vendor"); hal_device_copy_property (parent, "scsi.model", d, "storage.model"); @@ -938,9 +945,11 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f partition_number = atoi (&sysfs_path[i+1]); hal_device_property_set_int (d, "volume.partition.number", partition_number); } else { + HAL_WARNING (("Cannot determine partition number?")); goto error; } } else { + HAL_WARNING (("Cannot determine partition number")); goto error; } } @@ -972,6 +981,7 @@ out2: return; error: + HAL_WARNING (("Not adding device object")); if (d != NULL) g_object_unref (d); out: diff --git a/tools/hal-luks-setup b/tools/hal-luks-setup index 71602f09..fb35cc69 100755 --- a/tools/hal-luks-setup +++ b/tools/hal-luks-setup @@ -18,21 +18,22 @@ PASSWORD=${PASSWORD//[^[:alnum:]_=[:space:]:.+-]/@} CRYPTSETUP=/sbin/cryptsetup if [ ! -f $CRYPTSETUP ]; then - echo org.freedesktop.Hal.Device.Volume.Crypto.SetupError >&2 - echo Error setting up $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2 - exit 1 + echo org.freedesktop.Hal.Device.Volume.Crypto.SetupError >&2 + echo Error setting up $HAL_PROP_BLOCK_DEVICE - $CRYPTSETUP not found >&2 + exit 1 fi if [ -e /dev/mapper/luks_crypto_$HAL_PROP_VOLUME_UUID ]; then - echo org.freedesktop.Hal.Device.Volume.Crypto.SetupError >&2 - echo $HAL_PROP_BLOCK_DEVICE is already setup? >&2 - exit 1 + echo org.freedesktop.Hal.Device.Volume.Crypto.SetupError >&2 + echo $HAL_PROP_BLOCK_DEVICE is already setup? >&2 + exit 1 fi if ! echo $password | $CRYPTSETUP luksOpen $HAL_PROP_BLOCK_DEVICE luks_crypto_$HAL_PROP_VOLUME_UUID 2> /dev/null; then - echo org.freedesktop.Hal.Device.Volume.Crypto.SetupPasswordError >&2 - echo Error setting up $HAL_PROP_BLOCK_DEVICE - bad password? >&2 - exit 1 + /bin/sleep 3 + echo org.freedesktop.Hal.Device.Volume.Crypto.SetupPasswordError >&2 + echo Error setting up $HAL_PROP_BLOCK_DEVICE - bad password? >&2 + exit 1 fi hal-set-property --udi=$UDI --key="info.callouts.remove" --strlist-pre="hal-luks-remove" > /dev/null 2>&1 |