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

9 years agoImplement plugin description listing in admin protocol layer 68/32768/3
Zofia Abramowska [Tue, 23 Dec 2014 12:51:36 +0000 (13:51 +0100)]
Implement plugin description listing in admin protocol layer

Change-Id: Id8de44b255234fec8a4bd85091283db2f00be205

9 years agoImplement plugin description listing in service logic 08/32708/2
Zofia Abramowska [Mon, 22 Dec 2014 17:03:21 +0000 (18:03 +0100)]
Implement plugin description listing in service logic

Change-Id: I426edc48d77768b2841fb96ee35eb6eb01cfae11

9 years agoImplement plugin description listing in admin logic 07/32707/2
Zofia Abramowska [Mon, 22 Dec 2014 16:27:21 +0000 (17:27 +0100)]
Implement plugin description listing in admin logic

Change-Id: I82f82a7dc31cad4349c91ac61a36b70e00c2929a

9 years agoRedo admin logic template 06/32706/2
Zofia Abramowska [Mon, 22 Dec 2014 15:40:16 +0000 (16:40 +0100)]
Redo admin logic template

Template askCynaraAndInterpreteCodeResponse replaced with more general
getResponse.

Change-Id: I3d4ba04ebc5fb279a4eefbe9657a627822c39fc2

9 years agoAdd classes for plugin description listing request and response 95/32695/3
Zofia Abramowska [Mon, 22 Dec 2014 12:19:15 +0000 (13:19 +0100)]
Add classes for plugin description listing request and response

DescritpionListRequest used for asking cynara for list of internal
and external plugin description.
DescriptionListResponse used for sending this list back to client.

Change-Id: I047747efcf69ecf7f15747e890ffe1b2b98132f1

9 years agoAdd api side implementation of plugin descriptions listing 30/32630/4
Zofia Abramowska [Fri, 19 Dec 2014 09:52:22 +0000 (10:52 +0100)]
Add api side implementation of plugin descriptions listing

Add:
* description of api function cynara_admin_list_policies_descriptions
* implementation in admin-api
* utilities for creating null terminated array

Change-Id: I4b7d56757e22fab4cce81665f16ceef61f3a0e2c

9 years agoAdd listing types of policies 14/32214/5
Zofia Abramowska [Tue, 16 Dec 2014 15:48:58 +0000 (16:48 +0100)]
Add listing types of policies

Change-Id: Iab51f7ec232fb711ac6945be1ce71effa7e59ef1

9 years agoImplement detection of online/offline mode in admin 39/29339/17
Aleksander Zdyb [Tue, 23 Dec 2014 13:21:47 +0000 (14:21 +0100)]
Implement detection of online/offline mode in admin

Change-Id: I93a2af08266d7606491abf4f89bf16663c7d0e15

9 years agoRename admin's Logic to OnlineLogic 35/32635/5
Aleksander Zdyb [Wed, 17 Dec 2014 09:24:11 +0000 (10:24 +0100)]
Rename admin's Logic to OnlineLogic

This is a preparation to implement OfflineLogic.

Change-Id: Ica6e7dfe12ac9bc921f77e2c5d08bc539373ed07

9 years agoInherit from Exception in FileLockAcquiringException 57/32757/3
Aleksander Zdyb [Tue, 23 Dec 2014 13:11:15 +0000 (14:11 +0100)]
Inherit from Exception in FileLockAcquiringException

Change-Id: I40eb3f6b906f34261f8c6b6596e0afb503e41e7a

9 years agoLock database in Cynara::init() 38/29338/15
Aleksander Zdyb [Mon, 27 Oct 2014 13:49:11 +0000 (14:49 +0100)]
Lock database in Cynara::init()

Change-Id: Ib90550c8dd26af899d9749901b3ab3e043fe3e2a

9 years agoIntroduce Lockable in FileLock 62/32762/2
Aleksander Zdyb [Tue, 23 Dec 2014 12:54:32 +0000 (13:54 +0100)]
Introduce Lockable in FileLock

FileLock now operates on lockable object instead
of a file path and internal file descriptor.

Lockable is an abstraction of file descriptor.

Change-Id: Ie17905a4455492956e5162d90add488ca6f3080c

9 years agoDon't create database directory 37/29337/13
Aleksander Zdyb [Mon, 27 Oct 2014 13:45:58 +0000 (14:45 +0100)]
Don't create database directory

This functionality was replaced by database migration tool
and database directory is always present.

Change-Id: Ib5f1f8a6c2887534f2c4f0ae3c85245d69818a14

