mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Display device name when asking for password.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@53 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -507,6 +507,7 @@ static int __crypt_luks_open(int arg, struct setup_backend *backend, struct cryp
|
|||||||
{
|
{
|
||||||
struct luks_masterkey *mk=NULL;
|
struct luks_masterkey *mk=NULL;
|
||||||
struct luks_phdr hdr;
|
struct luks_phdr hdr;
|
||||||
|
char *prompt = NULL;
|
||||||
char *password;
|
char *password;
|
||||||
unsigned int passwordLen;
|
unsigned int passwordLen;
|
||||||
struct device_infos infos;
|
struct device_infos infos;
|
||||||
@@ -534,10 +535,13 @@ static int __crypt_luks_open(int arg, struct setup_backend *backend, struct cryp
|
|||||||
if (infos.readonly)
|
if (infos.readonly)
|
||||||
options->flags |= CRYPT_FLAG_READONLY;
|
options->flags |= CRYPT_FLAG_READONLY;
|
||||||
|
|
||||||
|
if(asprintf(&prompt, "Enter LUKS passphrase for %s: ", options->device) < 0)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
start:
|
start:
|
||||||
mk=NULL;
|
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--;
|
tries--;
|
||||||
else
|
else
|
||||||
tries = 0;
|
tries = 0;
|
||||||
@@ -582,6 +586,7 @@ start:
|
|||||||
out1:
|
out1:
|
||||||
safe_free(password);
|
safe_free(password);
|
||||||
out:
|
out:
|
||||||
|
free(prompt);
|
||||||
LUKS_dealloc_masterkey(mk);
|
LUKS_dealloc_masterkey(mk);
|
||||||
if (r == -EPERM && tries > 0)
|
if (r == -EPERM && tries > 0)
|
||||||
goto start;
|
goto start;
|
||||||
|
|||||||
Reference in New Issue
Block a user