platform/core/security/cynara.git
2 years agoRelease 0.18.1 79/287379/1 accepted/tizen_6.5_unified tizen_6.5 accepted/tizen/6.5/unified/20230222.114559 accepted/tizen/unified/20230130.165635 submit/tizen_6.5/20230220.131810
Tomasz Swierczek [Fri, 27 Jan 2023 10:21:44 +0000 (11:21 +0100)]
Release 0.18.1

* Change release mode log level to warning

Change-Id: I3fd4087d40cf0ecdf14005fda7cf61c0975367fd

2 years agoChange release mode log level to warning 78/287378/1
Tomasz Swierczek [Fri, 27 Jan 2023 09:55:09 +0000 (10:55 +0100)]
Change release mode log level to warning

Debug logs are clearly only for debug mode, but warnings
can be helpful in release mode (VD request).

Change-Id: I86b390fe2838aec3b793ca4bf9b274554a8e6d78

2 years agoRelease 0.18.0 accepted/tizen/7.0/unified/20221228.170429 accepted/tizen/unified/20221228.165958
Dariusz Michaluk [Fri, 23 Dec 2022 07:34:46 +0000 (08:34 +0100)]
Release 0.18.0

* [helpers] Fix linking with creds-commons
* Add dbus helper API to fetch all credentials in one call
* Add gdbus helper API to fetch all credentials in one call
* Change some logs into warnings

Change-Id: Ic5f161e7410e8f93b607d7bb758d17ba322f5a4b

2 years ago[helpers] Fix linking with creds-commons
Zofia Abramowska [Thu, 15 Dec 2022 21:06:09 +0000 (22:06 +0100)]
[helpers] Fix linking with creds-commons

As TARGET_LIB_CREDS_COMMONS wasn't defined on level visible
for credential helpers build, credential libraries were not
properly linked.

Change-Id: I340cb0a312a3f98e9bf11957423a57fc40a35b65

2 years agoAdd dbus helper API to fetch all credentials in one call
Zofia Abramowska [Thu, 15 Dec 2022 22:39:53 +0000 (23:39 +0100)]
Add dbus helper API to fetch all credentials in one call

Change-Id: I17653b94fe79065354bdb82c52c378d9126dab15

2 years agoAdd gdbus helper API to fetch all credentials in one call 00/285700/4
Zofia Abramowska [Thu, 15 Dec 2022 22:39:19 +0000 (23:39 +0100)]
Add gdbus helper API to fetch all credentials in one call

Change-Id: Ie3a0446b60f837bdec42c80323fa6809c7cdddc9

2 years agoChange some logs into warnings 24/285624/2
Tomasz Swierczek [Thu, 15 Dec 2022 11:46:15 +0000 (12:46 +0100)]
Change some logs into warnings

As requested explicitly by Visual Display Division.

Change-Id: I54d18b426d0fc1f65d92352036e660ed6310736d

2 years agoRelease 0.17.2 36/284836/2 accepted/tizen/7.0/unified/20221129.172448 accepted/tizen/unified/20221129.172513
Tomasz Swierczek [Mon, 28 Nov 2022 11:31:12 +0000 (12:31 +0100)]
Release 0.17.2

* Add additional logs
* Implement better tryCatch
* Put some .cpp-local entities in anon ns
* Remove unused sec_build_binary_debug_enable build macro

Change-Id: I40820f05f1ddbe5a9a7455c2796e5dbd64b56b35

2 years agoAdd additional logs 35/284835/2
Tomasz Swierczek [Mon, 28 Nov 2022 11:28:58 +0000 (12:28 +0100)]
Add additional logs

All done for explicit request of Visual Display division.

Change-Id: I7b4f6a487d1dddf5288c3ab5758249bd3e3c6b5e

2 years agoImplement better tryCatch 97/275097/9
Tomasz Swierczek [Mon, 16 May 2022 12:31:44 +0000 (14:31 +0200)]
Implement better tryCatch

     "Gotta catch them all!"
- from Pokémon

Recently it was reported that there's an issue if not-handled
std::bad_alloc in Cynara. After getting more information
(incl. decompiled version of the module), it was found that
when compiled using gcc, implementation of std::function made on-the fly
as argument to tryCatch() is being allocated BEFORE passing it to
the tryCatch() function.

When compiled using clang9, there is no new() in that place.

This patch changes tryCatch() to a template with function being
an R-value reference with std::forward, solving the issue.

Decompiled version with additional new
(thanks to Konstiantyn Melnik, k.melnik@samsung.com):

