From 81d61227e3a8d48c1dcc04f945a0888a7fdfdace Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Sat, 19 Sep 2020 16:25:40 +0200 Subject: Deprecate old setters for UV ro/rw attribute Use DEPRECATED macro on noop calls for NK Storage v0.51+ Update Travis CI config Fixes #182 --- .travis.yml | 3 +-- NK_C_API.cc | 7 ++++++- NK_C_API.h | 8 ++++++-- libnitrokey/NitrokeyManager.h | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f3cec0..69de990 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ language: generic -sudo: false os: osx env: global: - CF="-DCOMPILE_OFFLINE_TESTS=1 -DERROR_ON_WARNING=ON" -matrix: +jobs: include: - osx_image: xcode11.5 - osx_image: xcode9.1 diff --git a/NK_C_API.cc b/NK_C_API.cc index 538a6a1..c84e402 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -604,6 +604,9 @@ extern "C" { }); } + // deprecated, noop on v0.51 and older (excl. v0.49) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" NK_C_API int NK_set_unencrypted_read_only(const char *user_pin) { auto m = NitrokeyManager::instance(); return get_without_result([&]() { @@ -611,12 +614,14 @@ extern "C" { }); } - NK_C_API int NK_set_unencrypted_read_write(const char *user_pin) { + // deprecated, noop on v0.51 and older (excl. v0.49) + NK_C_API int NK_set_unencrypted_read_write(const char *user_pin) { auto m = NitrokeyManager::instance(); return get_without_result([&]() { m->set_unencrypted_read_write(user_pin); }); } +#pragma GCC diagnostic pop NK_C_API int NK_set_unencrypted_read_only_admin(const char *admin_pin) { auto m = NitrokeyManager::instance(); diff --git a/NK_C_API.h b/NK_C_API.h index 5341c08..68fb56c 100644 --- a/NK_C_API.h +++ b/NK_C_API.h @@ -837,7 +837,9 @@ extern "C" { * @param user_pin 20 characters User PIN * @return command processing error code */ - NK_C_API int NK_set_unencrypted_read_only(const char *user_pin); + //[[deprecated("Use NK_set_unencrypted_read_only_admin instead")]] + DEPRECATED + NK_C_API int NK_set_unencrypted_read_only(const char *user_pin); /** * Make unencrypted volume read-write. @@ -849,7 +851,9 @@ extern "C" { * @param user_pin 20 characters User PIN * @return command processing error code */ - NK_C_API int NK_set_unencrypted_read_write(const char *user_pin); + //[[deprecated("Use NK_set_unencrypted_read_write_admin instead")]] + DEPRECATED + NK_C_API int NK_set_unencrypted_read_write(const char *user_pin); /** * Make unencrypted volume read-only. diff --git a/libnitrokey/NitrokeyManager.h b/libnitrokey/NitrokeyManager.h index 163a799..cb7cfce 100644 --- a/libnitrokey/NitrokeyManager.h +++ b/libnitrokey/NitrokeyManager.h @@ -158,6 +158,7 @@ char * strndup(const char* str, size_t maxlen); * Does nothing otherwise. * @param user_pin User PIN */ + [[deprecated("Use set_unencrypted_read_only_admin instead.")]] void set_unencrypted_read_only(const char *user_pin); /** @@ -174,6 +175,7 @@ char * strndup(const char* str, size_t maxlen); * Does nothing otherwise. * @param user_pin User PIN */ + [[deprecated("Use set_unencrypted_read_write_admin instead")]] void set_unencrypted_read_write(const char *user_pin); /** -- cgit v1.2.3