platform/core/security/cynara.git
9 years agoAdd documentation to cynara-creds-commons.h 10/27110/4
Radoslaw Bartosiak [Thu, 4 Sep 2014 13:59:50 +0000 (15:59 +0200)]
Add documentation to cynara-creds-commons.h

Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
Change-Id: I717b1cc988c5fc6780d42774c75a4596a522c3e2

9 years agoSynchronize RPM and pkg-config versions 60/26760/6
Jacek Bukarewicz [Thu, 28 Aug 2014 12:21:47 +0000 (14:21 +0200)]
Synchronize RPM and pkg-config versions

This change also introduces CYNARA_VERSION cmake variable which will need
to be kept in sync with rpm package version.
We cannot rely on passing version from RPM spec since we want to be able
to build Cynara independently of the Tizen build system.

Change-Id: I1bdd3a603a486d386f261e8330a9635923945569
Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
9 years agoImplement cynara-creds-dbus library 88/26988/6
Aleksander Zdyb [Thu, 4 Sep 2014 13:31:31 +0000 (15:31 +0200)]
Implement cynara-creds-dbus library

Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
Signed-off-by: Aleksander Zdyb <a.zdyb@partner.samsung.com>
Change-Id: Iccf9cb0acb1016746d8af7a4ee85714e74f4664e

9 years agoAdd mockuped versions of default credential methods helpers 90/26890/6
Radoslaw Bartosiak [Sun, 31 Aug 2014 19:01:33 +0000 (21:01 +0200)]
Add mockuped versions of default credential methods helpers

Change-Id: I762a435b4a2fcf81239e7d91b454cd8c785095cb

9 years agoPrepare libcynara-creds-dbus for implementation 89/26889/6
Radoslaw Bartosiak [Wed, 3 Sep 2014 19:48:25 +0000 (21:48 +0200)]
Prepare libcynara-creds-dbus for implementation

Change-Id: Ibdecf8790b7d296e35c063c52202a4a672ad9e9a

9 years agoImplement cynara-creds-socket library 88/26888/6
Radoslaw Bartosiak [Wed, 3 Sep 2014 19:13:03 +0000 (21:13 +0200)]
Implement cynara-creds-socket library

Change-Id: Ifa27c49c3361547c75d50aa7cbf72e4bd3648201

9 years agoAdd enums for credentials acquire methods 87/26887/5
Radoslaw Bartosiak [Wed, 3 Sep 2014 19:23:56 +0000 (21:23 +0200)]
Add enums for credentials acquire methods

Change-Id: I5719a7622a78ae6d1ca86a7dcce986c69abb3e23

9 years agoAdd new error codes needed by credential helpers 86/26886/5
Radoslaw Bartosiak [Sun, 31 Aug 2014 08:22:44 +0000 (10:22 +0200)]
Add new error codes needed by credential helpers

Added codes are:
    CYNARA_API_METHOD_NOT_SUPPORTED
    CYNARA_API_UNKNOWN_ERROR

Change-Id: I604ce30b37bdfe4ecba637bcf423e6fea0b2610c

9 years agoImplement cynara-session library 81/26881/7
Radoslaw Bartosiak [Wed, 3 Sep 2014 19:13:03 +0000 (21:13 +0200)]
Implement cynara-session library

Change-Id: I929408dc59db5f4ab115567fd4839258bd086418

9 years agoAdd credential and session helper libraries 35/26035/14
Radoslaw Bartosiak [Thu, 14 Aug 2014 11:53:16 +0000 (13:53 +0200)]
Add credential and session helper libraries

This change introduces libraries with following functionalities:
a) simple session id generation
b) user_id and client_id retrieval

This patch adds libraries to build and packaging files.
There is no code yet - libraries are empty.

Change-Id: I4c5c8b75eb5ea4867ba111d936bacbcd41fc5098

9 years agoFix inclusion of libunwind when not building for debug 35/26935/3
Rafal Krypa [Mon, 1 Sep 2014 16:49:40 +0000 (18:49 +0200)]
Fix inclusion of libunwind when not building for debug

Conditional inclusion of libunwind.h didn't properly depend on definition
of BUILD_TYPE_DEBUG. But only debug build checks for libunwind dependency.

Change-Id: I2158d09ae2880e9869246d75049aa1f23b8c4bcc
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
9 years agobuild: clean up settings of compiler flags 34/26934/4
Rafal Krypa [Tue, 2 Sep 2014 08:48:12 +0000 (10:48 +0200)]
build: clean up settings of compiler flags

Compiler flags are set in main CMakeLists.txt. This part of the file looks
like a template inherited from other projects and requires some clean up:
- drop C flags, there are no C source files.
- move fortify flags to spec, they are specific to Tizen build system.
- use Cmake built-in features for detection of compiler support for C++11