int __cdecl cynara_check(void *cynara_struct, char *client, char *client_session, char *user, char *privilege)
{
  int v5; // ebx
  char ***lambda_func_obj; // eax
  char *__loc_privilege_ptr; // [esp+1Ch] [ebp-4Ch]
  char *__loc_user_str; // [esp+20h] [ebp-48h]
  char *__loc_client_session_str; // [esp+24h] [ebp-44h]
  char *__loc_client_str; // [esp+28h] [ebp-40h]
  void *__loc_cynara_struct; // [esp+2Ch] [ebp-3Ch]
  char ***lambda_func_ptr; // [esp+3Ch] [ebp-2Ch]
  int (__cdecl *v14)(void **, void **, unsigned int); // [esp+44h] [ebp-24h]
  int (__cdecl *func_to_run)(void *); // [esp+48h] [ebp-20h]
  unsigned int guard_var; // [esp+4Ch] [ebp-1Ch]

  __loc_privilege_ptr = privilege;
  __loc_cynara_struct = cynara_struct;
  __loc_user_str = user;
  __loc_client_str = client;
  __loc_client_session_str = client_session;
  guard_var = __readgsdword(0x14u);
  if ( cynara_struct
    && *(_DWORD *)cynara_struct                 // if (!p_cynara || !p_cynara->impl)
                                                //         return CYNARA_API_INVALID_PARAM;
    && client                                   //     if (!isStringValid(client) || !isStringValid(client_session))
                                                //         return CYNARA_API_INVALID_PARAM;
    && strlen(client) <= 0x1000
    && client_session
    && strlen(client_session) <= 0x1000
    && user
    && strlen(user) <= 0x1000                   //     if (!isStringValid(user) || !isStringValid(privilege))
                                                //         return CYNARA_API_INVALID_PARAM;
    && privilege
    && strlen(privilege) <= 0x1000 )
  {
    lambda_func_obj = (char ***)operator new(0x14u);
    lambda_func_ptr = lambda_func_obj;
    *lambda_func_obj = &__loc_client_str;
    lambda_func_obj[1] = &__loc_client_session_str;
    lambda_func_obj[2] = &__loc_user_str;
    lambda_func_obj[3] = &__loc_privilege_ptr;
    lambda_func_obj[4] = (char **)&__loc_cynara_struct;
    func_to_run = (int (__cdecl *)(void *))sub_4B80;
    v14 = sub_3930;
    v5 = Cynara::tryCatch(&lambda_func_ptr);
    if ( v14 )
      v14((void **)&lambda_func_ptr, (void **)&lambda_func_ptr, 3u);
  }
  else
  {
    v5 = -4;
  }
  if ( __readgsdword(0x14u) != guard_var )
    terminate_proc();
  return v5;
}

Change-Id: I5455d03d411b03ed76a81659efb60c6474ceb99b

3 years agoPut some .cpp-local entities in anon ns 90/267590/2
Konrad Lipinski [Tue, 7 Dec 2021 12:54:40 +0000 (13:54 +0100)]
Put some .cpp-local entities in anon ns

This fixes at least one ODR violtation (FakeStreamForBucketId) which was
defined twice, in test/storage/serializer/{deserialize,serializer}.cpp.
Two unit tests would fail in some environments as a result, particularly
StorageSerializerFixture.dumpBucketsPositive, due to dynamic_cast
failing within gtest (the one from serializer.cpp was being cast to the
one from deserializer.cpp).

Change-Id: Ie0dc0191b4e45d032b68b0df9bfcdf81fca8678f

3 years agoRemove unused sec_build_binary_debug_enable build macro 97/267097/1
Dariusz Michaluk [Thu, 25 Nov 2021 10:34:30 +0000 (11:34 +0100)]
Remove unused sec_build_binary_debug_enable build macro

Change-Id: I3d8c8e4c936449ff36b7288580d90383ce64a2fe

4 years agoRelease 0.17.1 18/256818/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/6.5/unified/20211028.115310 accepted/tizen/7.0/unified/20221110.062252 accepted/tizen/7.0/unified/hotfix/20221116.105528 accepted/tizen/unified/20210420.090123 submit/tizen/20210419.055354 submit/tizen_6.5/20211028.162401 tizen_6.5.m2_release tizen_7.0_m2_release
Konrad Lipinski [Tue, 13 Apr 2021 12:06:53 +0000 (14:06 +0200)]
Release 0.17.1

* Fix UB in predicate-driven PolicyBucket erasure

Change-Id: Iee7c125a927905e68e3477c0126b989951f5366c

4 years agoFix UB in predicate-driven PolicyBucket erasure 70/256770/2
Konrad Lipinski [Mon, 12 Apr 2021 14:39:25 +0000 (16:39 +0200)]
Fix UB in predicate-driven PolicyBucket erasure

Change-Id: Ic1559c79c875e503ac165c29671460ad56deaab2

4 years agoRelease 0.17.0 69/255769/2 submit/tizen/20210324.154641
Konrad Lipinski [Tue, 23 Mar 2021 11:03:56 +0000 (12:03 +0100)]
Release 0.17.0

* Automate code coverage measurement
* Add dependency warning on enabling journal logs in cynara-client
* Shrink CapacityCache keys, speed up generation
* Prevent iterator invalidation in CapacityCache
* Fix zero-initialization of class members
* Remove unused code
* Categorize existing unit tests into positive & negative cases
* Add/amend assorted unit tests to increase coverage
* Fix cyad backup command help position and message
* Redo error printing in cyad
* Remove unnecessary copies
* Force googletest to build with c++17 instead of c++11
* Move protocol serialization/deserialization to one place
* Ensure that MonitorCache capacity is of permissible size

Change-Id: I1daf23ca44ec9fb41ebb29ae1e8facd84a14ae0c

4 years agoFix debug source directory name in coverage script 52/255452/1
Dariusz Michaluk [Thu, 18 Mar 2021 11:56:31 +0000 (12:56 +0100)]
Fix debug source directory name in coverage script

Change-Id: I0789ea1b0676438e2f1be3c7e55a652074a69e4e

4 years agoFix coverage generation in rpm 4.14.1 92/254492/1
Tomasz Swierczek [Wed, 3 Mar 2021 13:59:09 +0000 (14:59 +0100)]
Fix coverage generation in rpm 4.14.1