9 years agoAdd StoragePath::lockfile path 36/29336/13
Aleksander Zdyb [Mon, 27 Oct 2014 13:44:14 +0000 (14:44 +0100)]
Add StoragePath::lockfile path

Change-Id: I16242dd8da7435661ee65698541e935ea9105cf1

9 years agoRemove surplus read permissions for migration tool 56/32656/2
Pawel Wieczorek [Mon, 22 Dec 2014 08:29:43 +0000 (09:29 +0100)]
Remove surplus read permissions for migration tool

In order to prevent possibility of non-authorised usage of migration
tool read permissions for wrapper script are now retracted.

Change-Id: I40d3f7cea0a9597863d0d75f168b2dea9ec64d6d

9 years agoAdd processing EraseRequest on serviceLogic layer 91/32491/2
Lukasz Wojciechowski [Thu, 18 Dec 2014 13:18:53 +0000 (14:18 +0100)]
Add processing EraseRequest on serviceLogic layer

Process EraseRequest, pass data to Storage layer.
Save database in case of successful erase.
Return CodeResponse to sender of EraseRequest.

Change-Id: I9bddfff64bf8b8e11f36ccac85ab5bb715f69c4f

9 years agoImplement erasePolicies() in Storage 90/32490/2
Lukasz Wojciechowski [Thu, 18 Dec 2014 13:04:09 +0000 (14:04 +0100)]
Implement erasePolicies() in Storage

Implementation add StorageBackend::erasePolicies() in base class and
its implementation in InMemoryStorageBackend.
In Storage class erasePolicies() just passes this request to backend.

PolicyBucket class was enhanced with getSubBuckets() method returning
set of all IDs of subbuckets. Subbucket is a bucket that can be reached
with policy (type==BUCKET) from current bucket.

Change-Id: I90598aa916857a917d911068da1a1c18c69391a5

9 years agoHandle EraseRequest in admin library Logic layer 89/32489/2
Lukasz Wojciechowski [Tue, 16 Dec 2014 12:36:38 +0000 (13:36 +0100)]
Handle EraseRequest in admin library Logic layer

Create EraseRequest and wait for CodeResponse. Interprete it
and return proper code to admin API layer.

Change-Id: I35ba3573fdf8a455c5a42020e918a6a7b17c0a46

9 years agoAdd tests for EraseRequest serialization 88/32488/2
Lukasz Wojciechowski [Tue, 16 Dec 2014 12:13:24 +0000 (13:13 +0100)]
Add tests for EraseRequest serialization

Add tests for checking equality of objects and binary data
in serialization / deserialization of EraseRequest
by ProtocolAdmin.

Change-Id: I25c2768572d6aa419c1635586437e7bf673d301f

9 years agoAdd serialization of EraseRequest with ProtocolAdmin 87/32487/2
Lukasz Wojciechowski [Tue, 16 Dec 2014 11:52:04 +0000 (12:52 +0100)]
Add serialization of EraseRequest with ProtocolAdmin

Add serialization and deserialization of request for
erasing multiple policies matching filter key.
Provide new OpCode (28) for EraseRequest.

Change-Id: Ib2370e98e6edae3fbb6a6457ebc5c58590f27580

9 years agoAdd EraseRequest class 86/32486/2
Lukasz Wojciechowski [Fri, 19 Dec 2014 08:37:55 +0000 (09:37 +0100)]
Add EraseRequest class

EraseRequest class will be used to send request for erasing multiple
policies matching filter key from cynara database.

Change-Id: I32f8ef4449ecfcc2b32061a609a9beb442823c64

9 years agoFix documentation and code style in requests folder 44/32644/1
Lukasz Wojciechowski [Fri, 19 Dec 2014 08:35:24 +0000 (09:35 +0100)]
Fix documentation and code style in requests folder

Fix invalid file paths in ListRequest.* files.
Break to long line in RequestTaker.cpp

Change-Id: Icee52525c5413be1cc754d588773151689eb52f7

9 years agoImplement cynara_admin_erase() in admin API layer 85/32485/2
Lukasz Wojciechowski [Tue, 16 Dec 2014 09:48:20 +0000 (10:48 +0100)]
Implement cynara_admin_erase() in admin API layer

Implementation:
* checks validity of parameters,
* translates parameters to C++ objects used in higher layers,
* catches all exceptions,
* runs erasePolicies() method from admin Logic object.

Change-Id: I6d4f0be5f20e283c41839b9618da2dac1c36f858