Change-Id: I40cb76934334c31d7ac59328eed217e08902b187
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
9 years agobuild: drop unused definition of API_VERSION 33/26933/3
Rafal Krypa [Mon, 1 Sep 2014 16:31:04 +0000 (18:31 +0200)]
build: drop unused definition of API_VERSION

This is probably copied from some template, but never used.

Change-Id: I455bb316b65121ff9ed509884d40c0c14668efce
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
9 years agobuild: drop D_GNU_SOURCE flag, refactor symbol visibility setting 32/26932/4
Rafal Krypa [Wed, 3 Sep 2014 12:03:02 +0000 (14:03 +0200)]
build: drop D_GNU_SOURCE flag, refactor symbol visibility setting

Cynara code doesn't use GNU specific features. There is no need to define
_GNU_SOURCE.
Also set -fvisibility=hidden by default for all targets and change it only
where needed (for building common library).

Change-Id: Ie8f46522866b4f475c09b4e6e57f824defed0e5c
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
9 years agobuild: install systemd files under CMAKE_INSTALL_PREFIX 31/26931/2
Rafal Krypa [Mon, 1 Sep 2014 16:38:08 +0000 (18:38 +0200)]
build: install systemd files under CMAKE_INSTALL_PREFIX

Don't use absolute path for installation of systemd config files.

Change-Id: If796cad7a0fdcd32d8179a0de7bc0958f173e35b
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
9 years agobuild: rename ambiguous "build" directory to "pkgconfig" 30/26930/4
Rafal Krypa [Mon, 1 Sep 2014 16:34:17 +0000 (18:34 +0200)]
build: rename ambiguous "build" directory to "pkgconfig"

Directory supporting generation of package config files was named "build"
for no good reason. It was inherited from security-server code base.

Change-Id: I17bba90c9de09b2637b50d7d60b436170f3631df
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
9 years agoRemove -fPIC flag 80/26880/4
Lukasz Wojciechowski [Sun, 31 Aug 2014 01:34:13 +0000 (03:34 +0200)]
Remove -fPIC flag

Explicit definition of this flag in not needed. They are added
by default when sources are used to create SHARED librray in cmake.

Change-Id: I9027835a932b7f46941a5007ddfcce08f85fb38d

9 years agoRemove not needed %defattr from cynara.spec 79/26879/4
Lukasz Wojciechowski [Sat, 30 Aug 2014 21:33:51 +0000 (23:33 +0200)]
Remove not needed %defattr from cynara.spec

Change-Id: I96fcb30e5e9a498b69505361150e7b0ffdbebb62

9 years agoAdd missing Requires for pre, post and postun scripts in spec 78/26878/4
Lukasz Wojciechowski [Sat, 30 Aug 2014 21:22:11 +0000 (23:22 +0200)]
Add missing Requires for pre, post and postun scripts in spec

And remove unneeded calls to ldconfig in %post and %postun sections
of main package as there is no library installed there.

Change-Id: I642f9cb073d8dd9b6569d43175a45a40ef51e1bb

9 years agoMove cynara package to the floor domain 12/26912/2
Jacek Bukarewicz [Mon, 1 Sep 2014 09:03:43 +0000 (11:03 +0200)]
Move cynara package to the floor domain

This makes cynara conform to the three domain security model according
to which program files, libraries and static data associated with the system
are given the _ (floor) label.

Change-Id: I4279fbe23f37917835257191aaccaef127606788

9 years agoAdd error include in API headers 16/26916/2
Zofia Abramowska [Mon, 1 Sep 2014 10:03:21 +0000 (12:03 +0200)]
Add error include in API headers

Change-Id: Id907a8fc93585b55b1115ae43054639d1a9088fe

9 years agoCreate additional packages for commons 90/26690/3
Zofia Abramowska [Wed, 27 Aug 2014 17:02:55 +0000 (19:02 +0200)]
Create additional packages for commons

Change-Id: Idd62a30326e6f238ac885e13a8bc267fc4a8fe24

9 years agoMove Cache to client commons library 90/26590/10
Zofia Abramowska [Tue, 26 Aug 2014 11:27:31 +0000 (13:27 +0200)]
Move Cache to client commons library

Change-Id: Ia47e434063b7a1f6d079a29e0076ab0c2392832f

9 years agoAdd ClientSession type 76/26576/6
Zofia Abramowska [Tue, 26 Aug 2014 11:17:40 +0000 (13:17 +0200)]
Add ClientSession type

Change-Id: Ia62dac02a652c2f252708ed05320eb66ea5506b1

9 years agoPrepare Cache for async API 13/26513/4
Zofia Abramowska [Mon, 25 Aug 2014 14:52:33 +0000 (16:52 +0200)]
Prepare Cache for async API

Change-Id: I4f2eba2db4a0f35efaa6fa00a924e582211a1e45

9 years agoAdd additional error code CYNARA_API_CACHE_MISS 78/26578/2
Zofia Abramowska [Tue, 26 Aug 2014 12:08:18 +0000 (14:08 +0200)]
Add additional error code CYNARA_API_CACHE_MISS