Debug source package directories now have different names.

Change-Id: Ic84985a203189b67ce01e0db8be222756e1e2f77

4 years agoAdd dependency warning on enabling journal logs in cynara-client 24/253824/3
Tomasz Swierczek [Thu, 18 Feb 2021 08:50:52 +0000 (09:50 +0100)]
Add dependency warning on enabling journal logs in cynara-client

libdbus-policy is going to be integrated with systemd on
kdbus-aware systems. This, combined with cynara-client
which can be configured to use journal (systemd) logs,
can lead to cyclic build dependency:

systemd -> libdbus-policy -> cynara -> systemd

This patch adds a warning comment in spec file where configuration
of the logging module is done and adds a warning displayed from
CMake during build to check the cyclic dependency.

Removal of journal logging was not performend as older cynara
releases used to take advantage of it and the implementation
may be still useful.

Change-Id: I474ae7d6f2724dbaf855adb2c49cea38168d85a3

4 years agoMove CapacityCache::keyToString() to anonymous namespace 88/253688/2
Konrad Lipinski [Tue, 16 Feb 2021 10:51:30 +0000 (11:51 +0100)]
Move CapacityCache::keyToString() to anonymous namespace

Change-Id: I528688316856505b734109fa5fb6e263f9752def

4 years agoShrink CapacityCache keys, speed up generation 47/253547/1
Konrad Lipinski [Mon, 15 Feb 2021 07:05:17 +0000 (08:05 +0100)]
Shrink CapacityCache keys, speed up generation

Change-Id: Ifc8806b934e7a44a81a3e58e850755ad8baf3765

4 years agoPrevent iterator invalidation in CapacityCache 95/253495/3
Krzysztof Jackiewicz [Fri, 12 Feb 2021 09:00:35 +0000 (10:00 +0100)]
Prevent iterator invalidation in CapacityCache

If resultIt happens to point to the element that gets evicted, it will
be invalidated. Perform lookup after possible eviction.

Change-Id: I4d536c6779494f85077a247e3356374346fa35b2

4 years agoAutomate code coverage measurement 47/243047/5
Dariusz Michaluk [Wed, 2 Sep 2020 13:56:43 +0000 (15:56 +0200)]
Automate code coverage measurement

To gather unit tests coverage report:
- use COVERAGE build_type,
- instal cynara-coverage rpm,
- run cynara-coverage.sh script.

Change-Id: I96e113e2fff06e126ea20a1a2bb06dfdd98ae0db

4 years agoFix zero-initialization of class members 38/245138/2
Mateusz Cegielka [Fri, 2 Oct 2020 13:40:40 +0000 (15:40 +0200)]
Fix zero-initialization of class members

Some class members are not zero-initialized, which can cause seemingly
innocent initializations to result in uninitialized memory, which can
cause UB. While unlikely, this shows up as a critical issue in SVACE.

I have changed the constructors so that they explicitly initialize
members in order to fix the issue.

Change-Id: I16e1f253985e1c37f3b5ee67d3d9c91696706054

4 years agoRemove unused files 32/243032/1
Dariusz Michaluk [Wed, 2 Sep 2020 13:40:27 +0000 (15:40 +0200)]
Remove unused files

Change-Id: I7751179a91f0b468e67ff6ff621028bfdfbf5f13

4 years agoCategorize performance unit tests 61/240361/2
Zofia Abramowska [Wed, 5 Aug 2020 16:48:27 +0000 (18:48 +0200)]
Categorize performance unit tests

Categorize into positive/negative test cases.

Change-Id: I19e49df3f26e84f368e744aae235cc3725cdeae6

4 years agoCategorize EntriesQueue unit tests 60/240360/2
Zofia Abramowska [Wed, 5 Aug 2020 16:41:30 +0000 (18:41 +0200)]
Categorize EntriesQueue unit tests

Categorize into positive/negative test cases.

Change-Id: I296ea8d0e768eb86eacdfe986ae7e9764e33deb4

4 years agoCategorize PolicKey unit tests 59/240359/2
Zofia Abramowska [Wed, 5 Aug 2020 16:15:46 +0000 (18:15 +0200)]
Categorize PolicKey unit tests

Categorize into positive/negative test cases.

Change-Id: Ic00e9a906c50f40eb92bfede740e73ef8daa0650

4 years agoCategorize StorageDeserializer and StorageSerializer unit tests 58/240358/2
Zofia Abramowska [Wed, 5 Aug 2020 16:12:32 +0000 (18:12 +0200)]
Categorize StorageDeserializer and StorageSerializer unit tests

Categorize into positive/negative test cases.

Change-Id: I3c1c1f295993b9fa511b7401f8929df6bb93e227

4 years agoCategorize BucketDeserializer unit tests 57/240357/2
Zofia Abramowska [Wed, 5 Aug 2020 16:10:04 +0000 (18:10 +0200)]
Categorize BucketDeserializer unit tests

Categorize into positive/negative test cases.

Change-Id: I6986240e763cc1ea274415b0abaaa4496be0a446

4 years agoCategorize InMemoryStorageBackend unit tests 56/240356/2
Zofia Abramowska [Wed, 5 Aug 2020 16:06:15 +0000 (18:06 +0200)]
Categorize InMemoryStorageBackend unit tests

Categorize into positive/negative test cases.

Change-Id: Ie5212cef2761849dfbee1430293b7ea2f07215b0