9 years agoIntroduce new admin API function cynara_admin_erase() 84/32484/2
Lukasz Wojciechowski [Tue, 16 Dec 2014 09:24:46 +0000 (10:24 +0100)]
Introduce new admin API function cynara_admin_erase()

cynara_admin_erase() can be used to erase multiple policies matching
given filter key (client, user, privilege). Erasing starts in given
bucket and then can step into nested buckets if recursive flag is
enabled.
Filter key can use CYNARA_ADMIN_ANY to match any value of client,
user or privilege.

Change-Id: Ib2eb55e864828b4b073a177bc6fea468ec3911c8

9 years agoFix wrong null terminated list deallocation 00/32600/1
Zofia Abramowska [Fri, 19 Dec 2014 09:57:22 +0000 (10:57 +0100)]
Fix wrong null terminated list deallocation

Fixed wrong iteration on null terminated list in deallocating function.

Change-Id: I1f344cbfdcf775aedd3f7e0eb00518cfec423bc2

9 years agobuild: unbreak out-of-tree build of cynara-db-migration 02/31202/2
Rafal Krypa [Tue, 2 Dec 2014 12:57:33 +0000 (13:57 +0100)]
build: unbreak out-of-tree build of cynara-db-migration

Fix "make install" failing on cynara-db-migration when building out-of-tree.

Change-Id: I4a0c90a32e91e25de279d084d3a3801a1f0bb1b2
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
9 years agoTest usage of AdminCheck Req/Resp by ProtocolAdmin 69/31569/7
Lukasz Wojciechowski [Sat, 6 Dec 2014 00:25:25 +0000 (01:25 +0100)]
Test usage of AdminCheck Req/Resp by ProtocolAdmin

Test serialization and deserialization of AdminCheckRequest
and AdminCheckResponse objects by ProtocolAdmin.

Change-Id: Ia8923dbeaf0d03c29fd77bde3758375df59e1bc6

9 years agoRespond to AdminCheckRequest with AdminCheckResponse 68/31568/7
Lukasz Wojciechowski [Fri, 5 Dec 2014 23:37:20 +0000 (00:37 +0100)]
Respond to AdminCheckRequest with AdminCheckResponse

Change implementation of both service and admin library Logic layers
so they use AdminCheckResponse instead of CheckResponse as a reply
for AdminCheckRequest.

This change allows passing additional information about existence
or vacancy of start bucket given in AdminCheckRequest.
In case of vacancy of such bucket in cynara database cynara-admin
library returns CYNARA_API_BUCKET_NOT_FOUND from cynara_admin_check()
function.

This fixes also a bug that was hidden in service Logic. Passing
unexisting bucket causes cynara service to stop because of an unhandled
exception.

Change-Id: Ibf65a69c35ba92ea62bee91a67f43975b97052ca

9 years agoSerialize AdminCheckResponse by ProtocolAdmin 67/31567/6
Lukasz Wojciechowski [Fri, 5 Dec 2014 22:54:02 +0000 (23:54 +0100)]
Serialize AdminCheckResponse by ProtocolAdmin

Add serialization and deserialization of AdminCheckResponse
by ProtocolAdmin.

Change-Id: I727c44f5a599537887d75dca724c56a448107368

9 years agoIntroduce AdminCheckResponse class 66/31566/6
Lukasz Wojciechowski [Fri, 5 Dec 2014 21:07:18 +0000 (22:07 +0100)]
Introduce AdminCheckResponse class

AdminCheckResponse is class for responses to AdminCheckRequests.
It differs from CheckResponse as it contains additional information
about existence of start bucket. Start bucket is BucketId provided
by AdminCheckRequest from which policy search is started.

Change-Id: I9858cfdb8a0acc0016a080eb850bbc65ec081a98

9 years agoImplement listPolicies() in service Logic layer 51/31051/7
Lukasz Wojciechowski [Sun, 30 Nov 2014 00:48:42 +0000 (01:48 +0100)]
Implement listPolicies() in service Logic layer

Implementation lists policies from Storage and returns filled
vector of Policies. It catches also BucketNotExistsException that
is thrown when invalid bucket is passed in ListRequest.

Change-Id: I7b3777b70f654d9a7324c6203e9f25eebb029f1e

9 years agoImplement listing Policies in Storage 50/31050/7
Lukasz Wojciechowski [Sat, 29 Nov 2014 23:46:28 +0000 (00:46 +0100)]
Implement listing Policies in Storage

