honour disable-token
This commit is contained in:
parent
e5c6ca9237
commit
4b09fcb6cb
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
@ -33,7 +33,7 @@ fn derive_secret(
|
||||
timeout: u64,
|
||||
pin: Option<&str>,
|
||||
) -> Fido2LuksResult<([u8; 32], FidoCredential)> {
|
||||
if credentials.len() == 0 {
|
||||
if credentials.is_empty() {
|
||||
return Err(Fido2LuksError::InsufficientCredentials);
|
||||
}
|
||||
let timeout = Duration::from_secs(timeout);
|
||||
@ -419,7 +419,7 @@ pub fn run_cli() -> Fido2LuksResult<()> {
|
||||
let slot = if let Some(ref credentials) = credentials.ids {
|
||||
secret(Cow::Borrowed(&credentials.0))
|
||||
.and_then(|(secret, _cred)| luks_dev.activate(&name, &secret, luks.slot))
|
||||
} else if luks_dev.is_luks2()? {
|
||||
} else if luks_dev.is_luks2()? && !luks.disable_token {
|
||||
luks_dev.activate_token(
|
||||
&name,
|
||||
Box::new(|credentials: Vec<String>| {
|
||||
@ -432,8 +432,11 @@ pub fn run_cli() -> Fido2LuksResult<()> {
|
||||
}),
|
||||
luks.slot,
|
||||
)
|
||||
} else if luks_dev.is_luks2()? && luks.disable_token {
|
||||
// disable-token is mostly cosmetic in this instance
|
||||
return Err(Fido2LuksError::InsufficientCredentials);
|
||||
} else {
|
||||
return Err(Fido2LuksError::WrongSecret); // creds or luks2
|
||||
return Err(Fido2LuksError::WrongSecret);
|
||||
};
|
||||
match slot {
|
||||
Err(e) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user