mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 13:20:11 +01:00
Move decision on forcing weak password to tool directly.
This commit is contained in:
committed by
Milan Broz
parent
379322f0b8
commit
c2371f95c6
@@ -1271,7 +1271,7 @@ static int _luksFormat(struct crypt_device **r_cd, char **r_password, size_t *r_
|
||||
|
||||
r = tools_get_key(NULL, &password, &passwordLen,
|
||||
ARG_UINT64(OPT_KEYFILE_OFFSET_ID), ARG_UINT32(OPT_KEYFILE_SIZE_ID), ARG_STR(OPT_KEY_FILE_ID),
|
||||
ARG_UINT32(OPT_TIMEOUT_ID), _verify_passphrase(1), 1, cd);
|
||||
ARG_UINT32(OPT_TIMEOUT_ID), _verify_passphrase(1), !ARG_SET(OPT_FORCE_PASSWORD_ID), cd);
|
||||
if (r < 0)
|
||||
goto out;
|
||||
|
||||
@@ -1647,7 +1647,7 @@ static int luksAddUnboundKey(void)
|
||||
&password_new, &password_new_size,
|
||||
ARG_UINT64(OPT_NEW_KEYFILE_OFFSET_ID), ARG_UINT32(OPT_NEW_KEYFILE_SIZE_ID),
|
||||
new_key_file, ARG_UINT32(OPT_TIMEOUT_ID),
|
||||
_verify_passphrase(1), 1, cd);
|
||||
_verify_passphrase(1), !ARG_SET(OPT_FORCE_PASSWORD_ID), cd);
|
||||
if (r < 0)
|
||||
goto out;
|
||||
|
||||
@@ -1721,7 +1721,7 @@ static int action_luksAddKey(void)
|
||||
&password_new, &password_new_size,
|
||||
ARG_UINT64(OPT_NEW_KEYFILE_OFFSET_ID), ARG_UINT32(OPT_NEW_KEYFILE_SIZE_ID),
|
||||
new_key_file, ARG_UINT32(OPT_TIMEOUT_ID),
|
||||
_verify_passphrase(1), 1, cd);
|
||||
_verify_passphrase(1), !ARG_SET(OPT_FORCE_PASSWORD_ID), cd);
|
||||
if (r < 0)
|
||||
goto out;
|
||||
|
||||
@@ -1754,7 +1754,7 @@ static int action_luksAddKey(void)
|
||||
r = tools_get_key(_("Enter new passphrase for key slot: "),
|
||||
&password_new, &password_new_size,
|
||||
ARG_UINT64(OPT_NEW_KEYFILE_OFFSET_ID), ARG_UINT32(OPT_NEW_KEYFILE_SIZE_ID), new_key_file,
|
||||
ARG_UINT32(OPT_TIMEOUT_ID), _verify_passphrase(1), 1, cd);
|
||||
ARG_UINT32(OPT_TIMEOUT_ID), _verify_passphrase(1), !ARG_SET(OPT_FORCE_PASSWORD_ID), cd);
|
||||
if (r < 0)
|
||||
goto out;
|
||||
|
||||
@@ -1822,7 +1822,7 @@ static int action_luksChangeKey(void)
|
||||
&password_new, &password_new_size,
|
||||
ARG_UINT64(OPT_NEW_KEYFILE_OFFSET_ID), ARG_UINT32(OPT_NEW_KEYFILE_SIZE_ID),
|
||||
new_key_file,
|
||||
ARG_UINT32(OPT_TIMEOUT_ID), _verify_passphrase(1), 1, cd);
|
||||
ARG_UINT32(OPT_TIMEOUT_ID), _verify_passphrase(1), !ARG_SET(OPT_FORCE_PASSWORD_ID), cd);
|
||||
if (r < 0)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ extern int opt_debug;
|
||||
extern int opt_debug_json;
|
||||
extern int opt_verbose;
|
||||
extern int opt_batch_mode;
|
||||
extern int opt_force_password;
|
||||
extern int opt_progress_frequency;
|
||||
|
||||
/* Common tools */
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include "cryptsetup.h"
|
||||
#include <termios.h>
|
||||
|
||||
int opt_force_password = 0;
|
||||
|
||||
#if defined ENABLE_PWQUALITY
|
||||
#include <pwquality.h>
|
||||
|
||||
@@ -275,7 +273,7 @@ int tools_get_key(const char *prompt,
|
||||
set_int_block(1);
|
||||
|
||||
/* Check pwquality for password (not keyfile) */
|
||||
if (pwquality && !opt_force_password && !key_file && !r)
|
||||
if (pwquality && !key_file && !r)
|
||||
r = tools_check_pwquality(*key);
|
||||
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user