Implement listPolicies() in Storage and InMemoryStorageBackend.
UnitTests for Storage::listPolicies() were added.

Change-Id: I113c3c0f9b5c1d1d5cbed44e3d23d5d7e489a227

9 years agoImplement listPolicies() in libcynara-admin Logic 49/31049/5
Lukasz Wojciechowski [Sat, 29 Nov 2014 23:19:55 +0000 (00:19 +0100)]
Implement listPolicies() in libcynara-admin Logic

Implementation sends ListRequest object to cynara service
and expects ListResponse.

Change-Id: I5602e815a0b5070b79a02538b1823290380d66c8

9 years agoAdd tests for ListRequest and ListResponse 48/31048/5
Lukasz Wojciechowski [Sat, 29 Nov 2014 22:24:00 +0000 (23:24 +0100)]
Add tests for ListRequest and ListResponse

Added tests cover testing serialization and deserialization
of ListRequest and ListResponse classes by ProtocolAdmin.

Change-Id: I19915d4712be51217a2be17776a21751cff4218d

9 years agoHandle ListResponse by ProtocolAdmin 47/31047/4
Lukasz Wojciechowski [Sat, 29 Nov 2014 16:22:29 +0000 (17:22 +0100)]
Handle ListResponse by ProtocolAdmin

Add serialization and deserialization of ListResponse.

Change-Id: I7df388bf105183732d76cc1c37122919ca6d23df

9 years agoHandle ListRequest by AdminProtocol 46/31046/4
Lukasz Wojciechowski [Sat, 29 Nov 2014 15:34:05 +0000 (16:34 +0100)]
Handle ListRequest by AdminProtocol

Add serialziation and deserialization of ListRequest to AdminProtocol.

Change-Id: Id1fadae22333acba6caec905d82c8e214c2560e9

9 years agoAdd ListResponse - response class for ListRequest 45/31045/4
Lukasz Wojciechowski [Sat, 29 Nov 2014 15:02:20 +0000 (16:02 +0100)]
Add ListResponse - response class for ListRequest

Introduced class wraps a response for policies list that can be sent
by admin of cynara. Response contains vector of matched policies and
boolean information about bucket validity. If there is no bucket with
name that was passed in request - returned vector is empty and bucket
validity is false.

Change-Id: I208555f7a991e0dc4a531312ebbbef658c95f22b

9 years agoAdd ListRequest - new class for listing policies 44/31044/3
Lukasz Wojciechowski [Sat, 29 Nov 2014 14:40:09 +0000 (15:40 +0100)]
Add ListRequest - new class for listing policies

Introduced class wraps a request for policies list that can be sent
by admin of cynara. Request contains name of bucket that should be
searched and a policy key filter.

Change-Id: Ie12b8e5d3d997655bf5c4b8356d71ac5817dbb7f

9 years agoImplement cynara_admin_list_policies in admin-api layer 40/30840/4
Lukasz Wojciechowski [Tue, 25 Nov 2014 19:39:41 +0000 (20:39 +0100)]
Implement cynara_admin_list_policies in admin-api layer

Implementation is complete on admin-api layer.
ApiInterface of libcynara-admin is enhanced by listPolicies method.
Its implementation in Logic layer of admin library is stubbed.

Change-Id: I25f2d4dbc8616717c7e19835c676b218615df9eb

9 years agoEnhance PolicyKey and PolicyKeyFeature by ANY wildcard 39/30839/4
Lukasz Wojciechowski [Tue, 25 Nov 2014 17:15:09 +0000 (18:15 +0100)]
Enhance PolicyKey and PolicyKeyFeature by ANY wildcard

Enhance PolicyKey and PolicyKeyFeature classes, so they can hold
new ANY wildcard as user, client or privilege.
New wildcard can be used for listing and removal of many policies.
It matches any PolicyKeyFeature.

Minor cleanup in class: missing voids added, public section reordered

Change-Id: Icad8e06b87a014fc2fbab32e0553ddd76e5bb06d

9 years agoIntroduce cynara_admin_list_policies() admin function 31/30831/4
Lukasz Wojciechowski [Tue, 25 Nov 2014 16:37:59 +0000 (17:37 +0100)]
Introduce cynara_admin_list_policies() admin function

Introduce new administrative API function: cynara_admin_list_policies()
New function allows listing with filter policies from a single bucket.

New admin define CYNARA_ADMIN_ANY is also introduced. It is a wildcard
for policy listing and removal. It can be used as client, user or privilege
name and matches any policy (even CYNARA_ADMIN_WILDCARD).

