diff options
author | Milan Broz <mbroz@redhat.com> | 2010-05-13 13:31:30 +0000 |
---|---|---|
committer | Milan Broz <mbroz@redhat.com> | 2010-05-13 13:31:30 +0000 |
commit | b1d188894ea365a5ef56008499b6ec992755ada6 (patch) | |
tree | f58399a75d481676207e03045daa81cd3b53a648 /libdm | |
parent | 9ad39e546b144ab4d18699fc9e8b2b5297c79cb9 (diff) | |
download | lvm2-b1d188894ea365a5ef56008499b6ec992755ada6.tar.gz lvm2-b1d188894ea365a5ef56008499b6ec992755ada6.tar.xz lvm2-b1d188894ea365a5ef56008499b6ec992755ada6.zip |
Do not print encryption key in message debug output.
Diffstat (limited to 'libdm')
-rw-r--r-- | libdm/ioctl/libdm-iface.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index f34892cc..68cd74d4 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -1102,7 +1102,7 @@ int dm_task_set_newname(struct dm_task *dmt, const char *newname) int dm_task_set_message(struct dm_task *dmt, const char *message) { if (!(dmt->message = dm_strdup(message))) { - log_error("dm_task_set_message: strdup(%s) failed", message); + log_error("dm_task_set_message: strdup failed"); return 0; } @@ -1724,6 +1724,18 @@ no_match: return r; } +static const char *_sanitise_message(char *message) +{ + const char *sanitised_message = message ?: ""; + + /* FIXME: Check for whitespace variations. */ + /* This traps what cryptsetup sends us. */ + if (message && !strncasecmp(message, "key set", 7)) + sanitised_message = "key set"; + + return sanitised_message; +} + static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command, unsigned repeat_count) { @@ -1805,7 +1817,7 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command, dmt->no_flush ? 'N' : 'F', dmt->skip_lockfs ? "S " : "", dmt->query_inactive_table ? "I " : "", - dmt->sector, dmt->message ? dmt->message : "", + dmt->sector, _sanitise_message(dmt->message), dmi->data_size); #ifdef DM_IOCTLS if (ioctl(_control_fd, command, dmi) < 0) { |