platform/core/security/cynara.git
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

9 years agoAdd InMemoryStorageBackend::hasBucket() 47/24447/2
Aleksander Zdyb [Mon, 14 Jul 2014 09:26:57 +0000 (11:26 +0200)]
Add InMemoryStorageBackend::hasBucket()

The function will be used by Cynara::Storage to check
if new bucket should be created or an old one updated.

Change-Id: I0c60724a112880010dcde7793346c1bc2fd687dc

9 years agoMove parseMetadata() and parsePolicyType() to StorageDeserializer 22/24322/3
Aleksander Zdyb [Mon, 14 Jul 2014 10:57:46 +0000 (12:57 +0200)]
Move parseMetadata() and parsePolicyType() to StorageDeserializer

These static methods better fit in a more general
Cynara::StorageDeserializer instead of Cynara::BucketDeserializer

Change-Id: I2bad160683ac34b68d993dc7b10e8ec7ba1b1d1c

9 years agoAdd serializer for InMemoryStorageBackend::Buckets 16/24316/3
Aleksander Zdyb [Mon, 14 Jul 2014 12:23:26 +0000 (14:23 +0200)]
Add serializer for InMemoryStorageBackend::Buckets

Change-Id: Ia5def8f5c8b5bb1e16c20f2adc1757849f440866

9 years agoAdd backtrace to exception message 50/24450/7
Adam Malinowski [Mon, 14 Jul 2014 12:39:55 +0000 (14:39 +0200)]
Add backtrace to exception message

This patch introduces new method 'message()' in class Exception
which must be overloaded by all dervied classes instead of
'what()' method. This is needed to add backtrace info to
exception message.

Change-Id: Ic451578c72566300283843468a32297fdec42f56

9 years agoAdd conditional logs building 36/24536/2
Adam Malinowski [Tue, 15 Jul 2014 12:16:20 +0000 (14:16 +0200)]
Add conditional logs building

This feature is needed for correct building tests when tested
units use logging mechanism. Tests should not depend on logger.

Change-Id: I110f5f0238726d1110388eaefc028c90747aa747

9 years agoAdd serialization of CheckResponse object 41/24441/3
Adam Malinowski [Mon, 14 Jul 2014 11:48:19 +0000 (13:48 +0200)]
Add serialization of CheckResponse object

Change-Id: I78c0b69dd6502e3d1067f8e75da90324ff8d61da

9 years agoAdd log messages related to protocol (de)serialization 40/24440/2
Adam Malinowski [Mon, 14 Jul 2014 10:14:39 +0000 (12:14 +0200)]
Add log messages related to protocol (de)serialization

Change-Id: I6ca994c29326f0f5bce2e668adc4f9a3185c1592

9 years agoRemove unneeded return statement in Logic::check method 36/24436/2
Adam Malinowski [Mon, 14 Jul 2014 10:04:17 +0000 (12:04 +0200)]
Remove unneeded return statement in Logic::check method

Change-Id: Idfda59a64c76fd8721b3c5dd94c9db4b5dd8ee12

9 years agoFix memory leak in demangling symbols for backtrace functionality 35/24435/2
Adam Malinowski [Mon, 14 Jul 2014 10:01:30 +0000 (12:01 +0200)]
Fix memory leak in demangling symbols for backtrace functionality

Change-Id: If4525dd6f610b6e2fcc2e64c5d6b89e0bf20d0d5

9 years agoFix client socket labeling with smack 34/24434/2
Adam Malinowski [Mon, 14 Jul 2014 09:58:35 +0000 (11:58 +0200)]
Fix client socket labeling with smack

Change-Id: Ic859959b5b95feae93159429b976037b52fc44de

9 years agoEnable logs in client library 32/24432/2
Adam Malinowski [Mon, 14 Jul 2014 09:41:58 +0000 (11:41 +0200)]
Enable logs in client library

Change-Id: I46b423ddf7482392d6859496f53a5e29fa2b82b0