Change-Id: I2f128b28b19956409f0251f725a28a0e8ace2e7d

9 years agoMove error codes to different files 77/26577/2
Zofia Abramowska [Tue, 26 Aug 2014 09:33:31 +0000 (11:33 +0200)]
Move error codes to different files

Change-Id: Ice6a05d3ef76efed19780e3ce785ff7491519a36

9 years agoRevert "Add asynchronous client api" 36/26236/2
Zofia Abramowska [Tue, 19 Aug 2014 13:09:08 +0000 (06:09 -0700)]
Revert "Add asynchronous client api"

This reverts commit ab73c19c44d7f4e6f4a25ba1243ce08af11c84c0.

Change-Id: I8e231284f65d306488aa487c7297e53f3a580c5d

9 years agoRevert "Use <stdint.h> instead of <cstdint> in async client header" 37/26237/2
Zofia Abramowska [Tue, 19 Aug 2014 13:11:55 +0000 (06:11 -0700)]
Revert "Use <stdint.h> instead of <cstdint> in async client header"

This reverts commit 1b06a8e259d044ae3f6fe0782e754f125eab4e03.

Change-Id: Ib9efb3ad1d3961da72af0d39b98dfd4b3771ca6a

9 years agoAdd performance tests for PolicyBucket 00/25900/4
Aleksander Zdyb [Mon, 18 Aug 2014 09:40:46 +0000 (11:40 +0200)]
Add performance tests for PolicyBucket

Change-Id: I3b7f88a7964552664f0a1d1b1a56916ac0726249

9 years agoAdd custom TestEventListener 99/25899/3
Aleksander Zdyb [Thu, 14 Aug 2014 05:13:23 +0000 (07:13 +0200)]
Add custom TestEventListener

This is needed to show custom properties of test cases
(like for example time elapsed in benchmarks).

Change-Id: Id54c709125c07ceb4d3b387f76047706361d05b3

9 years agoUse <stdint.h> instead of <cstdint> in async client header 96/25896/2
Jacek Bukarewicz [Tue, 12 Aug 2014 09:10:10 +0000 (11:10 +0200)]
Use <stdint.h> instead of <cstdint> in async client header

<cstdint> cannot be used since cynara-client-async.h is a C header
which can be included by C projects like dbus.

Change-Id: Ife9f75ff594457d67831b487d85f8034bd556b05
Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
9 years agoAdd asynchronous client api 16/25416/15
Marcin Niesluchowski [Thu, 31 Jul 2014 15:55:36 +0000 (17:55 +0200)]
Add asynchronous client api

Change-Id: I76f4374a96a09f53dd4154a8049c42683fb39bf7

9 years agoChange Cache to be based on std::unordered_map 05/25705/1
Zofia Abramowska [Fri, 8 Aug 2014 12:22:29 +0000 (14:22 +0200)]
Change Cache to be based on std::unordered_map

Change-Id: Iaadc74c426d9d6e7851a55b69556463b53aa31e6

9 years agoRelease version 0.2.2 04/25704/1 accepted/tizen/common/20140811.080200 submit/tizen/20140808.121920 submit/tizen_ivi/20140808.121920 submit/tizen_ivi/20140813.000000 submit/tizen_ivi/20140818.000000 submit/tizen_ivi/20140818.000001 submit/tizen_ivi/20140818.000002 submit/tizen_ivi/20140820.000000 submit/tizen_ivi/20140822.000000 submit/tizen_ivi/20140825.000000 v0.2.2
Zofia Abramowska [Fri, 8 Aug 2014 12:16:54 +0000 (14:16 +0200)]
Release version 0.2.2

Change-Id: I33c53395cb9af581dd1c1ed3ac37c36b4f874435

9 years agoMerge cynara and cynara-tests spec files 02/25302/3
Zofia Abramowska [Fri, 1 Aug 2014 13:20:52 +0000 (15:20 +0200)]
Merge cynara and cynara-tests spec files

Change-Id: I254584d5ef8a5e546be8bec4eb9e9629199306bc

9 years agoRelease version 0.2.1 41/25541/1 accepted/tizen/common/20140807.104614 accepted/tizen/ivi/20140807.192216 submit/tizen/20140807.091345 submit/tizen_ivi/20140807.091345 v0.2.1
Lukasz Wojciechowski [Wed, 6 Aug 2014 19:18:47 +0000 (21:18 +0200)]
Release version 0.2.1

Change-Id: Ibae38957b9c8e359b351ce888358e7554af1b8ee

9 years agoMove user and group creating section from %post to %pre scriptlet 30/25530/1
Adam Malinowski [Wed, 6 Aug 2014 13:12:15 +0000 (15:12 +0200)]
Move user and group creating section from %post to %pre scriptlet

This change is needed for creating cynara local state directory
with proper user and group.

Change-Id: I50d353f7fee1e352c7377a8902a237519c0a6491