4 years agoCategorize Storage unit tests 55/240355/2
Zofia Abramowska [Wed, 5 Aug 2020 15:56:43 +0000 (17:56 +0200)]
Categorize Storage unit tests

Categorize into positive/negative test cases.

Change-Id: I33b618de130e7d496848f7213ac392279e0f854a

4 years agoCategorize ChecksumValidator unit tests 54/240354/2
Zofia Abramowska [Wed, 5 Aug 2020 15:52:50 +0000 (17:52 +0200)]
Categorize ChecksumValidator unit tests

Categorize into positive/negative test cases.

Change-Id: I67e876a1b6205bf64e0261278732f95e9593274b

4 years agoCategorize EntriesManager unit tests 53/240353/2
Zofia Abramowska [Wed, 5 Aug 2020 15:48:44 +0000 (17:48 +0200)]
Categorize EntriesManager unit tests

Categorize into positive/negative test cases.

Change-Id: I24f66ec022f60434399567880659b87fca53e4df

4 years agoCategorize Cynara cmdline parser unit tests 52/240352/2
Zofia Abramowska [Wed, 5 Aug 2020 15:27:19 +0000 (17:27 +0200)]
Categorize Cynara cmdline parser unit tests

Categorize into positive/negative test cases.

Change-Id: I13a7d04717131024a151b2dd8f321800927353a7

4 years agoCategorize AdminPolicyParser unit tests 51/240351/2
Zofia Abramowska [Wed, 5 Aug 2020 15:21:25 +0000 (17:21 +0200)]
Categorize AdminPolicyParser unit tests

Categorize into positive/negative test cases.

Change-Id: Ia86512bfc7fa91ff1f941c93f4bb279cc5b5a637

4 years agoCategorize CynaraAdminPolicies unit tests 50/240350/2
Zofia Abramowska [Wed, 5 Aug 2020 15:19:43 +0000 (17:19 +0200)]
Categorize CynaraAdminPolicies unit tests

Categorize into positive/negative test cases.

Change-Id: Ied6728a02db0f05d741afbee24fad0d60e14d91e

4 years agoAdd missing test categorization in ProtocolAdmin negative unit tests 49/240349/2
Zofia Abramowska [Wed, 5 Aug 2020 14:58:40 +0000 (16:58 +0200)]
Add missing test categorization in ProtocolAdmin negative unit tests

Change-Id: I152549b18c914c5c807484caf90ee6f94b204997

4 years agoRedo cyad commands dispatcher unit tests 48/240348/2
Zofia Abramowska [Mon, 3 Aug 2020 10:41:33 +0000 (12:41 +0200)]
Redo cyad commands dispatcher unit tests

* Minor refactorin
* Categorize into positive/negative test cases

Change-Id: Ib449c1b76863d84cda543db752d965a1b5abbf05

4 years agoCategorize CmdlineOpts unit tests 32/240032/4
Zofia Abramowska [Fri, 31 Jul 2020 16:20:01 +0000 (18:20 +0200)]
Categorize CmdlineOpts unit tests

Categorize into positive/negative test cases.

Change-Id: Ifa0d505ab9fb2e678f69ea5664f15a1922e5fd5c

4 years agoRedo Cyad commandline unit tests 46/239446/6
Zofia Abramowska [Fri, 24 Jul 2020 17:45:28 +0000 (19:45 +0200)]
Redo Cyad commandline unit tests

* rename positive/negative test cases
* add more negative test cases

Change-Id: I204814abcb11cfa41904ed5f3fa45223421cade5

4 years agoFix cyad backup command help position and message 45/239445/6
Zofia Abramowska [Fri, 24 Jul 2020 17:44:33 +0000 (19:44 +0200)]
Fix cyad backup command help position and message

Change-Id: I7c8f0de363e8d3b64922ea9d3947cbf37c04b931

4 years agoRedo error printing in cyad 44/239444/6
Zofia Abramowska [Fri, 24 Jul 2020 17:01:00 +0000 (19:01 +0200)]
Redo error printing in cyad

* remove unused error message generators
* systematize unknown option, missing option and missing argument
  errors printing for all main and sub options

Change-Id: I59368ffc0402b5f07d58616468a045c47fa3596d

4 years agoRedo Credentials Config Parser unit tests 92/239092/6
Zofia Abramowska [Tue, 21 Jul 2020 16:49:17 +0000 (18:49 +0200)]
Redo Credentials Config Parser unit tests

* Categorize into positive/negative test cases
* Split mixed test cases

Change-Id: I069b535d526aad4496dc6ef2befe7c96e133b8ce

4 years agoCategorize string validation unit tests 91/239091/5
Zofia Abramowska [Tue, 21 Jul 2020 15:20:19 +0000 (17:20 +0200)]
Categorize string validation unit tests

Categorize into positive/negative test cases.

Change-Id: I4675e0a5c8d0d8f5682d3d54667a265cd6ac03f4

4 years agoCategorize PolicyBucket unit tests 59/238959/6
Zofia Abramowska [Mon, 20 Jul 2020 18:38:56 +0000 (20:38 +0200)]
Categorize PolicyBucket unit tests

Categorize into positive/negative test cases.

Change-Id: I7f289446a33303cd1e2f1845a925176b6f294aef

4 years agoRemove unnecessary copies 58/238958/6
Zofia Abramowska [Mon, 20 Jul 2020 18:56:22 +0000 (20:56 +0200)]
Remove unnecessary copies

