1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Do not print encryption key in message debug output.

This commit is contained in:
Milan Broz 2010-05-13 13:31:30 +00:00
parent 9ad39e546b
commit b1d188894e
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.48 - Version 1.02.48 -
================================= =================================
Do not print encryption key in message debug output (cryptsetup luksResume).
Version 1.02.47 - 30th April 2010 Version 1.02.47 - 30th April 2010
================================= =================================

View File

@ -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) int dm_task_set_message(struct dm_task *dmt, const char *message)
{ {
if (!(dmt->message = dm_strdup(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; return 0;
} }
@ -1724,6 +1724,18 @@ no_match:
return r; 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, static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
unsigned repeat_count) 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->no_flush ? 'N' : 'F',
dmt->skip_lockfs ? "S " : "", dmt->skip_lockfs ? "S " : "",
dmt->query_inactive_table ? "I " : "", dmt->query_inactive_table ? "I " : "",
dmt->sector, dmt->message ? dmt->message : "", dmt->sector, _sanitise_message(dmt->message),
dmi->data_size); dmi->data_size);
#ifdef DM_IOCTLS #ifdef DM_IOCTLS
if (ioctl(_control_fd, command, dmi) < 0) { if (ioctl(_control_fd, command, dmi) < 0) {