9 years agoChange default virtual destructor from '= default' to '{}' 80/25380/3
Adam Malinowski [Mon, 4 Aug 2014 12:12:13 +0000 (14:12 +0200)]
Change default virtual destructor from '= default' to '{}'

'= default' seems to be problematic. Some compilers give error:
"declared virtual cannot be defaulted in the class body".

Change-Id: Iaca3a70f64e45309430bc010883a87fcdc536d1b

9 years agoAdd 'class' keyword in friend class declaration 79/25379/2
Adam Malinowski [Mon, 4 Aug 2014 12:09:56 +0000 (14:09 +0200)]
Add 'class' keyword in friend class declaration

Change-Id: I1a63573faf35313b600439678198112cd9a6dcd9

9 years agoChange member initialization 78/25378/2
Adam Malinowski [Mon, 4 Aug 2014 12:02:20 +0000 (14:02 +0200)]
Change member initialization

This change is needed by other compilers to build without error.

Change-Id: I38826a3c72fed96f948ad1b1eaf9735bd3f5b99f

9 years agoAdd missing include in InMemoryStorageBackend.cpp file 77/25377/2
Adam Malinowski [Mon, 4 Aug 2014 11:43:17 +0000 (13:43 +0200)]
Add missing include in InMemoryStorageBackend.cpp file

Change-Id: I82e40449ce7f797d656482af39749d6879298860

9 years agoFix format string concatenating in log message 76/25376/2
Adam Malinowski [Mon, 4 Aug 2014 11:39:33 +0000 (13:39 +0200)]
Fix format string concatenating in log message

Change-Id: I945ca6a4fcc80ff83415b285b761369356757e6a

9 years agoRelease version 0.2.0 87/25287/2 accepted/tizen/common/20140801.173752 accepted/tizen/ivi/20140806.162000 submit/tizen/20140801.134500 submit/tizen_ivi/20140801.134500 v0.2.0
Lukasz Wojciechowski [Fri, 1 Aug 2014 10:29:02 +0000 (12:29 +0200)]
Release version 0.2.0

Change-Id: Ied0ad56182536bbd0012bc3bf68f7ec3ea1dcc6f

9 years agoDisallow pointing to nonexistent buckets 76/25276/2
Aleksander Zdyb [Fri, 1 Aug 2014 07:45:16 +0000 (09:45 +0200)]
Disallow pointing to nonexistent buckets

Storage::insertPolicies() now cares, if bucket pointed
by inserted policies exists.

Change-Id: I113de2ead6ae17d18eb9a5928ef0181bee2f67d3

9 years agoHandle SIGPIPE more elegant way 43/25243/5
Lukasz Wojciechowski [Thu, 31 Jul 2014 16:13:37 +0000 (18:13 +0200)]
Handle SIGPIPE more elegant way

Remove SIGPIPE ignoring in libraries. Use send with MSG_NOSIGNAL
instead of write in libraries Socket classes.

Change-Id: I2876d0ae80a21c7e2e3314f718c974cb7a1d389f

9 years agoCheck if connection to cynara is valid 42/25242/5
Lukasz Wojciechowski [Thu, 31 Jul 2014 15:35:49 +0000 (17:35 +0200)]
Check if connection to cynara is valid

Change-Id: I1a406ce6aa092cc75f452493ec22996e675a57ea

9 years agoDisconnect all clients from cynara when policy rules change 41/25241/2
Lukasz Wojciechowski [Thu, 31 Jul 2014 14:36:13 +0000 (16:36 +0200)]
Disconnect all clients from cynara when policy rules change

All actions that should be run when cynara policies change
are grouped in onPoliciesChanged() function.

Change-Id: I30687fc35258b448fcccc2d54955b57d8cbc82af

9 years agoAdd disconnectAllClients() function in SocketManager 40/25240/2
Lukasz Wojciechowski [Thu, 31 Jul 2014 14:33:17 +0000 (16:33 +0200)]
Add disconnectAllClients() function in SocketManager

Function disconnects all clients connected to client interface socket.
Boolean field m_client and accessor methods are added to Descriptor
class to distinguish client connections from other.

Change-Id: Ic3cc382fa3056153e25df05ed8c0eba2872adf7f

9 years agoChange enum to defines in libcynara-client 33/25233/2
Lukasz Wojciechowski [Thu, 31 Jul 2014 13:12:14 +0000 (15:12 +0200)]
Change enum to defines in libcynara-client

This change makes client API functions compatible with return type.

Change-Id: I3973b66e27060dbc4c9374840de5182bde314121

9 years agoChange cache interface and add simple implementations 27/24727/7
Zofia Abramowska [Thu, 17 Jul 2014 12:38:56 +0000 (14:38 +0200)]
Change cache interface and add simple implementations

Change CacheInterface so it supports different plugins
Implement naive plugin
Implement class responsible for getting values from server