Change-Id: Iea05840fc9366319f17ccc98919efbbf4c350a99

4 years agoCategorize PolicyBucketFixture unit tests 56/238956/7
Zofia Abramowska [Mon, 20 Jul 2020 17:33:09 +0000 (19:33 +0200)]
Categorize PolicyBucketFixture unit tests

Categorize into positive/negative test cases.

Change-Id: Ic78e793e3d9d1ffe8e969f1f2054af2f83dc41ac

4 years agoRedo unit tests for MonitorGetEntriesRequest in ProtocolMonitorGet 55/238955/7
Zofia Abramowska [Mon, 20 Jul 2020 17:21:56 +0000 (19:21 +0200)]
Redo unit tests for MonitorGetEntriesRequest in ProtocolMonitorGet

* squash positive test cases

Change-Id: Ida7226e6692548d181cff18f18633d10ce2f6f36

4 years agoFix: Add missing using for ::testing::DoAll 54/238954/7
Zofia Abramowska [Mon, 20 Jul 2020 17:01:45 +0000 (19:01 +0200)]
Fix: Add missing using for ::testing::DoAll

Change-Id: I2f1c9b822fba93de3f513854a071b8684e563499

4 years agoForce googletest to build with c++17 instead of c++11 53/238953/7
Zofia Abramowska [Mon, 20 Jul 2020 16:55:11 +0000 (18:55 +0200)]
Force googletest to build with c++17 instead of c++11

Newest googletest builds explicitly with c++11. This makes this
standard propagate to cynara-tests compile options and causes
a build break. This should be only a temporary fix, as cynara CMake
build files should be rewritten properly.

Change-Id: I8afa84921fb2eb2979afc6a7e7b072428bdb258f

4 years agoRedo unit tests for MonitorGetEntriesResponse in ProtocolMonitorGet 52/238952/7
Zofia Abramowska [Mon, 20 Jul 2020 13:45:57 +0000 (15:45 +0200)]
Redo unit tests for MonitorGetEntriesResponse in ProtocolMonitorGet

* squash positive test cases
* add invalid protocol test cases

Change-Id: I2172a1a8814a924754411704b1d166df681ba92c

4 years agoRedo unit tests for MonitorGetFlushRequest in ProtocolMonitorGet 36/238836/7
Zofia Abramowska [Fri, 17 Jul 2020 16:34:10 +0000 (18:34 +0200)]
Redo unit tests for MonitorGetFlushRequest in ProtocolMonitorGet

* squash positive test cases

Change-Id: I848f90d1e9d565ee186f2728d37951144c297900

4 years agoAdd negative test case to RemoveBucketRequest unit tests 35/238835/7
Zofia Abramowska [Fri, 17 Jul 2020 16:23:02 +0000 (18:23 +0200)]
Add negative test case to RemoveBucketRequest unit tests

Add invalid protocol test case.

Change-Id: I06ddadc7acbd57c7f2bf52746a7770f23d0ad37f

4 years agoRedo unit tests for ListResponse in ProtocolAdmin 34/238834/7
Zofia Abramowska [Fri, 17 Jul 2020 15:48:49 +0000 (17:48 +0200)]
Redo unit tests for ListResponse in ProtocolAdmin

Change-Id: Ib012cc489597013c1b1af260d1c890af17e6673e

4 years agoRedo unit tests for ListRequest in ProtocolAdmin 33/238833/7
Zofia Abramowska [Fri, 17 Jul 2020 15:25:34 +0000 (17:25 +0200)]
Redo unit tests for ListRequest in ProtocolAdmin

* squash positive test cases
* add invalid protocol test cases

Change-Id: Iff443af42933c5ca8b942844b06c259a533b7627

4 years agoAdd negative test to InsertOrUpdateBucketRequest unit tests 32/238832/7
Zofia Abramowska [Fri, 17 Jul 2020 15:02:35 +0000 (17:02 +0200)]
Add negative test to InsertOrUpdateBucketRequest unit tests

Add invalid protocol test case.

Change-Id: I40928c4db573adaba9c5cc706033c37a7423f93d

4 years agoRedo unit tests for EraseRequest in ProtocolAdmin 30/238730/7
Zofia Abramowska [Thu, 16 Jul 2020 17:06:17 +0000 (19:06 +0200)]
Redo unit tests for EraseRequest in ProtocolAdmin

* squash positive test cases
* add invalid protocol test cases

Change-Id: I4e3d65668c3bd42ce56c8b3107b631affe7afd70

4 years agoRedo unit tests for DescriptionListResponse in ProtocolAdmin 29/238729/7
Zofia Abramowska [Thu, 16 Jul 2020 16:26:40 +0000 (18:26 +0200)]
Redo unit tests for DescriptionListResponse in ProtocolAdmin

* squash positive test cases
* add invalid protocol test case

Change-Id: I798369d477bf4feefcea93e9ac54423357cf2f26

4 years agoCategorize unit tests for DescriptionListRequest in ProtocolAdmin 28/238728/7
Zofia Abramowska [Thu, 16 Jul 2020 13:56:23 +0000 (15:56 +0200)]
Categorize unit tests for DescriptionListRequest in ProtocolAdmin

Categorize into positive/negative test cases.

Change-Id: I0a1c0b6b9e53ff31d3000d6994cd665df0d6905c

