Fix startup with half-populated db 52/26552/5
authorAleksander Zdyb <a.zdyb@partner.samsung.com>
Tue, 26 Aug 2014 08:41:33 +0000 (10:41 +0200)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 12 Sep 2014 15:44:04 +0000 (08:44 -0700)
commit1c3bee02b5b66ebd389eec9b4fe35c760c170ec9
tree28810a042c0ea4cb8219c52c44200ddeb3466f94
parent7ca84d1e7ee1845a936c49921c026de4e907336a
Fix startup with half-populated db

In some cases, Cynara could start with half-populated database.
As this is potential security issue, we now make sure, that in case
of any error, Cynara will start with empty database and return DENY
for every request.

There are added tests revealing these potential issues.
Some test cases depend on specific state of Cynara's policy database
directory. These are now provided in cynara-tests package and placed
in /usr/share/cynara/tests/ during installation.
Test execution does not affect real database -- it uses above tests
path only, accessible by non-root users as well.

Signed-off-by: Aleksander Zdyb <a.zdyb@partner.samsung.com>
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
Change-Id: Ia943f77a2a0c85f394c40dd10333a73df4d0c96a
14 files changed:
packaging/cynara.spec
src/common/exceptions/BucketRecordCorruptedException.h
src/service/storage/InMemoryStorageBackend.cpp
test/db/db2/buckets [new file with mode: 0644]
test/db/db3/_ [new file with mode: 0644]
test/db/db3/buckets [new file with mode: 0644]
test/db/db4/_ [new file with mode: 0644]
test/db/db4/_additional [new file with mode: 0644]
test/db/db4/buckets [new file with mode: 0644]
test/db/db5/_ [new file with mode: 0644]
test/db/db5/_additional [new file with mode: 0644]
test/db/db5/buckets [new file with mode: 0644]
test/storage/inmemorystoragebackend/inmemeorystoragebackendfixture.h
test/storage/inmemorystoragebackend/inmemorystoragebackend.cpp