9 years agoAdd declaration of struct cynara_admin in libcynara-admin header 06/24506/1
Lukasz Wojciechowski [Tue, 15 Jul 2014 12:46:22 +0000 (14:46 +0200)]
Add declaration of struct cynara_admin in libcynara-admin header

Change-Id: I8e441d67bec81ba83f5686a9d1d85c7c7f217cdf

9 years agoRemove const specifiers in cynara_admin_policy structure 04/24504/1
Lukasz Wojciechowski [Tue, 15 Jul 2014 12:20:44 +0000 (14:20 +0200)]
Remove const specifiers in cynara_admin_policy structure

With fileds defined as const, user of this structure would probably
have some problems with freeing memory.

Change-Id: I159ebc2ea772c76be70e5e58310f0ae1e8728c8f

9 years agoFix shared pointers access in Cynara class 37/24037/4
Adam Malinowski [Tue, 8 Jul 2014 06:42:40 +0000 (08:42 +0200)]
Fix shared pointers access in Cynara class

Change-Id: I85c98846655d8363e63640b88f6a756bb16c08d5

9 years agoAdd signal processing 35/24035/5
Adam Malinowski [Mon, 7 Jul 2014 13:22:02 +0000 (15:22 +0200)]
Add signal processing

For now only SIGTERM is processed to kindly stop the service.

Change-Id: If754002a8af9f8ca70323f22b06fbd22da0ddb19

9 years agoAdd cache interface and NoCache stub 15/24015/3
Lukasz Wojciechowski [Mon, 7 Jul 2014 14:09:50 +0000 (16:09 +0200)]
Add cache interface and NoCache stub

Add interface defining API for cache, that will be used to speed up
checks. Add NoCache class, that implements this interface with very
simple version, which always enforces checks on Cynara server.
Add usage of NoCache in Logic class.

Change-Id: I3b799c4c6eccddfed98e8130ef1ca4cb849b8c05

9 years agoAdd sequence number generation 14/24014/2
Lukasz Wojciechowski [Mon, 7 Jul 2014 12:59:46 +0000 (14:59 +0200)]
Add sequence number generation

Change-Id: I1fc3250d211a171bc121846d96282d8ff5b095fa

9 years agoFix comment for cynara_admin_set_policies function 90/24290/2
Marcin Niesluchowski [Wed, 9 Jul 2014 17:48:12 +0000 (19:48 +0200)]
Fix comment for cynara_admin_set_policies function

Change-Id: I02ed34465a41d1caa670617e2169d41567bd914a

9 years agoRemove semicolon from defines. 75/24275/1
Marcin Niesluchowski [Wed, 9 Jul 2014 12:58:20 +0000 (14:58 +0200)]
Remove semicolon from defines.

Change-Id: Ib18ffc5560f2b629fbd586f1e70b9bbe9e020b99

9 years agoAdd stub implementation of libcynara-admin API functions 45/23845/3
Lukasz Wojciechowski [Thu, 3 Jul 2014 16:45:54 +0000 (18:45 +0200)]
Add stub implementation of libcynara-admin API functions

Prepare Logic and ApiInterface classes skeletons.
Remove old empty admin-api.cpp file.

Change-Id: I498e0e904dbd9dea3a07eaaa998a30fce21cb4e5

9 years agoUpdate libcynara-admin API header 36/23936/1
Lukasz Wojciechowski [Fri, 4 Jul 2014 12:38:22 +0000 (14:38 +0200)]
Update libcynara-admin API header

Change const strings from const char* to defines.
Add missing struct keywords.
In function cynara_admin_set_policies() change polices parameter
to array of pointers.
In function cynara_admin_set_bucket() add extra parameter for
passing additional data to bucket's default policy.

Change-Id: Id1370a202a39636572aa6a203ae29662e423c986