4 years agoRedo unit tests for AdminCheckResponse in ProtocolAdmin 27/238727/7
Zofia Abramowska [Thu, 16 Jul 2020 13:52:47 +0000 (15:52 +0200)]
Redo unit tests for AdminCheckResponse in ProtocolAdmin

* squash positive test cases
* add invalid protocol test case

Change-Id: I2a3e46e2df2942e091aa0620345c91c4e7d10bbb

4 years agoRedo unit tests for AdminCheckRequest in ProtocolAdmin 26/238726/6
Zofia Abramowska [Thu, 16 Jul 2020 13:20:14 +0000 (15:20 +0200)]
Redo unit tests for AdminCheckRequest in ProtocolAdmin

* squash positive test cases
* add invalid protocol test cases

Change-Id: Icfbceb6ba42d3ebf96855caf7a44482058fbb883

4 years agoCategorize BucketRecordCorruptedException unit tests 25/238725/6
Zofia Abramowska [Thu, 16 Jul 2020 13:06:55 +0000 (15:06 +0200)]
Categorize BucketRecordCorruptedException unit tests

Categorize into positive/negative test cases.

Change-Id: If2dc7634bfe8eed65265685fb2e7f9407423e252

4 years agoAdd unit tests for CancelResponse in ProtocolClient 25/238625/6
Zofia Abramowska [Wed, 15 Jul 2020 16:43:22 +0000 (18:43 +0200)]
Add unit tests for CancelResponse in ProtocolClient

Change-Id: If34ce28977fdf13e26a7d89c7a11cd9ce20a287a

4 years agoAdd unit tests for CheckResponse in ProtocolClient 24/238624/6
Zofia Abramowska [Wed, 15 Jul 2020 16:34:25 +0000 (18:34 +0200)]
Add unit tests for CheckResponse in ProtocolClient

Change-Id: Ibfb00e00db21ca10ba18c6fdcfa5b76fd64ea4f1

4 years agoAdd unit tests for MonitorEntryPutRequest in ProtocolClient 23/238623/6
Zofia Abramowska [Wed, 15 Jul 2020 16:03:31 +0000 (18:03 +0200)]
Add unit tests for MonitorEntryPutRequest in ProtocolClient

Change-Id: Idb17089a5061fb81fdd2b842c7366f2dbf6821c1

4 years agoRemove unused code 22/238622/6
Zofia Abramowska [Wed, 15 Jul 2020 15:12:28 +0000 (17:12 +0200)]
Remove unused code

Change-Id: Ifc6230cc0fdd4044a8967cf619a6e29585ca6228

4 years agoAdd tests for ProtocolSerialization 11/238411/7
Zofia Abramowska [Tue, 30 Jun 2020 15:38:37 +0000 (17:38 +0200)]
Add tests for ProtocolSerialization

Change-Id: I9afce8b2635e81c3ffaae45804c1d4b93251b314

4 years agoAdd unit tests MonitorEntriesPutRequest in ProtocolClient 10/238410/7
Zofia Abramowska [Tue, 30 Jun 2020 14:57:57 +0000 (16:57 +0200)]
Add unit tests MonitorEntriesPutRequest in ProtocolClient

Change-Id: Iab7265f104716cb3607e1b5dd10bb0d3ea53a9f6

4 years agoMove protocol serialization/deserialization to one place 81/235781/9
Zofia Abramowska [Tue, 9 Jun 2020 17:15:33 +0000 (19:15 +0200)]
Move protocol serialization/deserialization to one place

Move serialization and deserialization of common types to
ProtocolSerialization and ProtocolDeserialization respectively.
This eliminates code redundancy, reduces the possibility of
wrong order of serialization/deserialization and moves protocol
size limits checks to one place.
Currently max container size is 4096. As there is no valid case
when cynara can be passed a 4096-long container, this limit will
be applied, where it hasn't been before, except for
ProtocolMonitorGet, which utilizes different buffer size - 65535.

Change-Id: Id7469015712204b3be8a1aed255dcbfa91975be3

4 years agoEnsure that MonitorCache capacity is of permissible size 80/235780/8
Zofia Abramowska [Tue, 9 Jun 2020 13:01:44 +0000 (15:01 +0200)]
Ensure that MonitorCache capacity is of permissible size

When MonitorCache is flushed its whole content is sent to
Cynara service in one batch. Cynara service should not accept
vectors bigger than CYNARA_MAX_VECTOR_SIZE. Currently this is true,
but this commit adds a compile-time assertion for this limit,
so it won't be changed without realization of the consequences.

Change-Id: I5ae28882ea4c50a7455d2d0d3a7ff76d7ec7a38a

4 years agoAdd unit tests for SimpleCheckRequest in ProtocolClient 72/235672/10
Zofia Abramowska [Mon, 8 Jun 2020 16:55:24 +0000 (18:55 +0200)]
Add unit tests for SimpleCheckRequest in ProtocolClient

Change-Id: Ia797842b01e843f3273d3c436f6d3b38b857cf92

4 years agoAdd negative unit tests for ProtocolClient 71/235571/9
Zofia Abramowska [Fri, 5 Jun 2020 14:49:46 +0000 (16:49 +0200)]
Add negative unit tests for ProtocolClient

Add unit tests for:
* requests and responses not implemented in ProtocolClient
* requests and responses with wrong OpCode
* requests and responses with unfinished frame

Change-Id: I3334a887b6aacac4d4924285da401fec41d7b89f