Change-Id: I8ca21a65ec9b9dfcbc922270d2b1351797bbd92d

9 years agoRemove dependency to security-server 71/25171/3
Lukasz Wojciechowski [Wed, 30 Jul 2014 15:39:10 +0000 (17:39 +0200)]
Remove dependency to security-server

Dependencies are relict of first cynara version that used
security-server for checking privileges in libprivilege-control
database.

Change-Id: Iaa61370e048a824e4a5b09975f2349f0f915c847

9 years agoFix build break on DEBUG dbuild type 69/25169/6
Aleksander Zdyb [Thu, 31 Jul 2014 14:49:12 +0000 (16:49 +0200)]
Fix build break on DEBUG dbuild type

Build was breaking during compilation with DEBUG option.
snprintf was dropped and ostringstream is now used.
Thanks to that we do no need to cast unw_word_t to void* during printing.

To verify this check build with '--define "build_type DEBUG"' flag
without and with this commit.

Change-Id: I92f7b85873df2ea25c050f5b4949a6c6562535f7
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
9 years agoImplement a better data structure to store policies 21/25221/4
Aleksander Zdyb [Thu, 31 Jul 2014 13:01:13 +0000 (15:01 +0200)]
Implement a better data structure to store policies

A new map-based structure was used to store policies
in Cynara::PolicyBucket. This allows policy checks
to be much faster.

PolicyBucket interface was changed, so the operation
required a lot of refactorings across many storage classes.
Most of functions are now simpler, clearer and decoupled
from each other. Tests has been adjusted. No public API changes
were required.

Change-Id: Ida9dc8eb31120b27cf9547e56840dd27390de247

9 years agoAdd Cynara::PolicyKeyHelpers 20/25220/4
Aleksander Zdyb [Thu, 31 Jul 2014 12:35:39 +0000 (14:35 +0200)]
Add Cynara::PolicyKeyHelpers

PolicyKeyHelpers is an utility class holding
helper functions to manage policy keys.

Change-Id: I2f9195d62fc22809989890b0914f385b1c05d0b6

9 years agoMake protocol() method const in Descriptor class 58/25058/2
Adam Malinowski [Mon, 28 Jul 2014 09:24:21 +0000 (11:24 +0200)]
Make protocol() method const in Descriptor class

Change-Id: Ic4d14c09af552c9a675f1f2f7fe6c696277b7010

9 years agoMake few methods static in Cynara and SocketManager classes 56/25056/2
Adam Malinowski [Mon, 28 Jul 2014 09:00:14 +0000 (11:00 +0200)]
Make few methods static in Cynara and SocketManager classes

This change is due to cppcheck report.

Change-Id: Ib163bc4294d4afdf3742564a7fd0d4bf7a81304f

9 years agoRemove unused bucket visitor mechanism from BinaryQueue class 53/25053/2
Adam Malinowski [Mon, 28 Jul 2014 08:31:17 +0000 (10:31 +0200)]
Remove unused bucket visitor mechanism from BinaryQueue class

Change-Id: I0601ad50a6bb3ab9e1eba6323ba74faa1f07f51f

9 years agoAdd SIGPIPE ignoring in client and admin libraries 05/24805/5
Adam Malinowski [Tue, 22 Jul 2014 09:11:02 +0000 (11:11 +0200)]
Add SIGPIPE ignoring in client and admin libraries

Change-Id: I485dee789cc3916256affea310b7bd288200eec6

9 years agoEnable logs in admin library 04/24804/3
Adam Malinowski [Tue, 22 Jul 2014 09:27:30 +0000 (11:27 +0200)]
Enable logs in admin library

Change-Id: Ib54497540ce9bb61e98e9cb50317bc71ccbb8ffa

9 years agoFix Cynara::PolicyBucket tests 05/25005/3
Aleksander Zdyb [Fri, 25 Jul 2014 08:25:56 +0000 (10:25 +0200)]
Fix Cynara::PolicyBucket tests

Wildcards test has been inverted -- now wildcard policies are stored
in buckets and checks are made only against concrete keys.

Change-Id: I8b1a02a6648961403829564bf81d57dd42e1036d

9 years agoAdjust tests for new storage and serialization API 52/24852/5
Aleksander Zdyb [Fri, 25 Jul 2014 09:00:53 +0000 (11:00 +0200)]
Adjust tests for new storage and serialization API

Tests need to be adjusted because of changes in
Storage::insertPolicies() and Storage::deletePolicies().
They also make use of pointers on I/O streams instead of references
(in serializers and deserializers).

Change-Id: Ief7e256f0848097caa66365ffd063289c50ec26c

9 years agoMake (de)serializer classes more generic and easier testable 51/24851/3
Aleksander Zdyb [Wed, 23 Jul 2014 06:10:59 +0000 (08:10 +0200)]
Make (de)serializer classes more generic and easier testable