9 years agoAdd response deserialization
Adam Malinowski [Thu, 3 Jul 2014 09:26:05 +0000 (11:26 +0200)]
Add response deserialization

Change-Id: Id3bb97e5cc590aa9ef3757b503d423e2c3c9a99f

9 years agoRemove usage of unwanted binutils library
Rafal Krypa [Thu, 3 Jul 2014 12:14:53 +0000 (14:14 +0200)]
Remove usage of unwanted binutils library

Change-Id: I616494d5280b87a6059149a8005911e4f7062fa3

9 years agoRemove unused PolicyVector.h file
Adam Malinowski [Wed, 2 Jul 2014 13:51:35 +0000 (15:51 +0200)]
Remove unused PolicyVector.h file

Change-Id: Ic4c43d1e1afbd1c506a47cefc8cb78c47c92170d

9 years agoAdd protocol deserialialization mechanism
Adam Malinowski [Thu, 26 Jun 2014 08:04:17 +0000 (10:04 +0200)]
Add protocol deserialialization mechanism

Change-Id: Id3b24f67a639f22cfd2995880ad3b21593318822

9 years agoAdjust client socket classes after move to common library
Lukasz Wojciechowski [Wed, 2 Jul 2014 07:49:41 +0000 (09:49 +0200)]
Adjust client socket classes after move to common library

Fix #ifndef guards, include paths and CMakeLists.

This patch should be verified together with previous one (Raw move).

Change-Id: I81640c5297c11435e2fe0e8b18c9d37ded5318a3

9 years agoRaw move of client socket classes to common library
Lukasz Wojciechowski [Wed, 2 Jul 2014 07:34:08 +0000 (09:34 +0200)]
Raw move of client socket classes to common library

This will allow usage of same classes in libcynara-admin library.

This patch does not compile.
Please verify it with following patch.

Change-Id: Ib0d2032e2e843ad9bdb34e6a087037436ff8a12f

9 years agoMake SocketClient independent of specific protocol and path
Lukasz Wojciechowski [Wed, 2 Jul 2014 07:28:35 +0000 (09:28 +0200)]
Make SocketClient independent of specific protocol and path

Add protocol and socket path to SocketClient constructor.
Pass path to client socket and ProtocolClient object to
SocketClient in libcynara-client Logic class.

Change-Id: I45e991b8309616876248289558265e5df915012d

9 years agoDefine libcynara-admin API
Lukasz Wojciechowski [Tue, 1 Jul 2014 19:28:09 +0000 (21:28 +0200)]
Define libcynara-admin API

Change-Id: I9d3708ad4a69336e893bcb683d69c3bc613e3054

9 years agoMove cynara-tests packaging to a separate directory
Rafal Krypa [Thu, 3 Jul 2014 12:14:14 +0000 (14:14 +0200)]
Move cynara-tests packaging to a separate directory

No gmock dependency in main spec file
Cynara-tests package can be build by passing "--packaging-dir packaging_tests" to gbs build

Change-Id: I786ad78bae0bceca0ae6423f7bf33981435bd189

9 years agoCleanup tests cmake file
Krzysztof Jackiewicz [Wed, 2 Jul 2014 13:18:31 +0000 (15:18 +0200)]
Cleanup tests cmake file

Requires: https://mcdsrvbld02.digital.local/review/#/c/15770/

Change-Id: I41e82319aa1ecaf647c303345fe30fb84010e568

9 years agoUse proper include paths
Krzysztof Jackiewicz [Thu, 3 Jul 2014 09:36:48 +0000 (11:36 +0200)]
Use proper include paths

Change-Id: I34973bde473c2f7cfa35b00b04168c42c238726b

9 years agoFix wildcard checks
Aleksander Zdyb [Wed, 2 Jul 2014 10:52:09 +0000 (12:52 +0200)]
Fix wildcard checks

Fixed bug, where consecutive buckets were filtered with wildcard keys
instead of original key being checked

Change-Id: I97499f41c796a0262e9f8d2a57908cc8a4fc3014

