summaryrefslogtreecommitdiff
path: root/src/tests/pws.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2018-06-07 00:41:20 +0200
committerRobin Krahl <robin.krahl@ireas.org>2018-06-07 00:41:20 +0200
commitf95e2be7422243bbbb07ae07f6b026bd6d578099 (patch)
tree81f98fffe8c89b19e82eb9e28ff0d6b1a7a7c2a4 /src/tests/pws.rs
parent22e378677d5b00a05c021dc6660651608b384e0d (diff)
downloadnitrokey-rs-f95e2be7422243bbbb07ae07f6b026bd6d578099.tar.gz
nitrokey-rs-f95e2be7422243bbbb07ae07f6b026bd6d578099.tar.bz2
Remove NK_lock_device call from PasswordSafe::drop
When enabled, the password safe can be used without authentication. The lock device can be used to lock the password safe. Currently, PasswordSafe::drop calls this command to make sure that other applications cannot access the password safe without authentication. On the Nitrokey Storage, locking the device may also disable the encrypted or hidden volume. As using the password safe should not have side effects on the storage volumes, this patch removes the call to the lock device command from the Drop implementation. Instead, the user should call this method after making sure that it does not have side effects. A feature request for a command that only locks the password safe without side effects is submitted to the Nitrokey Storage firmware repository: https://github.com/Nitrokey/nitrokey-storage-firmware/issues/65
Diffstat (limited to 'src/tests/pws.rs')
-rw-r--r--src/tests/pws.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tests/pws.rs b/src/tests/pws.rs
index d6125a9..02e33cd 100644
--- a/src/tests/pws.rs
+++ b/src/tests/pws.rs
@@ -1,3 +1,4 @@
+use device::Device;
use nitrokey_sys;
use pws::{GetPasswordSafe, PasswordSafe, SLOT_COUNT};
use tests::util::{Target, ADMIN_PASSWORD, USER_PASSWORD};
@@ -36,6 +37,9 @@ fn drop() {
assert_eq!(Ok(String::from("name")), result);
}
let result = result_from_string(unsafe { nitrokey_sys::NK_get_password_safe_slot_name(1) });
+ assert_eq!(Ok(String::from("name")), result);
+ device.lock();
+ let result = result_from_string(unsafe { nitrokey_sys::NK_get_password_safe_slot_name(1) });
assert_eq!(Err(CommandError::NotAuthorized), result);
}