4 years agoAdd unit tests for CheckRequest in ProtocolClient 57/235457/10
Zofia Abramowska [Thu, 4 Jun 2020 15:51:53 +0000 (17:51 +0200)]
Add unit tests for CheckRequest in ProtocolClient

Change-Id: I7dec5ab1ae3c78a4c01f00cfd72eb1eb9e2efd1e

4 years agoAdd unit tests for CancelRequest in ProtocolClient 56/235456/10
Zofia Abramowska [Thu, 4 Jun 2020 15:17:44 +0000 (17:17 +0200)]
Add unit tests for CancelRequest in ProtocolClient

Change-Id: I6644438151faf09eb4aacf5c53e299048c1714fc

4 years agoAdd unit tests for AgentRegisterResponse in ProtocolAgent 70/235570/9
Zofia Abramowska [Fri, 5 Jun 2020 11:25:56 +0000 (13:25 +0200)]
Add unit tests for AgentRegisterResponse in ProtocolAgent

Change-Id: Idbdef1ab3315dc4e3238e7fc57f334acdc7583e3

4 years agoAdd unit tests for AgentActionResponse in ProtocolAgent 69/235569/9
Zofia Abramowska [Fri, 5 Jun 2020 11:01:47 +0000 (13:01 +0200)]
Add unit tests for AgentActionResponse in ProtocolAgent

Change-Id: I88d7ffa5851727d0b0f7905258a40697399bfdfd

4 years agoAdd unit tests for AgentRegisterRequest in ProtocolAgent 55/235455/10
Zofia Abramowska [Thu, 4 Jun 2020 13:46:05 +0000 (15:46 +0200)]
Add unit tests for AgentRegisterRequest in ProtocolAgent

Change-Id: I66741df415ced3f8cae240b49aaf276c9097d952

4 years agoAdd unit tests for AgentActionRequest in ProtocolAgent 54/235454/10
Zofia Abramowska [Thu, 4 Jun 2020 12:18:41 +0000 (14:18 +0200)]
Add unit tests for AgentActionRequest in ProtocolAgent

Change-Id: If94172c87fa6fc6cac6f93ce17edf38e31e2c69f

4 years agoRelease 0.16.0 11/240111/4 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.114835 accepted/tizen/6.0/unified/hotfix/20201103.003504 accepted/tizen/unified/20200805.122456 submit/tizen/20200804.112206 submit/tizen_6.0/20201029.205104 submit/tizen_6.0_hotfix/20201102.192504 submit/tizen_6.0_hotfix/20201103.114804 tizen_6.0.m2_release
Zofia Abramowska [Mon, 3 Aug 2020 15:36:10 +0000 (17:36 +0200)]
Release 0.16.0

* Remove logs ifdef from spec files
* Revert "Partially remove libdlog dependency"

Change-Id: Id0e4774c9c50bdce31b161e9d9f9d010e859fdf4

4 years agoRemove logs ifdef from spec files 23/240123/2
Zofia Abramowska [Mon, 3 Aug 2020 15:34:36 +0000 (17:34 +0200)]
Remove logs ifdef from spec files

Logs backend choice became more complicated, than simple Tizen
version check. This ifdef is no longer accurate and needed.

Change-Id: Ic62497af4753bbd53253a7bf1ec13ff30575d389

4 years agoRevert "Partially remove libdlog dependency" 10/240110/2
Zofia Abramowska [Mon, 3 Aug 2020 10:46:54 +0000 (12:46 +0200)]
Revert "Partially remove libdlog dependency"

This reverts commit 426f9b677c0b6b000ad369e5086726cbdb94e3a1.

Change-Id: I55eedc3b0ea2e9a6772d452c018e3d58b905ebdc

4 years agoRelease 0.15.0 30/239930/2 submit/tizen/20200731.123052
Zofia Abramowska [Fri, 31 Jul 2020 12:21:29 +0000 (14:21 +0200)]
Release 0.15.0

* Dual license cynara under Apache 2.0 or MIT
* Partially remove libdlog dependency
* Add unit tests and redo existing ones to categorize
  them into positive/negative test cases
* Minor fixes and refactoring for new unit tests

Change-Id: Ic49ea50bf625bc222bdb8c3d4633a554c7aacd05

4 years agoDual license cynara under Apache 2.0 or MIT 48/238948/13
Krzysztof Jackiewicz [Mon, 20 Jul 2020 17:20:04 +0000 (19:20 +0200)]
Dual license cynara under Apache 2.0 or MIT

Add licenses to devel packages.

Unify the copyright and license notice formatting.

Change-Id: I0cbd7f9d2fca963737cc2a7df4f9c9bf4c29a9a6

4 years agoPartially remove libdlog dependency 26/239926/1
Krzysztof Jackiewicz [Wed, 29 Jul 2020 08:54:59 +0000 (10:54 +0200)]
Partially remove libdlog dependency

Switch to journal logging by default in all modules except cynara service.
This is to avoid libdlog dependency in client libraries.

Only cynara service may depend on libdlog and use it by providing a logging
callback to libcynara-commons.

Minor fixes and refactoring.

Change-Id: I15cf8dae915bd5863db79d27cad539cd7103ea34

4 years agoChange compare() not implemented assertion to compile time 99/237999/3
Konrad Lipinski [Tue, 7 Jul 2020 08:28:05 +0000 (10:28 +0200)]
Change compare() not implemented assertion to compile time

Change-Id: I2c79edb3cd5d962784490139a996e14638fa33fb