Change-Id: I9d014ebc8018e3fa6ad897c4de768471e672ac40

9 years agoAdd FileLock class 35/29335/8
Aleksander Zdyb [Wed, 26 Nov 2014 08:23:06 +0000 (09:23 +0100)]
Add FileLock class

A class creating advisory lock on provided file.
The file must exist and be openable by the process.

Change-Id: Ia5fa4ef51e1a413beb81efd56f807e1434145691

9 years agoAdd convenient typedefs in admin ApiInterface 34/29334/4
Aleksander Zdyb [Wed, 29 Oct 2014 08:42:33 +0000 (09:42 +0100)]
Add convenient typedefs in admin ApiInterface

Change-Id: I9cd8b674a00aba90432609a4cf351e4c8fae3e66

9 years agoUpdate documentation of cynara-admin.h 38/30838/1
Lukasz Wojciechowski [Tue, 25 Nov 2014 19:44:14 +0000 (20:44 +0100)]
Update documentation of cynara-admin.h

Remove out of date information. Since database integrity is fixed
database cannot be in partialy changed state. If changing database
fails it is rolled back to the before operation state.

Change-Id: Idd815cb89a4e49cd75d52abe73a4c7517adaa7fd

9 years agoAdd invalidation mechanism for plugins 72/30472/2
Zofia Abramowska [Tue, 18 Nov 2014 16:04:33 +0000 (17:04 +0100)]
Add invalidation mechanism for plugins

Every time the cynara storage is changed all data stored in
service and client plugins should be invalidated.

Change-Id: I7537aa8a6d3ea28efed0f3e0f986ae51d7f9d344

9 years agoOptimize message() method of exceptions 59/30459/5
Zofia Abramowska [Mon, 17 Nov 2014 16:48:30 +0000 (17:48 +0100)]
Optimize message() method of exceptions

message() returned std::string through value, causing unnecessary
copy. Changed it to return const std::string reference.

Change-Id: I8d9631fb2468924d35ba4376b1821d0d01c7f70c

9 years agoFix uninitialized member 49/30649/2
Zofia Abramowska [Fri, 21 Nov 2014 14:43:28 +0000 (15:43 +0100)]
Fix uninitialized member

Descriptor could return uninitialized BinaryQueuePtr.

Change-Id: I53fbc739438e8316ca5c4b81eec5139b6732aea2

10 years agoRelease 0.4.2 45/30445/1 tizen_3.0_ivi accepted/tizen/common/20141121.095612 accepted/tizen/ivi/20141202.020816 accepted/tizen/mobile/20141216.073451 accepted/tizen/mobile/20150105.022449 submit/tizen/20141118.171019 submit/tizen_common/20141119.161253 submit/tizen_ivi/20141201.045232 submit/tizen_mobile/20141216.000000 submit/tizen_mobile/20141216.073055 submit/tizen_mobile/20141231.012840 submit/tizen_mobile/20151202.000000 tizen_3.0_ivi_release v0.4.2
Lukasz Wojciechowski [Tue, 18 Nov 2014 13:37:36 +0000 (14:37 +0100)]
Release 0.4.2

Change-Id: I98e8bc31f89125fa7dd7a92b9feb7d93e24772c7

10 years agoMake old devel packages names obsolete 44/30444/1
Lukasz Wojciechowski [Tue, 18 Nov 2014 13:29:23 +0000 (14:29 +0100)]
Make old devel packages names obsolete

Merging all devel rpms into single cynara-devel causes
all older devel packages to be obsolete.

Change-Id: I6e10c7c74f58dbf8c5ca676ce817382f2c801752

10 years agoRelease 0.4.1 75/30375/1 submit/tizen/20141117.122553 v0.4.1
Lukasz Wojciechowski [Mon, 17 Nov 2014 10:57:07 +0000 (11:57 +0100)]
Release 0.4.1

Change-Id: I79a7007db3af7e7815547c7ccbca8f23986fab02

10 years agopackaging: make cynara-devel depend on dbus-devel 77/29677/7
Rafal Krypa [Fri, 31 Oct 2014 13:33:16 +0000 (14:33 +0100)]
packaging: make cynara-devel depend on dbus-devel

D-Bus include is being included from cynara-creds-dbus.h. D-Bus headers will
be required for successful compilation against cynara-creds-dbus.

Change-Id: Ib223f7025fe7c49f57741b6dca11f294b927d06e

10 years agopackaging: tame the packaging madness 75/29675/7
Rafal Krypa [Tue, 11 Nov 2014 11:18:42 +0000 (12:18 +0100)]
packaging: tame the packaging madness

