From 1411b1bd795bcf4a382dd8ed2aa09f94e352f848 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 12 Dec 2017 17:24:55 +0100 Subject: Unify unencrypted volume ro/rw switching For 0.49 run new command, which needs Admin PIN For 0.48 and lower run old command Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'NitrokeyManager.cc') diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index d12bf54..eb52eee 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -824,23 +824,19 @@ using nitrokey::misc::strcpyT; } void NitrokeyManager::set_unencrypted_read_only(const char* user_pin) { - //available until 0.48 - misc::execute_password_command(device, user_pin); + //until 0.48 User PIN was sufficient, from 0.49 it needs Admin PIN + if (get_minor_firmware_version()<=48) + misc::execute_password_command(device, user_pin); + else + misc::execute_password_command(device, user_pin); } void NitrokeyManager::set_unencrypted_read_write(const char* user_pin) { - //available until 0.48 - misc::execute_password_command(device, user_pin); - } - - void NitrokeyManager::set_unencrypted_read_only_admin_pin(const char* admin_pin) { - //available from 0.49 - misc::execute_password_command(device, admin_pin); - } - - void NitrokeyManager::set_unencrypted_read_write_admin_pin(const char* admin_pin) { - //available from 0.49 - misc::execute_password_command(device, admin_pin); + //until 0.48 User PIN was sufficient, from 0.49 it needs Admin PIN + if (get_minor_firmware_version()<=48) + misc::execute_password_command(device, user_pin); + else + misc::execute_password_command(device, user_pin); } void NitrokeyManager::export_firmware(const char* admin_pin) { -- cgit v1.2.1