Fix luksFormat/luksOpen reading passphrase from stdin and "-" keyfile.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@237 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Milan Broz
2010-05-27 18:44:00 +00:00
parent 205d62af89
commit 231ab0167b
4 changed files with 23 additions and 2 deletions

View File

@@ -299,7 +299,7 @@ static int _action_luksFormat_generateMK()
.device = action_argv[0],
.cipher = opt_cipher ?: DEFAULT_CIPHER(LUKS1),
.hash = opt_hash ?: DEFAULT_LUKS1_HASH,
.new_key_file = action_argc > 1 ? action_argv[1] : NULL,
.new_key_file = opt_key_file ?: (action_argc > 1 ? action_argv[1] : NULL),
.flags = opt_verify_passphrase ? CRYPT_FLAG_VERIFY : (!opt_batch_mode?CRYPT_FLAG_VERIFY_IF_POSSIBLE : 0),
.iteration_time = opt_iteration_time,
.timeout = opt_timeout,
@@ -387,6 +387,9 @@ static int action_luksFormat(int arg)
return -EINVAL;
}
if (action_argc > 1 && opt_key_file)
log_err(_("Option --key-file takes precedence over specified key file argument.\n"));
if(asprintf(&msg, _("This will overwrite data on %s irrevocably."), action_argv[0]) == -1) {
log_err(_("memory allocation error in action_luksFormat"));
return -ENOMEM;