Cynara seems to adapt the model of multiple small libraries put in separate
package each. This leads into plethora of small packages.
This commit tries to rationalize this decomposition, merging some of the
packages:
- all development packages are now merged into one cynara-devel
- client, client-async and client-common are merged into one
- storage is merged into libcynara-common

The overall result is decrease in total number of packages from 24 to 12,
not counting auto generated debuginfo and debugsource.

Change-Id: I947e733872a4d5c96c722b207243e3c1cdfe1ba6

10 years agoFix missing directories 69/30369/4
Zofia Abramowska [Mon, 17 Nov 2014 09:29:07 +0000 (10:29 +0100)]
Fix missing directories

Creation of cynara plugins directories was missing during
installation.

Change-Id: I774b831765f71cc034f8d5800dea0032bf2ae2c9

10 years agoChange include brackets 66/30366/3
Lukasz Wojciechowski [Mon, 17 Nov 2014 08:41:30 +0000 (09:41 +0100)]
Change include brackets

Include brackets style of 2 files in credential libraries was changed
from "" to <> , as it is used in other headers.

Change-Id: I1dba20862a53acdccf65d671b15b254310121961
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
10 years agoExpose ClientSession type 65/30365/3
Lukasz Wojciechowski [Mon, 17 Nov 2014 08:38:42 +0000 (09:38 +0100)]
Expose ClientSession type

ClientSession is required by client-plugin mechanism.
Files section for libcynara-commons-devel was enhanced,
so it provides ClientSession.h

Change-Id: Ia0d935bf297bdf1743fd37e5df3a0826ebf446cd
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
10 years agoAdd missing devel package dependency 64/30364/1
Lukasz Wojciechowski [Mon, 17 Nov 2014 08:34:17 +0000 (09:34 +0100)]
Add missing devel package dependency

libcynara-admin-devel package requires cynara-error.h that is provided
by libcynara-client-commons-devel.

Change-Id: Ic6b9203e2dcf80fd0057fa64d906819be69b929d
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
10 years agoFix linking dependencies 62/30362/1
Adam Malinowski [Mon, 17 Nov 2014 07:50:27 +0000 (08:50 +0100)]
Fix linking dependencies

PluginManager was moved from service to common but linking with 'dl'
library stayed in service. This patch moves linking with dl to common.

Change-Id: If1be63e86dfe4c8651b48bbe9facc80160fd9f32

10 years agoRelease 0.4.0 53/30353/1 submit/R4/20141115.054144 submit/tizen/20141115.054313 v0.4.0
Lukasz Wojciechowski [Sat, 15 Nov 2014 04:39:18 +0000 (05:39 +0100)]
Release 0.4.0

Change-Id: Ia8f5a7e623bcbce58f9574c084a6472ea59e271a

10 years agoHandle client and agent disconnection 05/29805/12
Adam Malinowski [Mon, 3 Nov 2014 13:57:13 +0000 (14:57 +0100)]
Handle client and agent disconnection

This patch handles situations where client and/or agent connection
to cynara service is closed.

Change-Id: I410b6da96102b6ae16442e90dbbb1e867490287a

10 years agoHandle agent response 04/29804/11
Adam Malinowski [Mon, 3 Nov 2014 13:53:33 +0000 (14:53 +0100)]
Handle agent response

This patch handles response from agent of both types:
action and cancel.

Change-Id: I3168f4f7466c79bdcb9a3f6b1c3d6863ddcf952c

10 years agoHandle cancel request 03/29803/11
Adam Malinowski [Mon, 3 Nov 2014 13:49:59 +0000 (14:49 +0100)]
Handle cancel request

This patch implements handling cancel request from client.

Change-Id: I2b5537ef8b481f3a3160702d0a549945b8a11622

10 years agoHandle check request with agent usage 02/29802/11
Adam Malinowski [Mon, 3 Nov 2014 13:45:03 +0000 (14:45 +0100)]
Handle check request with agent usage

This patch introduces sending request to agent and storing context
for future.

Change-Id: I8187b4c5e66daa155b485b5ff6b9710de27f6345

10 years agoAdd manager for check contexts 01/29801/10
Adam Malinowski [Mon, 3 Nov 2014 10:21:25 +0000 (11:21 +0100)]
Add manager for check contexts

This class will be used by service logic to create and handle check
contexts.

Change-Id: I8c1f1265336dd8b5a428ed254083d1e508579a2e