StorageSerializer and StorageDeserializer now accept std::ostream
and std::istream respectively, to enable unit testing.
Storage::insertPolicies() body has been slightly rearranged
to be more readable.

Change-Id: I54296a679a5d1b736ae4f3829f718b6bf8aea66e

9 years agoFix dumping PolicyKey in StorageSerializer 40/24840/4
Aleksander Zdyb [Thu, 24 Jul 2014 10:00:24 +0000 (12:00 +0200)]
Fix dumping PolicyKey in StorageSerializer

StorageSerializer no longer uses PolicyKey::toString(),
which was meant only for logging purposes.

Change-Id: I14214319ce7d2c3a7c79b60a44bb56ae79c2dad4

9 years agoReduce scope of variables 12/25012/2 accepted/tizen/common/20140725.183156 submit/tizen_common/20140725.164024 submit/tizen_common/20140725.165841
Adam Malinowski [Fri, 25 Jul 2014 09:48:43 +0000 (11:48 +0200)]
Reduce scope of variables

Change-Id: Ib18cde12f9508cb17469bcef0bb38a6665d6297d

9 years agoCorrect snprintf format string in Backtrace::buildBacktrace() method 11/25011/3
Adam Malinowski [Fri, 25 Jul 2014 09:31:28 +0000 (11:31 +0200)]
Correct snprintf format string in Backtrace::buildBacktrace() method

Additionally use static_cast and reduce scope of local variable.

Change-Id: Idbaf8f6622ae8bf4e2610e378c6a001ea3a0acbf

9 years agoRemove unneeded return statement 10/25010/2
Adam Malinowski [Fri, 25 Jul 2014 09:17:36 +0000 (11:17 +0200)]
Remove unneeded return statement

Change-Id: Ib500dd5249cbe37adbab441bb6700fb8554e3c18

9 years agoFix implementation of what() method in Exception class 24/25024/2
Adam Malinowski [Fri, 25 Jul 2014 12:56:46 +0000 (14:56 +0200)]
Fix implementation of what() method in Exception class

Change-Id: Ib0259dbd85bc5526b474396ac82b819f0b03b54d

9 years agoCorrect exception catching 07/25007/2
Adam Malinowski [Fri, 25 Jul 2014 09:01:14 +0000 (11:01 +0200)]
Correct exception catching

Exception should be caught by reference.

Change-Id: I19e906aa892956b783f174f6d40c63b4320cda93

9 years agoFix parameter checking when setting bucket-pointing policy 95/24795/4
Lukasz Wojciechowski [Tue, 22 Jul 2014 06:48:55 +0000 (08:48 +0200)]
Fix parameter checking when setting bucket-pointing policy

Field result_extra in cynara_admin_policy structure should contain
another bucket's name in case of insertion or update of a policy
pointing to another bucket.

There was no check for that. In case a nullptr was passed, it was
converted to an empty string "".

Now cynara_admin_set_policies
returns CYNARA_ADMIN_API_INVALID_PARAM when
result is set to CYNARA_ADMIN_BUCKET and
result_extra is nullptr.

Change-Id: I24ff5ab662e88b7bc538368385e13d78f48f9e9a

9 years agoAdd 'default-ac-domains' package dependency in spec file 02/24802/2
Adam Malinowski [Tue, 22 Jul 2014 08:52:36 +0000 (10:52 +0200)]
Add 'default-ac-domains' package dependency in spec file

This dependency is needed for using System domain for cynara service.

Change-Id: Ib0c21e3375309f25c893289fd1271b84798fdb85

9 years agoRelease version 0.1.0 79/24779/3 accepted/tizen/common/20140722.142604 submit/tizen/20140721.164430 v0.1.0
Adam Malinowski [Mon, 21 Jul 2014 16:25:49 +0000 (18:25 +0200)]
Release version 0.1.0

Change-Id: I5b4cc3fe87e4ea0af46e7a73a58e9b20b760f8d6

9 years agoFix cynara service and local state directory labeling with smack 78/24778/2
Adam Malinowski [Mon, 21 Jul 2014 16:23:50 +0000 (18:23 +0200)]
Fix cynara service and local state directory labeling with smack

Change-Id: I08c3fdbc118d566a3e9fb4b4b340ba3c2323d71a

9 years agoFix bug - change reference to object in CheckResponse 77/24777/1
Lukasz Wojciechowski [Mon, 21 Jul 2014 15:54:03 +0000 (17:54 +0200)]
Fix bug - change reference to object in CheckResponse

Change-Id: I1a7754669db74e747c069be70d5593b478e9b28d

9 years agoFix problem with passing references to local objects 75/24775/1
Lukasz Wojciechowski [Mon, 21 Jul 2014 14:38:26 +0000 (16:38 +0200)]
Fix problem with passing references to local objects

References are changed to shared pointers.

Change-Id: I8bdd52e1ba04ce6625cf42810c68d19cdf006ecd