9 years agoRemove "m_fd" - unused field of RequestContext
Lukasz Wojciechowski [Mon, 30 Jun 2014 18:12:53 +0000 (20:12 +0200)]
Remove "m_fd" - unused field of RequestContext

Change-Id: I869ff96dea13b9eeac216d9af2159ebb3aaecedf

9 years agoImplement Logic::check() method using SocketClient
Lukasz Wojciechowski [Mon, 30 Jun 2014 17:59:07 +0000 (19:59 +0200)]
Implement Logic::check() method using SocketClient

Implementation always checks privilege by sending request to Cynara
service.
Features not implemented:
* No cache is used;
* Session parameter is unused;
* No plugin support is implemented.

Change-Id: Ifdfdd56cceb967a8490f383ae396c5066e8a97fd

9 years agoAdd CYNARA_API_SERVICE_NOT_AVAILABLE
Rafal Krypa [Thu, 3 Jul 2014 12:07:35 +0000 (14:07 +0200)]
Add CYNARA_API_SERVICE_NOT_AVAILABLE

This is new external API result code, which is returned, when
Cynara service is not available (a connection to service cannot be
set via UNIX socket)

Change-Id: I53c006f1795c975b1e36a1c20753f090beb603f0

9 years agoAdd SocketClient class
Lukasz Wojciechowski [Mon, 30 Jun 2014 17:51:30 +0000 (19:51 +0200)]
Add SocketClient class

SocketClient class is a class in client library that is
responsible for communication with Cynara service.
It has simple API askCynaraServer() which allows to send a request
and receive response with information about connection state.
Inside it keeps:
Socket - a client socket implementation;
Protocol - for serialization and deserialization of requests and
responses;
Queues - needed for writing and receiving data.

Change-Id: I6f54edd7a7986c60e50eb3119e431fc17da0646c

9 years agoRefactorize Cynara::BucketDeserializer
Aleksander Zdyb [Wed, 2 Jul 2014 07:31:51 +0000 (09:31 +0200)]
Refactorize Cynara::BucketDeserializer

BucketDeserializer is no longer stateless.
The class is now constructed with reference
on input stream. It's easier testable and enables
dependency injection in Cynara::StorageDeserializer.

TODO: Consider squashing with 2 prior commits.

Change-Id: If79727c7759178bd9ac82351b16f043971abd577

9 years agoAdd Cynara::StorageDeserializer
Aleksander Zdyb [Wed, 2 Jul 2014 07:29:02 +0000 (09:29 +0200)]
Add Cynara::StorageDeserializer

Change-Id: I4a981bea8b2a43641ff213cbce9cb09fa24cd2dc

9 years agoRename StorageDeserializer to BucketDeserializer
Aleksander Zdyb [Wed, 2 Jul 2014 06:55:31 +0000 (08:55 +0200)]
Rename StorageDeserializer to BucketDeserializer

The name StorageDeserializer will be taken by
more general class loading whole db.

TODO: Rename StorageSerializer

Change-Id: I66f5c34c3c47b712f104bc2013da23ef84e4bdd9

9 years agoAdd gmock package dependency and enable tests
Rafal Krypa [Thu, 3 Jul 2014 12:06:40 +0000 (14:06 +0200)]
Add gmock package dependency and enable tests

Change-Id: Idd2a1c392844248934734be3668952b392fda272

9 years agoFix buildbreaks
Krzysztof Jackiewicz [Fri, 27 Jun 2014 06:33:45 +0000 (08:33 +0200)]
Fix buildbreaks

Change-Id: I34bdc6f54e0290f5b416dcf189a6da2cb7e5f543

9 years agoPrepare client socket class for connecting cynara service
Lukasz Wojciechowski [Mon, 30 Jun 2014 07:58:18 +0000 (09:58 +0200)]
Prepare client socket class for connecting cynara service

Class is based on implementation imported from security-server
in previous commit.

Change-Id: I77643de6ec7321d3f6af0b395e1b1e4bf06b3774

9 years agoRaw copy client-common.cpp from security-server repository
Lukasz Wojciechowski [Thu, 26 Jun 2014 23:20:15 +0000 (01:20 +0200)]
Raw copy client-common.cpp from security-server repository

Source of code:
    repository: tizen.org/platform/core/security/security-server
    patch:      210758dc04b639fbc87df8c1ef6fba7e86b41875

Added file needs adaptation to Cynara. Due to many dependencies
it won't compile. That is why it is not added to CMakeLists yet.

Verification : Because of above patch doesn't need verification.

Change-Id: Ie826567c11ff827cf45043911b54b24275a0ffe7

9 years agoSwitch libcynara-client from bootstrap to cynara service version
Lukasz Wojciechowski [Thu, 26 Jun 2014 21:57:10 +0000 (23:57 +0200)]
Switch libcynara-client from bootstrap to cynara service version

Remove cynara-bootstrap implementation.
Add ApiInterface class.
Add Logic class - main class of cynara client.
Logic class implements ApiInterface.
Fix CMakeFile by removing dependencies and updating source files.

Change-Id: Ic6a9ebe9ad9c1de85620b943523e751382083bc6

9 years agoClone protocol objects
Lukasz Wojciechowski [Thu, 26 Jun 2014 20:07:09 +0000 (22:07 +0200)]
Clone protocol objects

Add clone method to Protocol class and derivatives.
Use cloned Protocol object for every new socket (created after
accept on listening socket).

Protocol derived classes handle serialization and deserialization
of Requests and Responses. Protocol objects are kept in Descriptor
objects for every open socket in form of shared pointers.  All
binary communication through a socket is translated by related
Protocol.
On the server side of Cynara Protocols are used as ResponseTakers
(they consume Responses ready to send back to clients). Pointers
to Protocols as ResponseTakers are kept in RequestContext as weak
pointers. RequestContext may be (will be in the future) saved
by Plugin in order to run some UI and return Response later.
Meanwhile a socket can be closed. In such a case weak pointer shall
lose his reference to Protocol object, which was destroyed in
Descriptor::close() method. Before returning Response to
ResponseTaker, validation of weak pointer is made in
RequestContext::cynaraResponse().

Change-Id: I5a6af197357c8ff641aa1162fd30c01bbe725786

9 years agoComplete response handling path
Lukasz Wojciechowski [Thu, 26 Jun 2014 19:12:31 +0000 (21:12 +0200)]
Complete response handling path

Add Response class - base for all response classes.
Add extractResponseFromBuffer() method to all protocol classes.
Change all response objects references to shared pointers.

Change-Id: I9ac88c8e70ca8084bc2653a0b6aa545320d8de35

9 years agoChange Cynara class model from singleton to common object
Lukasz Wojciechowski [Thu, 26 Jun 2014 12:13:37 +0000 (14:13 +0200)]
Change Cynara class model from singleton to common object

Use shared pointers for layers managers (Logic, SocketManager,
Storage). Add bind...() and unbindAll() methods in layers managers.

Change-Id: If7fe5f36933e244c48c3ab2b6699a0d9b8e4f4a7

9 years agoAdd Cynara::StorageDeserializer
Aleksander Zdyb [Thu, 26 Jun 2014 12:36:10 +0000 (14:36 +0200)]
Add Cynara::StorageDeserializer

Change-Id: I402276fc32aec5839dc5e20b323fbc639dc6ff14

9 years agoAdapt protocol, request and response classes to common
Lukasz Wojciechowski [Thu, 26 Jun 2014 11:03:12 +0000 (13:03 +0200)]
Adapt protocol, request and response classes to common

Update of includes, defines and CMakeLists.
This patch should be verified together with previous one.

Change-Id: I08e38dcba381a2514981068adbabb2e3b35088a5

9 years agoMove protocol, request and response classes to common
Lukasz Wojciechowski [Thu, 26 Jun 2014 10:42:34 +0000 (12:42 +0200)]
Move protocol, request and response classes to common

This patch won't compile. It is a raw move. Update of includes,
defines and CMakeLists will be done in next patch.
They should be verified together.

Change-Id: I667c25419ec95ea686175bcd870f0126b828e41c

9 years agoDerive Protocol from RequestTaker
Lukasz Wojciechowski [Thu, 26 Jun 2014 10:27:35 +0000 (12:27 +0200)]
Derive Protocol from RequestTaker

Protocol will play role of RequestTaker on library side of Cynara.

Change-Id: Ife92e6f634bfd9e566b6f4f3c2b331022e961de7

9 years agoAdd Cynara::BucketRecordCorruptedException
Aleksander Zdyb [Thu, 26 Jun 2014 10:32:54 +0000 (12:32 +0200)]
Add Cynara::BucketRecordCorruptedException

Change-Id: Id4b28a9c3dfbf5e4bae0c750dc8d173db44eea6e

9 years agoUse shared and weak pointers for ReponseTaker and RequestContext
Lukasz Wojciechowski [Thu, 26 Jun 2014 10:12:13 +0000 (12:12 +0200)]
Use shared and weak pointers for ReponseTaker and RequestContext

Change-Id: I711a2c97819d7a363fa1b2d1401e7156554a2e09

9 years agoMove ResponseTaker class to response directory
Lukasz Wojciechowski [Thu, 26 Jun 2014 09:03:41 +0000 (11:03 +0200)]
Move ResponseTaker class to response directory

Change-Id: I5bbe58347dbe1411eaeb88dd173c0107b4bfd636

9 years agoChange request execution path
Lukasz Wojciechowski [Wed, 25 Jun 2014 19:18:06 +0000 (21:18 +0200)]
Change request execution path

Add RequestTaker - interface for objects executing requests.
Derive Logic from RequestTaker.
Implement CheckRequest execution in Logic.
Swap const references to Request derivatives with shared pointers.
Add pointers.h file to gather all request related shared pointers.
Remove Request.cpp file (all methods inlined).
Fix SocketManager request execution.
Remove not any more needed NoResponseGeneratedException class.
Add temporary impl. of method requestTaker() to SocketManager.

Change-Id: I67526fb1f68cc90c5340572445ce63068bed03ea

9 years agoMove adding sockets to write set to SocketManager main loop
Lukasz Wojciechowski [Wed, 25 Jun 2014 18:07:18 +0000 (20:07 +0200)]
Move adding sockets to write set to SocketManager main loop

Change-Id: Id06b23612992e9c134b69e42746f2af44eb0a8ec

9 years agoAdapt ProtocolSerialization to Cynara
Adam Malinowski [Tue, 24 Jun 2014 13:51:27 +0000 (15:51 +0200)]
Adapt ProtocolSerialization to Cynara

Change-Id: I92cab43eeb1861459dcd19fe1da2e6e0862a32c5

9 years agoImport of DPL class Serialization from Security-Server
Adam Malinowski [Tue, 24 Jun 2014 13:18:39 +0000 (15:18 +0200)]
Import of DPL class Serialization from Security-Server

Change-Id: I3800e5f7bf54500a2b02e0674fa62e1ec774acea

9 years agoFix user adding & deleting during installing and uninstalling process
Adam Malinowski [Mon, 23 Jun 2014 17:03:54 +0000 (19:03 +0200)]
Fix user adding & deleting during installing and uninstalling process

Verification:
Build cynara and install it on "fresh" image which contains already
installed cynara rush edition.
Cynara service should start during installation without any warnings
nor errors.
run "systemctl status cynara.service" to check if cynara service works.

Change-Id: I1c98165230277b7ae11d5157c2abd9712067f85f

9 years agoAdd backtrace building functionality
Adam Malinowski [Mon, 23 Jun 2014 12:09:29 +0000 (14:09 +0200)]
Add backtrace building functionality

Change-Id: I3443b444d6f7a6f507e55a88c36c936274965e3e

9 years agoAdd refs to ResponseTaker and ResponseQueue to RequestContext
Lukasz Wojciechowski [Mon, 23 Jun 2014 17:38:00 +0000 (19:38 +0200)]
Add refs to ResponseTaker and ResponseQueue to RequestContext

Add mentioned references and avoid explicit calls to SocketManager.
Remove not needed methods and RequestContext.cpp file.

Change-Id: I26a4f5f0349b2b27ccc485d496c5d04b7ad792df

9 years agoUse Storage to return value for check() function in Logic layer
Lukasz Wojciechowski [Fri, 20 Jun 2014 22:39:46 +0000 (00:39 +0200)]
Use Storage to return value for check() function in Logic layer

Change-Id: I30bdb8eafffa6a5cc06c9ddac3a724412c10733b

9 years agoAdd wildcard tests for Cynara::PolicyBucket
Aleksander Zdyb [Mon, 23 Jun 2014 10:32:10 +0000 (12:32 +0200)]
Add wildcard tests for Cynara::PolicyBucket

Add some convenience functions to Cynara::PolicyKey

Change-Id: Iddd51ca16f85199e2f8993c95120dcdbc6b5d7eb

9 years agoRearrange classes for request and response processing
Lukasz Wojciechowski [Fri, 20 Jun 2014 21:45:37 +0000 (23:45 +0200)]
Rearrange classes for request and response processing

RequestContext object is the only one passed from SocketManager
to Request execute() method.
Response object is passed to Protocol through
RequestContext::returnResponse().
Response queue is managed automaticaly in RequestContext class.
Request derivatives don't need to handle queues.
ResponseTaker::appendResponseToBuffer() methods need to take
additional queue object as parameter as it is no longer
part of response object.

Change-Id: I15af84c315a55284d4dccff670537e47c60c6b70

9 years agoDefine ResponseTaker interface for binding response handling
Lukasz Wojciechowski [Fri, 20 Jun 2014 21:27:12 +0000 (23:27 +0200)]
Define ResponseTaker interface for binding response handling

ResponseTaker is base interface for Protocol class.
Its implementation of appendResponseToBuffer methods throw.
They must be overridden in proper Protocol derivatives.

Change-Id: Ia16008c52f660ebc45143b9e67a741d632c674bc

9 years agoChange Request* to RequestPtr implemented as shared_ptr<Request>
Lukasz Wojciechowski [Fri, 20 Jun 2014 17:18:19 +0000 (19:18 +0200)]
Change Request* to RequestPtr implemented as shared_ptr<Request>

Handle case when no response is generated during request execution.

Change-Id: I2ffbcd520dcb910bae7ee342ab432fae457ef437

9 years agoAdd tests for Cynara::PolicyBucket
Aleksander Zdyb [Fri, 20 Jun 2014 13:01:14 +0000 (15:01 +0200)]
Add tests for Cynara::PolicyBucket

Added some convenience methods to PolicyType and PolicyResult

Change-Id: Ibcc1200403132cd16879c6afbc859e851c2a3dac

9 years agoChange Protocol* to ProtocolPtr implemented with shared_ptr
Lukasz Wojciechowski [Fri, 20 Jun 2014 16:57:19 +0000 (18:57 +0200)]
Change Protocol* to ProtocolPtr implemented with shared_ptr

Change-Id: Ic1b6e7dd50ddf011e8700fa65fdb05560df3f32a

9 years agoUse unique_ptr for request handling
Lukasz Wojciechowski [Fri, 20 Jun 2014 12:59:53 +0000 (14:59 +0200)]
Use unique_ptr for request handling

Change-Id: Ib39099fb34e192b11d1c38c9fd89cd895e97b7da