4 years agoAdd negative unit tests for ProtocolAgent 53/235453/9
Zofia Abramowska [Wed, 3 Jun 2020 12:48:36 +0000 (14:48 +0200)]
Add negative unit tests for ProtocolAgent

Add unit tests for:
* requests and responses not implemented in ProtocolAgent
* requests and responses with wrong OpCode
* requests and responses with unfinished frame

Change-Id: Ibb3882764fc58d307c4f9ff49d75a116512a9c35

4 years agoAdd negative unit tests for ProtocolAdmin 12/234912/11
Zofia Abramowska [Fri, 29 May 2020 15:55:52 +0000 (17:55 +0200)]
Add negative unit tests for ProtocolAdmin

Add unit tests for:
* requests and responses which are not implemented in ProtocolAdmin
* requests and responses with wrong opcode
* requests and responses with unfinished frame

Change-Id: Ifa0fa83b6caeaa32315c2abf14ef231005bfe573

4 years agoSanitize test data collection 02/235202/7
Zofia Abramowska [Tue, 2 Jun 2020 14:41:10 +0000 (16:41 +0200)]
Sanitize test data collection

* add template generation for numeric data
* remove redundant static specifier

Change-Id: I6f64988d98c633e55d027bb5c9f5bf0b8b2597a0

4 years agoAdd unit tests for CodeResponse with ProtocolAdmin 11/234911/6
Zofia Abramowska [Fri, 29 May 2020 14:23:28 +0000 (16:23 +0200)]
Add unit tests for CodeResponse with ProtocolAdmin

Change-Id: I3aad98d36969b27908cca5a1833531808b0cb6bc

4 years agoAdd SetPoliciesRequest unit tests 88/234788/5
Zofia Abramowska [Thu, 28 May 2020 16:17:05 +0000 (18:17 +0200)]
Add SetPoliciesRequest unit tests

Change-Id: Ia4c6d8c9a48650ac472adc613c1c70707e71285b

4 years agoAdd RemoveBucketRequest unit tests 87/234787/5
Zofia Abramowska [Thu, 28 May 2020 16:16:50 +0000 (18:16 +0200)]
Add RemoveBucketRequest unit tests

Change-Id: I2b0653f614d516f1b701cde904d8fc81c2a4bb7c

4 years agoAdd InsertOrUpdateBucketRequest unit tests 86/234786/5
Zofia Abramowska [Thu, 28 May 2020 16:16:27 +0000 (18:16 +0200)]
Add InsertOrUpdateBucketRequest unit tests

Change-Id: I5c5eae53ee460a12fe0215a08d1fd02434e888eb

4 years agoAdd tryCatch and exceptions messages tests 47/234647/6
Zofia Abramowska [Mon, 25 May 2020 16:29:38 +0000 (18:29 +0200)]
Add tryCatch and exceptions messages tests

Change-Id: I1d82762ca73e491821336b069570ac961e38c8a8

4 years agoAdd parameters information to exceptions messages 48/234648/5
Zofia Abramowska [Wed, 27 May 2020 15:48:17 +0000 (17:48 +0200)]
Add parameters information to exceptions messages

Fix UnknownPolicyTypeException and BucketNotExistsException

Change-Id: I3e4ef71e9050781d48d9537cf44111d1727bc37e

4 years agoLet tryCatch be used in multiple translation units 46/234346/7
Zofia Abramowska [Mon, 25 May 2020 16:45:47 +0000 (18:45 +0200)]
Let tryCatch be used in multiple translation units

Move tryCatch() implementation to separate source file.

Change-Id: Ia4614a032a022765c386144e76c58c2eec6ab6b6

4 years agoAdd safeStrError function unit tests 44/234344/8
Zofia Abramowska [Mon, 25 May 2020 14:17:41 +0000 (16:17 +0200)]
Add safeStrError function unit tests

Change-Id: I4f54c082fe854b07d63a7a89cb4f0c13b224427d

4 years agoAdd BinaryQueue unit tests 39/234239/9
Zofia Abramowska [Fri, 22 May 2020 16:07:25 +0000 (18:07 +0200)]
Add BinaryQueue unit tests

* add unit tests
* name test cases so they contain positive/negative information

Change-Id: I085c416bcc8fdd1cda1eeaed6778306f24ce5f52

4 years agoFix parameter checking in BinaryQueue 38/234238/8
Zofia Abramowska [Fri, 22 May 2020 10:13:58 +0000 (12:13 +0200)]
Fix parameter checking in BinaryQueue

* check raw pointers for nullptr
* check for empty buckets in all methods
* don't perform redundant checks in Bucket class

Change-Id: Ia5607df736460881aea5e8b1020ab6c5391b22d4

4 years agoAdd MonitorCache unit tests 99/234099/8
Zofia Abramowska [Thu, 21 May 2020 15:08:06 +0000 (17:08 +0200)]
Add MonitorCache unit tests

* add unit tests
* rename test cases to contain positive/negative information

Change-Id: I663957de5d25b646da4bab33f4f8de3f554243f1

4 years agoAdd SequenceContainer unit tests 58/233958/10
Zofia Abramowska [Wed, 20 May 2020 16:32:44 +0000 (18:32 +0200)]
Add SequenceContainer unit tests

* add new tests
* rename test cases to contain positive/negative information

Change-Id: I892fb8fa3c74075ec12d9f340c8e78443063f879