9 years agoFix badly inceremented pointers 67/24767/1
Lukasz Wojciechowski [Mon, 21 Jul 2014 12:26:23 +0000 (14:26 +0200)]
Fix badly inceremented pointers

Change-Id: I40790d15f973a6e7bfacefb39b307b2a7bd77510

9 years agoUse save() from Storage to save changes to database 65/24765/2
Lukasz Wojciechowski [Mon, 21 Jul 2014 11:57:31 +0000 (13:57 +0200)]
Use save() from Storage to save changes to database

Save is needed after operations that change state of database:
* setting policies;
* updating or inserting a bucket;
* removing bucket.

Change-Id: If1eea5cbbc0b8144d3ce9786fa4cbe8c858b9893

9 years agoAdd admin protocol (de)serialization 22/24722/5
Adam Malinowski [Fri, 18 Jul 2014 15:28:25 +0000 (17:28 +0200)]
Add admin protocol (de)serialization

Change-Id: I59f279c45125ea049d762201f779ecadada136b4

9 years agoImplement Storage::save() using StorageSerializer and clean up 30/24730/2
Lukasz Wojciechowski [Fri, 18 Jul 2014 19:34:49 +0000 (21:34 +0200)]
Implement Storage::save() using StorageSerializer and clean up

There was a lot of mess in #includes directives and forward
declarations of classes. It was cleaned out.
InMemoryStorageBackend::Buckets were moved to separate file
in order not to make a cyclic dependency.

New exception class CannotCreateFile was added.

Change-Id: I32b234ba0f4872791a9f931690c58e623de7096f

9 years agoFix usage of local state directory in Cynara service 29/24729/2
Lukasz Wojciechowski [Fri, 18 Jul 2014 19:58:32 +0000 (21:58 +0200)]
Fix usage of local state directory in Cynara service

Change-Id: I66f60b919edf7f36a1de3d21db81bef5b9245485

9 years agoCreate local state directory for cynara service 21/24721/2
Adam Malinowski [Fri, 18 Jul 2014 16:22:05 +0000 (18:22 +0200)]
Create local state directory for cynara service

Change-Id: I5b5ca2323916fe9a8763949ba17051d46e59a16f

9 years agoAdd loading database in Cynara::init 37/24637/5
Aleksander Zdyb [Thu, 17 Jul 2014 12:29:53 +0000 (14:29 +0200)]
Add loading database in Cynara::init

Change-Id: Ie0d0774e4bc539ee4a33d87fb57afe33a5045952

9 years agoAdd serialization IO exception 75/24575/6
Aleksander Zdyb [Wed, 16 Jul 2014 14:09:05 +0000 (16:09 +0200)]
Add serialization IO exception

BucketSerializationException is thrown, when
bucket file stream could not be opened.

Change-Id: If8d3ca06f708fbe4a67c82e43c967d56be30e8af

9 years agoUpdate tests and remove unused Storage methods 57/24657/3
Lukasz Wojciechowski [Thu, 17 Jul 2014 15:57:52 +0000 (17:57 +0200)]
Update tests and remove unused Storage methods

Change-Id: I00456f5a087014d9e176ab1dd5bee86aa92c374b

9 years agoRemove unused enum Result 95/24695/2
Lukasz Wojciechowski [Fri, 18 Jul 2014 07:55:40 +0000 (09:55 +0200)]
Remove unused enum Result

Change-Id: Id2db61e45c17ae9ecb196a792568e130498754d4

9 years agoRemove unused class BucketAlreadyExistsException 94/24694/2
Lukasz Wojciechowski [Fri, 18 Jul 2014 07:50:25 +0000 (09:50 +0200)]
Remove unused class BucketAlreadyExistsException

Change-Id: I382d02081925d3eda9424e869e26ff0b921cba48

9 years agoImplement sending administration requests to Cynara service 70/24670/4
Lukasz Wojciechowski [Thu, 17 Jul 2014 19:38:55 +0000 (21:38 +0200)]
Implement sending administration requests to Cynara service

Implemented requests are:
 * InsertOrUpdateBucketRequest;
 * RemoveBucketRequest;
 * SetPoliciesRequest.
All three requests have same response type (CodeResponse)
so they are handled in common function.

Change-Id: I84f7ad9375279d90db977d8a5d96ae38e29c3e5b

9 years agoAdd new libcynara-admin return codes and missing comments 69/24669/4
Lukasz Wojciechowski [Thu, 17 Jul 2014 19:37:29 +0000 (21:37 +0200)]
Add new libcynara-admin return codes and missing comments

Change-Id: I7dd2bd16d82d9d4d6e19f4c980287034d6c94bea

9 years agoImplement administrating request in Cynara service Logic class 68/24668/3
Lukasz Wojciechowski [Thu, 17 Jul 2014 18:09:37 +0000 (20:09 +0200)]
Implement administrating request in Cynara service Logic class

Change-Id: Ia4b1fe57ae2dc5a74565bf6f020cd14e72da19e8

