[PATCH] add device name and target name to LUKS password prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hiyas,

attached is a patch that adds the device name and target name to the LUKS
password prompt, e.g. it will look like:

# cryptsetup luksOpen /dev/loop0 foo
Enter LUKS passphrase for /dev/loop0 (foo):

The intention of the patch is to make it easier to recognize which password
is required if one uses cryptsetup in scripts, e.g. at startup.

The patch was originally created by Bill Nottingham for Fedora and only
mentioned the device name.

Regards,
Till
diff -up cryptsetup-1.0.6/lib/setup.c.prompt cryptsetup-1.0.6/lib/setup.c
--- cryptsetup-1.0.6/lib/setup.c.prompt	2008-03-10 23:27:04.000000000 +0100
+++ cryptsetup-1.0.6/lib/setup.c	2008-11-06 13:51:37.000000000 +0100
@@ -444,6 +476,7 @@ static int __crypt_luks_open(int arg, st
 {
 	struct luks_masterkey *mk=NULL;
 	struct luks_phdr hdr;
+	char *prompt = NULL;
 	char *password; int passwordLen;
 	struct device_infos infos;
 	struct crypt_options tmp = {
@@ -471,10 +504,14 @@ static int __crypt_luks_open(int arg, st
 	if (infos.readonly)
 		options->flags |= CRYPT_FLAG_READONLY;
 
+	if(asprintf(&prompt, "Enter LUKS passphrase for %s (%s): ", options->device, options->name) < 0) {
+		return -ENOMEM;
+	}
+
 start:
 	mk=NULL;
 
-	if(get_key("Enter LUKS passphrase: ",&password,&passwordLen, 0, options->key_file,  options->passphrase_fd, options->timeout, options->flags))
+	if(get_key(prompt, &password, &passwordLen, 0, options->key_file, options->passphrase_fd, options->timeout, options->flags))
 		tries--;
 	else
 		tries = 0;


---------------------------------------------------------------------
dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/
To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx
For additional commands, e-mail: dm-crypt-help@xxxxxxxx

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux