platform/core/security/cynara.git
9 years agoRemoval of unnecesary shared_ptr in requests/responses 16/36516/5
Zofia Abramowska [Thu, 5 Mar 2015 14:06:40 +0000 (15:06 +0100)]
Removal of unnecesary shared_ptr in requests/responses

Change arguments from shared_ptr to references for Request*,
Response* class methods where no shared ownership takes place.

Change-Id: I46d04d24d95df1f5b1844284e5a218d2946935fb

9 years agoRelease 0.6.1 99/36799/2 accepted/tizen_3.0.2015.q1_common tizen_3.0.2015.q1_common accepted/tizen/3.0.2015.q1/common/20150323.084225 accepted/tizen/common/20150316.093407 accepted/tizen/mobile/20150317.060226 accepted/tizen/tv/20150316.104251 accepted/tizen/wearable/20150317.060120 submit/tizen/20150313.162032 submit/tizen_3.0.2015.q1_common/20150320.000000 v0.6.1
Lukasz Wojciechowski [Fri, 13 Mar 2015 14:26:12 +0000 (15:26 +0100)]
Release 0.6.1

Change-Id: Ib59402d97908d7799599031b1923e74fd875383f

9 years agoRelabel database files when offline admin API modifies database 00/36800/3
Jacek Bukarewicz [Wed, 11 Mar 2015 17:02:33 +0000 (18:02 +0100)]
Relabel database files when offline admin API modifies database

Change-Id: I5226adcbc969114773bb40c129ecf11b270418e5

9 years agoQuick fix remove PathConfig dependency in chsgen 02/36802/1
Lukasz Wojciechowski [Fri, 13 Mar 2015 16:01:24 +0000 (17:01 +0100)]
Quick fix remove PathConfig dependency in chsgen

Change-Id: I35d4336dd317e724b787fb7206b13089e50a490e

9 years agoQuick fix of database migration 98/36798/1
Lukasz Wojciechowski [Fri, 13 Mar 2015 14:12:05 +0000 (15:12 +0100)]
Quick fix of database migration

During upgrade of downgrade of cynara package "from version"
is always set to 0.0.0 and is ignored in migration tool.

Migration tool always tries to do generate or remove checksum files
whichever is needed due to NEW_VERSION. OLD_VERSION is ignored
during database migration.

Change-Id: I1141c7c6f15f3a11bd740330995a5bf1bae45db0

9 years agoAdd missing packages dependencies 97/36797/1
Lukasz Wojciechowski [Fri, 13 Mar 2015 13:48:04 +0000 (14:48 +0100)]
Add missing packages dependencies

Change-Id: I1b826c6b430b39bf8883c2d04e04e2cf6330b24a

9 years agoLog chsgen errors to stderr instead of journal 96/36796/1
Lukasz Wojciechowski [Fri, 13 Mar 2015 13:33:16 +0000 (14:33 +0100)]
Log chsgen errors to stderr instead of journal

This patch allows not to use libcynara-commons in chsgen
anymore.

Change-Id: I051b9a300c19c2f99228573d6e30ea8a1af2f323

9 years agoAdd missing dependency on findutils 92/36792/1
Lukasz Wojciechowski [Fri, 13 Mar 2015 12:53:57 +0000 (13:53 +0100)]
Add missing dependency on findutils

Migration tool uses "find" command but did not require findutils package.
This patch adds proper dependency.

Change-Id: Ie91ef7019c25557349748df9e719aa932f469a02

9 years agoAdd test checking migration dependency on cynara libs 91/36791/1
Lukasz Wojciechowski [Fri, 13 Mar 2015 12:47:56 +0000 (13:47 +0100)]
Add test checking migration dependency on cynara libs

Verify if cynara-db-chsgen depends on libcynara* libraries

Change-Id: I56c02c0c97d079fb0f0eb064ca0c7fd4053caba6

9 years agoRelease 0.6.0 34/36534/1 accepted/tizen/common/20150310.163254 accepted/tizen/common/20150310.163907 accepted/tizen/mobile/20150310.231452 accepted/tizen/tv/20150310.225716 accepted/tizen/wearable/20150310.230910 submit/tizen/20150310.111147 submit/tizen_mobile/20150310.111147 submit/tizen_tv/20150310.111147 submit/tizen_wereable/20150310.111147 v0.6.0
Lukasz Wojciechowski [Mon, 9 Mar 2015 15:54:27 +0000 (16:54 +0100)]
Release 0.6.0

Change-Id: Ia5c5029289dec6653262885b5095221abc63b2d5

9 years agoFix bug in receiving requests in libcynara-agent 17/36217/3
Lukasz Wojciechowski [Tue, 3 Mar 2015 13:26:11 +0000 (14:26 +0100)]
Fix bug in receiving requests in libcynara-agent

Method AgentSocketClient::receiveResponseFromServer should hang
until it can return a request received from cynara service.

However a single read from socket can read more than one request.
Received requests are queued.

Code did not check if there is a valid request read and queued
previously, but always tried to read from socket.

Fix changes order - so now code first checks queue and only in case,
when there is no valid request waiting a socket is read.

Change-Id: I845cd677700e516f252a8958b97ee8facb82170f

9 years agoAdd implementation of simple asynch check 55/35955/3
Zofia Abramowska [Wed, 25 Feb 2015 17:38:10 +0000 (18:38 +0100)]
Add implementation of simple asynch check

Add implementation in api and logic layers.
Protocol layer is shared with synchronous client.

Change-Id: Ic8ade619756cb7e0893e3da25a5452e1bf3b0994

9 years agoAdd description of simple check request in asynch API 09/35809/4
Zofia Abramowska [Tue, 24 Feb 2015 19:29:29 +0000 (20:29 +0100)]
Add description of simple check request in asynch API

Change-Id: I63e3da83cb2cc8284b3c56ce52f88a85b6feac90

9 years agoLink cynara-creds-commons with cynara-common 03/36103/3
Aleksander Zdyb [Mon, 2 Mar 2015 11:30:03 +0000 (12:30 +0100)]
Link cynara-creds-commons with cynara-common

This is needed because cynara-creds-commons use logging.

Change-Id: If9575313081b9a252d5f711f11f396cdd8eeebd3

9 years agoAdd tests utilizing short command-line options 19/33819/5
Aleksander Zdyb [Thu, 15 Jan 2015 10:27:42 +0000 (11:27 +0100)]
Add tests utilizing short command-line options

The tests are automagically generated from their
longer sisters' bodies.

Change-Id: I1e50314ddee74aaaba42dc29a04c26f237128996

9 years agoHandle database corruption 43/34943/6
Pawel Wieczorek [Tue, 3 Mar 2015 11:36:13 +0000 (12:36 +0100)]
Handle database corruption

Loading database from storage is now moved to logic layer.
InMemoryStorageBackend throws DatabaseCorruptedException to trigger
corrupted state toggle when database corruption is detected.

Tests which involved database to enter corrupted state were updated.

Change-Id: I0df8c38322b4478abb8c6d18c0805f97cfa45161

9 years agoHandle information about database corruption 22/36222/4
Pawel Wieczorek [Tue, 3 Mar 2015 11:35:48 +0000 (12:35 +0100)]
Handle information about database corruption

DatabaseCorruptedException will be thrown to inform about database
corruption. This may be handled directly (OfflineLogic) or through
responses returned from service logic (OnlineLogic).

In both cases proper error code should be returned:
CYNARA_API_DATABASE_CORRUPTED (introduced in this patch).

Change-Id: Idbafcf241c6689dadd3c5a7f25adc4629ea7cffd

9 years agoPrepare service for database corruption handling 21/36221/5
Pawel Wieczorek [Wed, 4 Feb 2015 14:05:30 +0000 (15:05 +0100)]
Prepare service for database corruption handling

When database corruption is detected, no administrative actions are
allowed and all responses to check requests are DENY. Administrative API
has to be informed about detected corruption. This patch modifies
protocol so that this information is passed.

Unit tests are also adjusted to the protocol changes this patch
introduces.

Change-Id: If3ab5d6ca1671167890956b986a4768cc828f3f5

9 years agoAdjust InMemoryStorageBackend to ChecksumStream 57/33857/29
Pawel Wieczorek [Thu, 15 Jan 2015 09:53:18 +0000 (10:53 +0100)]
Adjust InMemoryStorageBackend to ChecksumStream

Now InMemoryStorageBackend uses ChecksumStream instead of std::ofstream.
New member function dumpDatabase() was introduced in order to destruct
database index stream before calling integrity mechanism.

Change-Id: I5ea943e1ec21f02cea97699993ddbd0f3eeb0a62

9 years agoAdjust InMemoryStorageBackend to ChecksumValidator 77/32777/28
Pawel Wieczorek [Tue, 23 Dec 2014 16:18:16 +0000 (17:18 +0100)]
Adjust InMemoryStorageBackend to ChecksumValidator

InMemoryStorageBackend uses ChecksumValidator as a checksum loader and
comparator. This patch also includes files needed by storage unit tests
to work properly.

Change-Id: I541975351275bd6a30e7cf627697c9657161312f

9 years agoIntroduce ChecksumStream 12/33812/27
Pawel Wieczorek [Thu, 15 Jan 2015 07:19:15 +0000 (08:19 +0100)]
Introduce ChecksumStream

ChecksumStream will replace std::ofstream for saving database contents
in storage. This way data will be not only written to the files, but
also its checksums will be computed and stored in given stream (database
index equivalent for storing checksums).

Checksum computing is performed during stream destruction in order to be
sure that all necessary data was already collected.

Change-Id: I4a9ff2e29361f337cacd790d77364feca854a706

9 years agoMake StorageSerializer a template class 19/33519/28
Pawel Wieczorek [Mon, 12 Jan 2015 14:01:54 +0000 (15:01 +0100)]
Make StorageSerializer a template class

This patch modifies StorageSerializer so that it will be able to use
other streams than std::ostream and its derivatives. Within current
class hierarchy custom output streams with overloaded insertion operator
(operator<<) cannot be used, as it is non-virtual in std::ostream.

Change-Id: I3e713329c55aacfbb8daa23a5c4579d4c5db9f52

9 years agoAdd tests for ChecksumValidator 27/34527/20
Pawel Wieczorek [Tue, 27 Jan 2015 10:47:19 +0000 (11:47 +0100)]
Add tests for ChecksumValidator

Add tests checking if ChecksumValidator properly:
* generates checksums,
* loads them or rejects corrupted records,
* supports backup files.

Change-Id: I2e4222283cc0676490134819561824df6661034f

9 years agoIntroduce ChecksumValidator 76/32776/26
Pawel Wieczorek [Tue, 23 Dec 2014 13:53:59 +0000 (14:53 +0100)]
Introduce ChecksumValidator

ChecksumValidator computes checksums for every file listed in checksum
index equivalent using crypt(3). As a result, base64-like (custom
alphabet) encoded strings are produced and compared with last known
corresponding digest. Its 4-character prefix indicates used algorithm.
Class will be later used as an integrity mechanism extension.

Change-Id: Ibaba636bae30c747e8eac5561e9b130d4398518e

9 years agoFix basename() usage in ChecksumGenerator 33/36033/5
Pawel Wieczorek [Thu, 26 Feb 2015 13:39:39 +0000 (14:39 +0100)]
Fix basename() usage in ChecksumGenerator

Contents of a string passed to basename() as an argument may be modified
(it depends on implementation). In order not to perform unexpected
changes, duplicate of given string is passed to basename().

Change-Id: Ib783629160f9528a6054dd0f78b9ebd5e6870fb6

9 years agoModify RecordCorruptedException class hierarchy 71/32771/17
Pawel Wieczorek [Mon, 22 Dec 2014 15:18:41 +0000 (16:18 +0100)]
Modify RecordCorruptedException class hierarchy

So far there was only one type of record Cynara could read from its
database. If any corruption was detected, BucketRecordCorruptedException
was thrown.

Now database will contain information about not only buckets and
policies, but also some metadata for them (in this case - checksums).
Need for exception superclass for handling corrupted records emerged.

Patch modifies exception class hierarchy and adds new exception type:
ChecksumRecordCorruptedException.

Change-Id: I3af6bd20b57e17ec31d766f138595920c7a413bd

9 years agoRemove unwanted pointers (InMemoryStorageBackend) 32/36032/2
Pawel Wieczorek [Fri, 27 Feb 2015 09:50:52 +0000 (10:50 +0100)]
Remove unwanted pointers (InMemoryStorageBackend)

Using pointers to helper classes (Integrity and, in future,
ChecksumValidator) is unnecessary and undesired. However, this forces
removal of InMemoryStorageBackend default constructor, as it cannot
initialize its helpers with valid arguments.

This patch also adjusts tests to the new constructor set and removes no
longer used typedef.

Change-Id: If0a41a75c16be6d55bdf3841ddb5190c388968af

9 years agoExtend ignored files list in integrity mechanism 73/32773/15
Pawel Wieczorek [Fri, 5 Dec 2014 14:26:24 +0000 (15:26 +0100)]
Extend ignored files list in integrity mechanism

Integrity mechanism will not remove file containing checksums even
though it is not listed in database index.

Change-Id: I1e587ecdad5abff47d78362394cc0ecdb1ecd4c4

9 years agoAdd tests for migration tool 93/35793/3
Pawel Wieczorek [Tue, 24 Feb 2015 14:58:42 +0000 (15:58 +0100)]
Add tests for migration tool

Change-Id: I2bdd88cd07646896b75ea36e7776b7fa1a449bd8

9 years agoAdd support for checksums to migration tool 11/33911/10
Pawel Wieczorek [Fri, 16 Jan 2015 10:16:56 +0000 (11:16 +0100)]
Add support for checksums to migration tool

This patch also adds downgrade option to the migration tool.

Change-Id: If6a443172d52a78e8bfbf732e7eca38cb37f886f

9 years agoAdd comparator for Semantic Versioning 45/35145/4
Pawel Wieczorek [Mon, 9 Feb 2015 14:37:57 +0000 (15:37 +0100)]
Add comparator for Semantic Versioning

Change-Id: I73b273465995b6246d20179395bdff1b4d1941f2

9 years agoRefactorize migration tool 92/35792/1
Pawel Wieczorek [Wed, 11 Feb 2015 15:00:12 +0000 (16:00 +0100)]
Refactorize migration tool

This refactoring run deals with:
* unintuitive naming,
* late input validation,
* passing only parts of input during option parsing,
* unconsistent comments.

Additionally, this patch:
* adds possiblity to install database in a custom directory,
* removes possibility of removing whole Cynara's state directory during
  deinstallation - now only database is removed by migration tool.

Change-Id: I59e429d93812861ca9c32f201ed0056f753cbc25

9 years agoAdd tests for ChecksumGenerator (chsgen) 12/35612/3
Pawel Wieczorek [Wed, 18 Feb 2015 12:23:54 +0000 (13:23 +0100)]
Add tests for ChecksumGenerator (chsgen)

This patch adds tests for calling "cynara-db-chsgen" executable.
Following call scenarios are checked:
* no filename,
* create checksum records for primary database contents,
* create checksum records for backup database contents.

Change-Id: I398f6865610598ab558b22a9cf3cdc620dc057b8

9 years agoIntroduce ChecksumGenerator (chsgen) 07/34007/9
Pawel Wieczorek [Fri, 16 Jan 2015 14:38:05 +0000 (15:38 +0100)]
Introduce ChecksumGenerator (chsgen)

A commandline-tool for computing checksums for Cynara's database
contents.

Change-Id: Iaddf799b84b82562734275991561ea0091852f2d

9 years agoFix InMemoryStorageBackend unit tests 11/35611/2
Pawel Wieczorek [Wed, 18 Feb 2015 14:36:33 +0000 (15:36 +0100)]
Fix InMemoryStorageBackend unit tests

One of InMemoryStorageBackend unit tests - load_from_backup from
InMemeoryStorageBackendFixture group - gave inconclusive results. After
first execution of "cynara-tests" some contents of CYNARA_TESTS_DIR/db6
were removed. It was caused by insufficient mocking in
FakeInMemoryStorageBackend class.

This patch removes performing changes on filesystem from this test. It
also adjusts Integrity class to new PathConfig::StoragePath contents in
order to simplify its usage.

Change-Id: Ic5206ad337269996615ce36d60105b9c4ac32314

9 years agoMove bucket separators to PathConfig::StoragePath 18/33518/11
Pawel Wieczorek [Mon, 12 Jan 2015 12:45:21 +0000 (13:45 +0100)]
Move bucket separators to PathConfig::StoragePath

This patch removes both bucket separators - for fields as well as for
records - from StorageSerializer. To this point they could be accessed
using provided static member functions. This is no longer possible, as
StorageSerializer has to be rewritten using templates.

Change-Id: Ib010bd0b125a1a93da9983d9bdd7b8f75cbbc191

9 years agoMove storage consts to PatchConfig::StoragePath 72/32772/13
Pawel Wieczorek [Thu, 4 Dec 2014 10:45:40 +0000 (11:45 +0100)]
Move storage consts to PatchConfig::StoragePath

Put all default values of Cynara storage consts into config namespace.

Change-Id: If0bfaca58708b575bfada41448f000272e54182e

9 years agoMove migration tool to its parent directory 05/34005/8
Pawel Wieczorek [Wed, 12 Nov 2014 17:02:34 +0000 (18:02 +0100)]
Move migration tool to its parent directory

This patch drops creation of additional directory "cynara" in /usr/sbin.
According to FHS, there must not be placed any directories. Migration
scripts will get common prefix ("cynara-db-") and will be placed there
directly.

What is more, regardless of its actual contents, no executable in
/usr/sbin has file extension. This patch removes extension from main
migration tool script.

Change-Id: I4f5ccbf1e86815d4b4aa4e785dc01d8188d90fd5

9 years agoModify version check during package upgrade 40/34940/6
Pawel Wieczorek [Wed, 4 Feb 2015 11:11:19 +0000 (12:11 +0100)]
Modify version check during package upgrade

Cynara has to determine its currently installed version during package
upgrade. Doing RPM queries from inside install-time scripts isn't
recommended. Necessary information is obtained from Cynara's version
information.

However, not all Cynara releases provided mechanism of reporting its
version. In case of lack of it, following fallback mechanism is
provided: version information is extracted from a name of a file that
Cynara depends on, which currently is
"<libdir>/libcynara-commons.so.<version>".

Change-Id: I5c9a2abf123d91a32513980e3f9c24112d59547c

9 years agoAdd tests for version reporting 52/35552/4
Pawel Wieczorek [Tue, 17 Feb 2015 09:28:02 +0000 (10:28 +0100)]
Add tests for version reporting

This patch adds tests for calling main Cynara executable with additional
options. Following call scenarios are checked (both long and short
options):
* print version,
* print help,
* unknown option.

Change-Id: Ibab5d7a081fd1da8b98a59c9a242fd17725cd400

9 years agoAdd version information to the main executable 97/34397/9
Pawel Wieczorek [Wed, 21 Jan 2015 13:12:42 +0000 (14:12 +0100)]
Add version information to the main executable

In order to comply with GNU Coding Standards for command-line
interfaces, Cynara has to report its current version.

Cynara now responds to two command-line options:
* -V, --version    prints installed version of Cynara,
* -h, --help       prints help message.

Change-Id: I386a09d00f1542cbff8db6a4b9eb2ac9a7fab9fb

9 years agoAdd quiet fixture for commandline tests 10/35610/2
Pawel Wieczorek [Tue, 17 Feb 2015 15:29:15 +0000 (16:29 +0100)]
Add quiet fixture for commandline tests

This patch introduces fixture which suppresses printing output to
std::cout or std::cerr. Data is redirected to temporary buffers and
accessible from there.

Change-Id: Ia1b8b240be95d1d672a56cd9eaf6e13320bb375b

9 years agoMake commandline tests fixture more generic 51/35551/3
Pawel Wieczorek [Mon, 16 Feb 2015 16:14:12 +0000 (17:14 +0100)]
Make commandline tests fixture more generic

CyadCommandlineTest fixture can be reused for tests of Cynara's
commandline interface (and others, if necessary). Its functionality is
now moved to BaseCommandlineTest fixture.

Commons for tests will be placed in "test-common", because name "common"
was already taken - it's a place for storing tests of Cynara's commons.

Change-Id: I57a5c894ed03ee349a30dae922ec669003eaac5c

9 years agoAdd performance tests for InMemoryStorageBackend 08/33508/2
Aleksander Zdyb [Mon, 12 Jan 2015 12:01:24 +0000 (13:01 +0100)]
Add performance tests for InMemoryStorageBackend

Methods of InMemoryStorageBackend::hasBucket()
and InMemoryStorageBackend::createBucket() are checked
against possible performance issues.

Change-Id: I0f65b77cab6ae88f62a495f0e34c38e391c61773

9 years agoFix (de)serializing sizes of strings & containers 66/35366/8
Adam Malinowski [Thu, 12 Feb 2015 14:39:53 +0000 (15:39 +0100)]
Fix (de)serializing sizes of strings & containers

Additionally fix (de)serializing bool as its size is implementation
specific and remove unused code.

Change-Id: I5389b2191b827a2da5dfe0d967064b10ca9d4a73

9 years agoIntroduce logging of privilege checks (AUDIT) 77/35177/6
Adam Malinowski [Fri, 6 Feb 2015 08:58:02 +0000 (09:58 +0100)]
Introduce logging of privilege checks (AUDIT)

Added functionality saves privilege checking responses in systemd
journal. Such entries may be filtered using CYNARA_LOG_TYPE=AUDIT
field. Logging depends on configuration based on environment variable
CYNARA_AUDIT_LEVEL which may take one of following values:
  * NONE - nothing will be saved
  * DENY - only DENY responses will be saved (DEFAULT behaviour)
  * ALLOW - only ALLOW respones will be saved
  * OTHER - other policy types e.g. plugin specific
  * ALL - all above responses will be saved

Change-Id: Iaa46f3c579660784ffe5edc0c2120b822fb0061a

9 years agoSupport human-readable policy type names 26/35126/5
Aleksander Zdyb [Mon, 9 Feb 2015 12:30:26 +0000 (13:30 +0100)]
Support human-readable policy type names

Policy type is no longer parsed in CyadCommandlineParser,
but rather forwarded to CommandsDispatcher in raw form.

Apparent small feature, but required changes across many
layers. Refactoring of CyadCommandlineDispatcherTest was
needed in order to apply fixes to tests.

Change-Id: I9528554afdb5c0747c3f9ef550bf3362cd8c8084

9 years agoPrint error messages to stderr in Cyad 88/34388/6
Aleksander Zdyb [Mon, 2 Feb 2015 13:11:47 +0000 (14:11 +0100)]
Print error messages to stderr in Cyad

Every dispatched command checks return value from Cynara API
and prints possible error message using cynara_strerror() function.

Call to cynara_strerror() is not of course subject to above
check & print routine.

Change-Id: I008d1fbd592061646478b47be8ae53bbc408cb1b

9 years agoAdd API description of cynara_strerror() 34/34134/8
Aleksander Zdyb [Thu, 22 Jan 2015 10:25:00 +0000 (11:25 +0100)]
Add API description of cynara_strerror()

Introduce new API call of cynara_strerror() used to obtain error
message from error number.

Change-Id: Ibd5b5a2af700a04fe8b3bfea8fde715b17db3a61

9 years agoFix pluginCheck in service logic 73/35373/1
Zofia Abramowska [Thu, 12 Feb 2015 16:39:21 +0000 (17:39 +0100)]
Fix pluginCheck in service logic

Change-Id: I835c471b38756a9d3cee1ddfe4c4b90591744aa4

9 years agoAdd client protocol side implementation of simple check 19/35219/5
Zofia Abramowska [Tue, 10 Feb 2015 15:53:39 +0000 (16:53 +0100)]
Add client protocol side implementation of simple check

Change-Id: I379bf96ac664827d89379b1df36d903864749a4b

9 years agoAdd logic side implementation of simple check 18/35218/5
Zofia Abramowska [Mon, 9 Feb 2015 15:14:34 +0000 (16:14 +0100)]
Add logic side implementation of simple check

Add implementation of client and service logic side implementation
of simple check API and request and response handling.

Change-Id: Ie59fb86e20fae383196025580b164c15e855bc62

9 years agoCreate request and response types for simple check client API call 17/35217/5
Zofia Abramowska [Tue, 10 Feb 2015 15:21:42 +0000 (16:21 +0100)]
Create request and response types for simple check client API call

Create SimpleCheckResponse and SimpleCheckRequest.

Change-Id: I75796fb035ac9dfd5ecbe1e8bfc68d37a55ba6f4

9 years agoAdd new cynara_simple_check synchronous client API 53/34853/9
Zofia Abramowska [Tue, 3 Feb 2015 13:13:40 +0000 (14:13 +0100)]
Add new cynara_simple_check synchronous client API

New API description put in synchronous client header.
New return code added - CYNARA_API_ACCESS_NOT_RESOLVED.
Mockup function to Logic added.

Change-Id: I57968b3e17cf70c3b294af1faf8158e265ffe2b6

9 years agoFix possible memory leaks in Logic initialization 43/34843/5 accepted/tizen/tv/20150217.004140 submit/tizen_tv/20150216.113353
Zofia Abramowska [Tue, 3 Feb 2015 12:02:26 +0000 (13:02 +0100)]
Fix possible memory leaks in Logic initialization

Change for:
* client logic
* client-async logic
* admin logic
* agent logic

Change-Id: Ie2f4db0324652a24d1e4755a888fff4e713eac8c

9 years agoAdd logic implementation of configuration 69/33769/9
Zofia Abramowska [Wed, 14 Jan 2015 13:06:07 +0000 (14:06 +0100)]
Add logic implementation of configuration

Add optional configuration parameter to client logic creation.

Change-Id: I66091d539b66803e069bcf7c6223017cc5e65e39

9 years agoAdd api side implementation of configuration 68/33768/9
Zofia Abramowska [Wed, 14 Jan 2015 12:49:46 +0000 (13:49 +0100)]
Add api side implementation of configuration

Add implementation of cynara client (both async and sync) configuration
initialization, destruction and cache size option setting.

Change-Id: I34a81cb7c1578fc9a51944b73478ace3b623b9cc

9 years agoAdd API descriptions of cynara-configuration calls 68/33668/8
Zofia Abramowska [Tue, 13 Jan 2015 14:28:46 +0000 (15:28 +0100)]
Add API descriptions of cynara-configuration calls

Introduce three new API calls specific for
cynara_configuration creation, destruction and cache size setting.

Change-Id: Id24175765ebff71b18bfdd4fd94c9a671c0035dc

9 years agoAdd API descriptions of cynara-async-configuration calls 67/33667/7
Zofia Abramowska [Tue, 13 Jan 2015 14:24:17 +0000 (15:24 +0100)]
Add API descriptions of cynara-async-configuration calls

Introduce three new API calls specific for cynara_async_configuration
creation, destruction and cache size setting.

Change-Id: I51665a2885c6de3a49ebd30dcfc10a733707673b

9 years agoFix catching exceptions in socket helper functions 90/34190/3
Radoslaw Bartosiak [Wed, 21 Jan 2015 15:12:57 +0000 (16:12 +0100)]
Fix catching exceptions in socket helper functions

Cynara socket helpers functions could throw exceptions (GET_CRED
macro in cders-socket-inner.cpp used std::to_string()).
Fixed it with Cynara::tryCatch().

Change-Id: Ic0db847bc04e9817d1afa86310452147f9678431
Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
9 years agoRelease 0.5.0 12/33912/3 tizen_3.0.2014.q4_common accepted/tizen/common/20150119.084431 accepted/tizen/mobile/20150119.094544 accepted/tizen/tv/20150119.093622 accepted/tizen/tv/20150223.124300 accepted/tizen/wearable/20150119.094052 submit/tizen/20150116.125650 submit/tizen_tv/20150223.105907 v0.5.0
Lukasz Wojciechowski [Fri, 16 Jan 2015 10:32:46 +0000 (11:32 +0100)]
Release 0.5.0

Change-Id: Iaf6d9ba8649a23477ba08dc50ccac2044ffa48b6

9 years agoFix missing predefined policies description in offline 18/33918/1
Lukasz Wojciechowski [Fri, 16 Jan 2015 12:21:46 +0000 (13:21 +0100)]
Fix missing predefined policies description in offline

Predefined policies description were returned only in online
admin mode. Offline admin mode returned just policy types
provided by plugins.

Now both offline and online mode return predefined and plugin
provided policy types.

Change-Id: I890062638a8d2d54dc67edd4a883cfccea5f3905

9 years agoImplement --list-policies-descriptions option 03/33903/2
Aleksander Zdyb [Fri, 16 Jan 2015 09:50:55 +0000 (10:50 +0100)]
Implement --list-policies-descriptions option

Change-Id: I5be0664a33191863d7a38ab1b5e42004a77b912e

9 years agoImplement --list-policies option in Cyad 88/33888/4
Aleksander Zdyb [Fri, 16 Jan 2015 09:06:12 +0000 (10:06 +0100)]
Implement --list-policies option in Cyad

Change-Id: Ib20721f04dc4c43ee92f5e279cdf764dbaf2cc2a

9 years agoRefactorize command-line & friends 51/33351/4
Aleksander Zdyb [Tue, 13 Jan 2015 08:17:04 +0000 (09:17 +0100)]
Refactorize command-line & friends

This refactoring run mostly deals with cumbersome
and redundant command-line options framework.

Change-Id: I62369d9faaf0414314e1ea5e450fac2eb7319534

9 years agoImplement --check in Cyad 50/33250/3
Aleksander Zdyb [Mon, 5 Jan 2015 10:09:57 +0000 (11:09 +0100)]
Implement --check in Cyad

This option is used to do administrative checks
in Cynara's database.

Change-Id: I2900826610aa91d3a3c9cc042d59c7cd9f541547

9 years agoAdd -k, --bucket to help message 74/33074/3
Aleksander Zdyb [Mon, 5 Jan 2015 07:52:59 +0000 (08:52 +0100)]
Add -k, --bucket to help message

The option was missing in --set-policy (-s) documentation.

Change-Id: If66c2d068040cbf4d7875cc3cf3083decf6aeba0

9 years agoImplement --erase option in Cyad 92/32992/6
Aleksander Zdyb [Fri, 2 Jan 2015 07:04:22 +0000 (08:04 +0100)]
Implement --erase option in Cyad

This option runs cynara_admin_erase() API function
to erase policies from Cynara's database.

Change-Id: I3659971657ef23fcd1c27850f56f32e57938aa6d

9 years agoIntroduce HumanReadableParser 11/33011/4
Aleksander Zdyb [Fri, 2 Jan 2015 07:46:09 +0000 (08:46 +0100)]
Introduce HumanReadableParser

A set of helper functions to parse human readable
values from command-line.

Change-Id: Ic2b8865f04f1f75afa66f3640f1eedcdff22c71d

9 years agoRename --policy to --type in Cyad 10/33010/3
Aleksander Zdyb [Fri, 2 Jan 2015 07:10:07 +0000 (08:10 +0100)]
Rename --policy to --type in Cyad

Option of --policy has been renamed to --type (-t)
to let --privilege have -p as short option (formerly -r).

Change-Id: Idaf2db21e33707e4472e962c2d9d6d695549dbdf

9 years agoVerify PolicyType on service and offline client side 77/33677/3
Lukasz Wojciechowski [Tue, 13 Jan 2015 19:38:08 +0000 (20:38 +0100)]
Verify PolicyType on service and offline client side

Verification of PolicyTypes was removed from libcynara-admin library.
Now it is added to Cynara service and cynara offline admin with full
plugin support. It means, that validation passes only for predefined
types or types provided by loaded cynara service plugins.
In case, the validation fails, new CodeResponse::Code::NO_POLICY_TYPE
value is returned from service to libcynara admin side and
CYNARA_API_INVALID_PARAM is returned from cynara_admin_set_policies()
or cynara_admin_set_bucket() functions.

Change-Id: Id1a85aafaa4feb31d8513e819c78736813a9ff38

9 years agoRemove checking PolicyType in libcynara-admin 76/33676/2
Lukasz Wojciechowski [Tue, 13 Jan 2015 17:05:20 +0000 (18:05 +0100)]
Remove checking PolicyType in libcynara-admin

Two libcynara-admin API functions:
* cynara_admin_set_policies
* cynara_admin_set_bucket
have checked validity of PolicyType. Except for special values
(like NONE, BUCKET, DELETE) they accepted only ALLOW and DENY
policy types. No other policy types defined by plugins were able
to be set.

This patch removes described checks leaving only special values
handling. All other types (including ALLOW and DENY) are passed
to cynara service.

The only check that is done verifies if given policy type can
be casted into Cynara::PolicyType.

Change-Id: Iedb0434bd35d4085e977fe86d07ed33a1f89cdc7

9 years agoFix bug keeping write and read queue on disconnect 89/33089/3
Marcin Niesluchowski [Mon, 5 Jan 2015 11:22:21 +0000 (12:22 +0100)]
Fix bug keeping write and read queue on disconnect

Read and write binary queues are not cleared in asynchronous client
after disconnect happens. Add clearing function in connect() and
completeConnection() functions of SocketClientAsync class, when connection
state changes.

Change-Id: I18f5d13a1a21d0b99ebe456bfafd4487df9c1767

9 years agoBring back lost feature of loading client plugins 64/32964/1
Lukasz Wojciechowski [Wed, 31 Dec 2014 01:21:48 +0000 (02:21 +0100)]
Bring back lost feature of loading client plugins

Patch "Remove loading plugins from PluginManager constructor"
removed loading plugins from PluginManager constructor.
Loading plugins was manually added to cynara service start procedure.
However PluginManager is used also in client libraries - that was
forgotten and is fixed in this patch.

Change-Id: I9bb93720fbfcf2275bff40699ea039c6ae1872dc

9 years agoRemove never used offline-admin header 60/32960/1
Lukasz Wojciechowski [Tue, 30 Dec 2014 18:22:46 +0000 (19:22 +0100)]
Remove never used offline-admin header

Change-Id: I22f12755352d230a2ae5eacf8f8040b93a0e7ead

9 years agoImplement offline listing of policy descriptions 59/32959/2
Lukasz Wojciechowski [Tue, 30 Dec 2014 17:41:12 +0000 (18:41 +0100)]
Implement offline listing of policy descriptions

PluginManager instance is created when list of policy descriptions
is needed. Created object loads service plugins and creates required
list.

Change-Id: I9d7d5d31afb13f21c53545bd3ad8553c0a9a745b

9 years agoCall acquireDatabase() in OfflineLogic API functions 58/32958/2
Lukasz Wojciechowski [Tue, 30 Dec 2014 13:11:16 +0000 (14:11 +0100)]
Call acquireDatabase() in OfflineLogic API functions

Call of OfflineLogic::acquireDatabase() has been moved from
centralized point in Logic to every single call of OfflineLogic
API functions, because some functions does not require database.
So there is no need to load it.

Now database is loaded only in case, when it is needed.

Change-Id: I26131a257e85c79b97a96a748b4eb22ea96dd531

9 years agoRemove loading plugins from PluginManager constructor 57/32957/2
Lukasz Wojciechowski [Tue, 30 Dec 2014 12:27:55 +0000 (13:27 +0100)]
Remove loading plugins from PluginManager constructor

Loading plugins can be done also by offline API while executing
listing of available policy descriptions. That is why loading plugins
should be done only in case when database lock is aquired.

PluginManager::loadPlugin() has been changed to public and is
ran manually during cynara service startup.

Change-Id: Ie5b9276049bda08fb14d2a7620613afe5e0942f4

9 years agoMake logs available in devel package 40/32940/2
Adam Malinowski [Tue, 30 Dec 2014 11:21:00 +0000 (12:21 +0100)]
Make logs available in devel package

Header for logs is now installed for cynara related components
that want to use cynara logs e.g. plugins.

Change-Id: I174ce7ed4770cbf76511716e879885cffca32316

9 years agoAdjust logs to C++ string stream 39/32939/2
Adam Malinowski [Tue, 30 Dec 2014 11:04:39 +0000 (12:04 +0100)]
Adjust logs to C++ string stream

Now macros LOGx() accept:
* sprintf style messages e.g. LOGE("Error: [%d]", 69);
* C++ string stream e.g. LOGE("Error: [" << 69 << "]");

Change-Id: I9bbfd2dfd595c6f42f2bcba09f02d207da1c6062

9 years agoAdd missing include file in common install section 77/32877/2
Adam Malinowski [Mon, 29 Dec 2014 19:25:53 +0000 (20:25 +0100)]
Add missing include file in common install section

types/PolicyDescription.h was missing in common/CMakeLists.txt
install section.

Change-Id: Ia7afde0ef8723d680d4aaa9ba9dee7f3533bf828

9 years agoAssemble all Cyad's components 85/32185/8
Aleksander Zdyb [Sat, 20 Dec 2014 12:42:34 +0000 (13:42 +0100)]
Assemble all Cyad's components

Change-Id: I1a711cad7d5aba0508ef41f308cddcc7a0704b28

9 years agoImplement --set-policy option in Cyad 84/32184/8
Aleksander Zdyb [Mon, 15 Dec 2014 12:58:31 +0000 (13:58 +0100)]
Implement --set-policy option in Cyad

Policies can be added or altered one by one or in bulk mode.

Option --bulk accepts file name as an argument.
The "-" value means standard input.

Change-Id: I479a29fd5ff43463f6f78d7865468bd84e1642ee

9 years agoImplement --set-bucket and --delete-bucket in Cyad 83/32183/7
Aleksander Zdyb [Mon, 15 Dec 2014 12:49:46 +0000 (13:49 +0100)]
Implement --set-bucket and --delete-bucket in Cyad

Change-Id: I61065bb8364d8cb33821c8a7be20a4b756522b43

9 years agoAdd CyadCommandlineParser 82/32182/6
Aleksander Zdyb [Mon, 15 Dec 2014 09:26:12 +0000 (10:26 +0100)]
Add CyadCommandlineParser

Only --help option is currently supported.
There is also errors handling implemented.

Change-Id: I81b9aae457c49518e42582653b8c29a84b4870ac

9 years agoSupport --bulk in --set-policy in Cyad 81/32181/6
Aleksander Zdyb [Fri, 12 Dec 2014 13:25:08 +0000 (14:25 +0100)]
Support --bulk in --set-policy in Cyad

Change-Id: I3c6792fc1f5da1d5ce8c7ca5cca2bc7380154902

9 years agoAdd --set-policy option to Cyad 80/32180/6
Aleksander Zdyb [Fri, 12 Dec 2014 12:53:25 +0000 (13:53 +0100)]
Add --set-policy option to Cyad

Change-Id: I62dedb73c9f486cc071d2f80d93721fd81a07d13

9 years agoAdd --set-bucket and --delete-bucket to Cyad 79/32179/6
Aleksander Zdyb [Sat, 20 Dec 2014 12:05:23 +0000 (13:05 +0100)]
Add --set-bucket and --delete-bucket to Cyad

Change-Id: I54b8199b3daf59bf9a8f81222391e42980ba2f41

9 years agoIntroduce CommandsDispatcher 78/32178/6
Aleksander Zdyb [Sat, 20 Dec 2014 11:49:27 +0000 (12:49 +0100)]
Introduce CommandsDispatcher

Change-Id: I220422f667c32c673e0b55b04d9faac39d840037

9 years agoIntroduce AdminPolicyParser::parse() 77/32177/6
Aleksander Zdyb [Tue, 9 Dec 2014 13:17:49 +0000 (14:17 +0100)]
Introduce AdminPolicyParser::parse()

This function parses input stream and returns
a CynaraAdminPolicies collection.

It uses parsing functions from cynara-storage library.

Change-Id: I3615563a2a8184a5c39b88952af795abd8399748

9 years agoMake BucketDeserializer::parseKey() public 68/32168/6
Aleksander Zdyb [Sat, 6 Dec 2014 13:58:00 +0000 (14:58 +0100)]
Make BucketDeserializer::parseKey() public

This static function will be needed in Cyad.

Change-Id: Iccc28a9ea6754e23ba7878a07546d426af9e0c9a

9 years agoIntroduce DispatcherIO 76/32176/5
Aleksander Zdyb [Tue, 9 Dec 2014 12:42:33 +0000 (13:42 +0100)]
Introduce DispatcherIO

BaseDispatcherIO provides interface for wrapping
and aggregating I/O streams. The wrapping is needed
mainly for testing purposes, but in near future will
be used for printing messages, errors, etc.

DispatcherIO is a target implementation, while
FakeDispatcherIO is a stub for testing.

Change-Id: I1ce231c3bbaf5f7f483358478cdf1eb5ff618589

9 years agoIntroduce CynaraAdminPolicies 75/32175/5
Aleksander Zdyb [Tue, 9 Dec 2014 12:22:55 +0000 (13:22 +0100)]
Introduce CynaraAdminPolicies

This is a collection of cynara_admin_policy structs.
It helps to manage memory and creates a convenient
wrapper while still allowing to pass it to API calls.

Change-Id: I61e39dbab88cbbbef07a0bd5ace4967d20336b17

9 years agoIntroduce AdminApiWrapper 74/32174/5
Aleksander Zdyb [Tue, 9 Dec 2014 11:37:44 +0000 (12:37 +0100)]
Introduce AdminApiWrapper

BaseAdminApiWrapper provides interface for wrapping
functions of cynara-admin API. The wrapping is needed
mainly for testing purposes.

AdminApiWrapper is a target implementation, while
FakeAdminApiWrapper is a mock for testing.

Change-Id: I0b4afb89d8b4bec62693cf070f2a5a90f1148b79

9 years agoIntroduce Cyad 73/32173/4
Aleksander Zdyb [Tue, 9 Dec 2014 11:23:37 +0000 (12:23 +0100)]
Introduce Cyad

A command-line tool for managing Cynara's database.

Change-Id: I3731f0c3166469c2e4e43dff9e4593adfc66106e

9 years agoFix searching plugin in CapacityCache::update() 12/32412/5
Adam Malinowski [Wed, 17 Dec 2014 18:34:38 +0000 (19:34 +0100)]
Fix searching plugin in CapacityCache::update()

Also put procedure finding plugin into method as it repeats twice.

Change-Id: Icd77e45f77637a7e52871aa8d2b2c9d8d4af925d

9 years agoAdd debug info in plugins loading mechanism 11/32411/5
Adam Malinowski [Wed, 17 Dec 2014 18:19:20 +0000 (19:19 +0100)]
Add debug info in plugins loading mechanism

Change-Id: Ifebe1dcb8b985764b3cbcdbf9f3bb3d0462ad234

9 years agoMake logs initialized in the very begining of libs 02/32402/4
Adam Malinowski [Wed, 17 Dec 2014 16:45:08 +0000 (17:45 +0100)]
Make logs initialized in the very begining of libs

Change-Id: I44bffd736e29c59c9d0d929906e43816dcf927d2

9 years agoFix unregistering agents on contextClosed event 42/31742/6
Adam Malinowski [Tue, 9 Dec 2014 08:56:06 +0000 (09:56 +0100)]
Fix unregistering agents on contextClosed event

Also:
* fix agent talkers removing
* optimize check requests removing

Change-Id: I0f0251783f00a90a5e3004638b08878255251eb8

9 years agoAdd serialization tests for DescriptionList 44/32844/2
Lukasz Wojciechowski [Sun, 28 Dec 2014 00:38:33 +0000 (01:38 +0100)]
Add serialization tests for DescriptionList

Add tests checking serialization/deserialization of DescriptionListRequest
and DescriptionListResponse implementation in ProtocolAdmin.

Change-Id: Ic3579436f361cbf9a9d60393de733c800c52181d