9 years agoAdd CodeResponse class - a simple response with just a status 67/24667/2
Lukasz Wojciechowski [Thu, 17 Jul 2014 18:07:16 +0000 (20:07 +0200)]
Add CodeResponse class - a simple response with just a status

This class shall be used as an answer for administrative requests:
* InsertOrUpdateBucketRequest;
* RemoveBucketRequest;
* SetPoliciesRequest.

Change-Id: I764ff5947a728504227114a1c5297df184a0c4bc

9 years agoFix missing includes 66/24666/2
Lukasz Wojciechowski [Thu, 17 Jul 2014 17:56:55 +0000 (19:56 +0200)]
Fix missing includes

Change-Id: Id10efb9dc37c1b0567ce2e7e3f4e641b2a6ac4c3

9 years agoCatch and throw more detailed exception, when bucket not found 59/24659/2
Lukasz Wojciechowski [Thu, 17 Jul 2014 16:44:28 +0000 (18:44 +0200)]
Catch and throw more detailed exception, when bucket not found

There was an uncaught out_of_range exception, that can be thrown
by unordered_map::at() method. It will be better to use a more
detailed exception here. It will also fit into design of other
methods from InMemoryStorageBackend.

Change-Id: Ib70f10c79358b08f3b2a792143a1498050cc677a

9 years agoChange collection types passed to Storage for changing policies 56/24656/2
Lukasz Wojciechowski [Thu, 17 Jul 2014 15:52:13 +0000 (17:52 +0200)]
Change collection types passed to Storage for changing policies

Old methods shall be removed in another commit, after unit test
are updated.

Change-Id: Id8a7a48859b743f897a651ebff2156846d8f0e58

9 years agoAdd 3 new Request classes for administrating Cynara 41/24641/3
Lukasz Wojciechowski [Thu, 17 Jul 2014 13:36:05 +0000 (15:36 +0200)]
Add 3 new Request classes for administrating Cynara

Three added classes are:
InsertOrUpdateBucketRequest - for inserting new bucket or modyfying
    default policy of existing one;
RemoveBucketRequest - for removing bucket;
SetPoliciesRequest - for modification of policies (adding, updating,
    removing).

RequestTaker class has been extended with new execute() methods for
processing newly added Request objects.
Proper shared pointers definitions were added in request/pointers.h
for supporting new Request types.

Change-Id: I0a94eb9ce8326da4ccb9bd078d3a90b6bef25bfa

9 years agoAdd deserialization IO exception 74/24574/5
Aleksander Zdyb [Thu, 17 Jul 2014 06:55:45 +0000 (08:55 +0200)]
Add deserialization IO exception

BucketDeserializationException is thrown, when
bucket file stream could not be opened.

Change-Id: I0930793564beb73cfea937d43155e6953d42a6a1

9 years agoAdd ApiInterface for libcynara-admin 32/24632/1
Lukasz Wojciechowski [Thu, 17 Jul 2014 11:28:08 +0000 (13:28 +0200)]
Add ApiInterface for libcynara-admin

Implement ApiInterface in Logic class with stub functions.
Interpret CAPI parameters and use ApiInterface in admin-api.cpp.

Change-Id: I2fb617e23fe00a7183281e666388c4153c3d00f0

9 years agoCorrect misspell in coment 31/24631/1
Lukasz Wojciechowski [Thu, 17 Jul 2014 09:29:46 +0000 (11:29 +0200)]
Correct misspell in coment

Change-Id: Icbe463a8242a79baafb19174d11c8169c710e659

9 years agoUse proper printf length modifier for sizeof() 71/24571/1
Rafal Krypa [Wed, 9 Jul 2014 14:24:10 +0000 (16:24 +0200)]
Use proper printf length modifier for sizeof()

Printing sizeof value needs %zu, not %u.

Change-Id: I0d1cf2b9bfb8956e4377eccf70f24f6bfbe5bc4d

9 years agoImplement Storage::addOrUpdateBucket() 49/24449/2
Aleksander Zdyb [Fri, 11 Jul 2014 08:58:35 +0000 (10:58 +0200)]
Implement Storage::addOrUpdateBucket()

createBucket() has been is renamed to addOrUpdateBucket()
in Cynara::Storage. The function will now create new bucket or,
if it existed, only update its default policy.

Test asserting addition of default bucket has been removed,
because the common function Storage::addOrUpdateBucket()
will just update default policy in such case.

Change-Id: I2099f9306873d192cbbbcd34ac9769ca663bdbe3

9 years agoAdd InMemoryStorageBackend::updateBucket() 48/24448/2
Aleksander Zdyb [Mon, 14 Jul 2014 09:22:32 +0000 (11:22 +0200)]
Add InMemoryStorageBackend::updateBucket()

The function will be used by Cynara::Storage to update bucket's
default policy without altering its policies.

Change-Id: I777c930eedc9c63d8ce1f4a29b144eeee205f145