Adrian Szyndela [Thu, 21 Mar 2019 08:23:00 +0000 (09:23 +0100)]
cpp-ify libdbuspolicy1.c
Change-Id: I6f0ef0cb5bf558500020ee715e301f708fffb04d
Adrian Szyndela [Wed, 20 Mar 2019 15:04:30 +0000 (16:04 +0100)]
extract kdbus operations to separate file
Change-Id: Ia33922128de417e5457a0daf5f9757a6f130cfa3
Adrian Szyndela [Wed, 20 Mar 2019 13:43:26 +0000 (14:43 +0100)]
simplify string duplication
Change-Id: Ie228964fcabf0f3fea8225e80ed2cdf82d12119d
Adrian Szyndela [Wed, 20 Mar 2019 13:27:01 +0000 (14:27 +0100)]
kdbus: simplify handling names
Change-Id: I4330f299a7bcf1b2325205ac2dd6b54526a2b8c1
Adrian Szyndela [Wed, 20 Mar 2019 13:05:10 +0000 (14:05 +0100)]
simplify freeing kdbus structs
Change-Id: I483b64423c5beddb62254aebb9d8f3e4ea987c35
sanghyeok.oh [Thu, 28 Mar 2019 06:18:06 +0000 (15:18 +0900)]
serialization: printer: check initialization status
Change-Id: I9a4885a2224402ffac305be3425b48a8e7074153
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
sanghyeok.oh [Thu, 28 Mar 2019 06:11:16 +0000 (15:11 +0900)]
serialization: check max size of serialized file
Change-Id: Ie2e63ff30e7cadf4867cc4c10e1c9e187d408566
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
Mateusz Moscicki [Tue, 19 Mar 2019 13:25:04 +0000 (14:25 +0100)]
Add libdbuspolicy-serializer as requirement
We need dbuspolicyserializer to serialize D-Bus policy configuration
during building the image
Change-Id: Id6ab6331930404553b1306968b85e5a66a289cad
sanghyeok.oh [Mon, 18 Mar 2019 23:52:44 +0000 (08:52 +0900)]
svace fix
Change-Id: I91c4d7f3d65acc2f9c5b9eea9ecdce5663b6eb96
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
Adrian Szyndela [Fri, 15 Mar 2019 14:21:58 +0000 (15:21 +0100)]
internal: use strerror_r instead of strerror
strerror() is thread-unsafe. This replaces usage of strerror()
with usage of strerror_r().
Change-Id: I80d1888c1ec24584c57c68a7b2531084f616342f
Adrian Szyndela [Thu, 14 Mar 2019 09:59:05 +0000 (10:59 +0100)]
serializer: set output name to .serialized
By default libdbuspolicy may expect serialized policy file
in default location, with XML policy file name modified
by adding .serialized suffix.
This changes serializer default behavior to create output files
with the same naming rules instead of using result.dat.
Of course, if a user specifies its own specific output file name,
the serializer still creates output file with the given name.
Change-Id: I5ca0699027013e23fe2d83c5abd80bdebc165b1c
Adrian Szyndela [Wed, 13 Mar 2019 15:22:39 +0000 (16:22 +0100)]
svace: add noexcept to MatchItemSR::addNames
SVACE complains about non-catched out_of_range exception from
boost::string_ref::substr() called by MatchItemSR::addNames().
The code is written in such a way that no exceptions should be trown.
To indicate this, and possibly make SVACE happy, this adds
'noexcept' keyword to addNames().
Change-Id: I5b31cfd201af2267e08587118d2dd54da225d945
Adrian Szyndela [Wed, 13 Mar 2019 14:54:02 +0000 (15:54 +0100)]
Add license headers
Change-Id: I90a104cb4452a7f6e616e90f84bf417d7e05fe6e
Adrian Szyndela [Wed, 13 Mar 2019 14:53:25 +0000 (15:53 +0100)]
spec: enable parallel building
Change-Id: Ia2d1ea4534bf76aab5ba6cd116d79657d7117165
Adrian Szyndela [Mon, 11 Mar 2019 09:54:03 +0000 (10:54 +0100)]
add support for sharing fd and pool with clients
This adds two new API functions, which can be used for sharing
kdbus fd and kdbus pool with the library clients.
Until now, the library created its own connection each time
it was initialized, effectively allocating 1MB of memory
only for getting small responses to one of kdbus ioctls.
This kind of activity may be performed on any usable kdbus
connection. Thus, the idea of sharing existing connections
with libdbuspolicy.
As it is a change of interface (two new API functions), the version
of library and package has been bumped up.
Change-Id: I7bae7a60a386f1c3bc35c88528c9f2baa2c57e34
Mateusz Moscicki [Fri, 8 Mar 2019 09:50:30 +0000 (10:50 +0100)]
refactoring: change logError parameter type
Change-Id: I4fcaf121159d9a503a44e69d281bfd1147b8c5d1
Mateusz Moscicki [Fri, 8 Mar 2019 08:38:59 +0000 (09:38 +0100)]
Check if config_name is NULL or empty
config_name must be provided and case in which it is empty or is NULL is
a programmer error
Change-Id: I21274c8331edd118d672802f06f7bec7ac8ddde8
Adrian Szyndela [Thu, 7 Mar 2019 13:52:54 +0000 (14:52 +0100)]
refactoring: simplify StorageBackendXMLImpl
This simplifies StorageBackendXMLImpl by putting members
into a tuple, and using type_lists to select correct
elements of tuple without any need for type helpers.
Change-Id: Ia93fb9bab03613cebade82f1daa29181b7f178ee
Mateusz Moscicki [Thu, 7 Mar 2019 11:22:36 +0000 (12:22 +0100)]
tests: add -v (verify) command line parameter
Change-Id: Iaf03cab80eecc12839610121786abfb3a1d102c9
Adrian Szyndela [Thu, 7 Mar 2019 11:12:55 +0000 (12:12 +0100)]
Add warning when serialized file is missing
Change-Id: I604b94cad042a5e65275705f7ca6a88b9fbaa9fb
Adrian Szyndela [Thu, 7 Mar 2019 10:44:53 +0000 (11:44 +0100)]
Add design documentation
Change-Id: I123ed895c624fe712d4bd3f6da8f72c820e3a87f
Adrian Szyndela [Thu, 7 Mar 2019 10:34:54 +0000 (11:34 +0100)]
refactoring: change string to ref-to-string in own tree
This changes std::string in construction of TreeNode to reference-to-string
to avoid additional copy of the string.
Change-Id: I49ac9d8e83f8691c022c9113d427bc60c7463902
Adrian Szyndela [Thu, 7 Mar 2019 10:06:55 +0000 (11:06 +0100)]
refactoring: remove unused code
This removes code which is unused after switching backend
from StorageBackendXML to StorageBackendSerialized.
Change-Id: I2326b24f06c7eae050e190e15d8f1c4740a4d29e
Mateusz Moscicki [Thu, 7 Mar 2019 08:17:29 +0000 (09:17 +0100)]
refactoring: remove unused parameters and "using namespace std"
Change-Id: I886c7dfd075fce52bfa5a8d1e7bf6d9aeb301ec9
Adrian Szyndela [Wed, 6 Mar 2019 13:30:30 +0000 (14:30 +0100)]
serialization: switch backend to serialized
Change-Id: I87bf5d7461c168ceb6c2dda034f153060bfe39ee
Adrian Szyndela [Wed, 6 Mar 2019 11:37:50 +0000 (12:37 +0100)]
serialization: add missing method to serialized storage
Change-Id: Ieb56be3dd3f303dca7c851c02757fe6ab5eb64ae
Adrian Szyndela [Tue, 5 Mar 2019 11:37:26 +0000 (12:37 +0100)]
refactoring: merge NaivePolicyDb to NaivePolicyChecker
NaivePolicyDb's role was recently limited to management of group maps,
and passing requests to a backend.
This removes NaivePolicyDb by moving management of group maps to
NaivePolicyChecker and using the backend directly.
Change-Id: Iabbb790c7e18716bb0b99a178e7a26252dcfc41a
Adrian Szyndela [Tue, 5 Mar 2019 10:29:11 +0000 (11:29 +0100)]
refactoring: make two checkers for two buses
This changes NaivePolicyChecker to contain only one database
per object. Thus, we need to have two NaivePolicyCheckers.
It changes relation between NaivePolicyChecker and NaivePolicyDb to
1:1 relation. It will help with removal of NaivePolicyDb.
After this, each bus (session and system) has its own, dedicated checker.
Change-Id: I7b07db0803b001e5a591a090d259666de2f7074b
Mateusz Moscicki [Wed, 6 Mar 2019 10:10:23 +0000 (11:10 +0100)]
Add test to check performance of loading config files
Change-Id: I6354bc17befa330f1b63efc792ab951a9c0ebe39
Mateusz Moscicki [Tue, 5 Mar 2019 14:48:45 +0000 (15:48 +0100)]
Improve getDecisionItem() and match() performance
Change-Id: I117a1d496cb709fc63958e0d826725fb01597daa
Mateusz Moscicki [Tue, 5 Mar 2019 11:14:19 +0000 (12:14 +0100)]
Add flatbuffers vs xml performance test
Change-Id: I0dfc715e8f011cec6e38040914290a79d63d01f3
Mateusz Moscicki [Mon, 4 Mar 2019 14:03:15 +0000 (15:03 +0100)]
Init the logger to read settings from environment variables
Change-Id: I985325bc3d2ee2d589b8c467f6d8d8e92ceb31b5
Mateusz Moscicki [Thu, 28 Feb 2019 13:48:49 +0000 (14:48 +0100)]
serialization: add getDecisionItem tests
Change-Id: Ia97e38b09a410ed8fdf94465ae4af556b646d31b
Mateusz Moscicki [Mon, 4 Mar 2019 09:35:44 +0000 (10:35 +0100)]
Fix flatbuffers reverse_iterator
Change-Id: I77233a416d76198175859c19adccdb41b5ab2ea8
Adrian Szyndela [Fri, 1 Mar 2019 12:46:40 +0000 (13:46 +0100)]
refactoring: hide XmlParser
This disconnects XmlParser from __internal_init() and hides it
behind StorageBackendXML. This way XmlParser is local, non static and
non global anymore, a bit more tightly connected to StorageBackendXML,
but more loosely connected to other components.
Change-Id: I712129dfc9f8da357e7a7d66411aaea3590172e7
Adrian Szyndela [Fri, 1 Mar 2019 12:32:30 +0000 (13:32 +0100)]
refactoring: simplify strings management in XmlParser
File name is passed from external API by const char *.
This (at least partially) eliminates construction of std::string where
it is not needed.
Change-Id: I05375820fe2996cb4f95af5be8bbbab5ecd87fc4
Adrian Szyndela [Fri, 1 Mar 2019 12:14:25 +0000 (13:14 +0100)]
refactoring: make assert more informative
Function parseAssert() showed only that an error occurred.
A macro instead shows also the error condition and line number.
Change-Id: Ibd686286c58b657fd578f92bd4328072aa892933
Adrian Szyndela [Mon, 25 Feb 2019 13:42:33 +0000 (14:42 +0100)]
serialization: extract xml-based db implementation
Change-Id: I84ef422a5451192fe18762c16bc14aa7ed4b9d02
Adrian Szyndela [Mon, 25 Feb 2019 13:04:45 +0000 (14:04 +0100)]
fix uid/gid wording
mapGroups are maps that tie uid with vector of gids. This fixes
misleading wording.
Change-Id: I982e8b474a25da189e16b8871f023e9110787b64
Adrian Szyndela [Fri, 22 Feb 2019 15:49:18 +0000 (16:49 +0100)]
serialization: extract mapGroups from pimpl of DB
Previously, mapGroups were incorporated into PolicySets in pimpl
NaivePolicyDbImpl. But they are in fact not a part of policies.
They are gathered from the system and only filtered through policy data.
This commit extracts mapGroups from pimpl back to NaivePolicyDb,
with some required changes to work with current interfaces, and also with
some not required, but fun changes.
The extraction will allow switching pimpl in the future, keeping the same
groups logic for any pimpl.
Change-Id: I3e1dace93bebb7e19c94cacd7fbf7ceb426d315e
Adrian Szyndela [Fri, 22 Feb 2019 09:51:06 +0000 (10:51 +0100)]
refactoring: PolicyAccess uses common policy base
PolicyAccess works in a very similar way to PolicySend and PolicyReceive,
but it has its own class.
This commit makes common base for all three classes.
Change-Id: I63c89f23a6f65b6e5107c9a17a950b99a6664111
Adrian Szyndela [Thu, 21 Feb 2019 15:03:35 +0000 (16:03 +0100)]
serialization: reworked init for serialized backend
Change-Id: Ie72cf3444dfc7bf446bb6035df6a57d04ae0c180
Adrian Szyndela [Thu, 21 Feb 2019 11:00:33 +0000 (12:00 +0100)]
serialization: implement matching
Change-Id: I2d94b5475939e4ccea92def362fe6cc0b1ec98cf
Adrian Szyndela [Thu, 21 Feb 2019 10:56:44 +0000 (11:56 +0100)]
refactoring: reworked matching
This changes matching.
Previously Items had match() function with MatchItems as params.
Now, MatchItems have generic match() functions for use with both types
of Items (XML-based and serialized).
Therefore, the matching code is the same for both.
Change-Id: I68a90bd3b787c66d72fa30d5fc25e16b0634daa2
Mateusz Moscicki [Tue, 19 Feb 2019 09:42:36 +0000 (10:42 +0100)]
serializer: add tests
Change-Id: Ibd782e92c88f63caa290a33b13a890f54071619b
Adrian Szyndela [Wed, 20 Feb 2019 13:35:07 +0000 (14:35 +0100)]
serialization: add printing tool
This adds dbuspolicyprinter, which takes serialized file as input
and prints it in the same fashion as libdbuspolicy does with XML policy.
Change-Id: I20c8d5af6c97975251cf48bcf94649ef668b9abf
Adrian Szyndela [Wed, 20 Feb 2019 13:34:32 +0000 (14:34 +0100)]
serialization: add storage backend
Change-Id: I1830ff322a8c14557d46f8f353a7b3d34a43d187
Adrian Szyndela [Wed, 20 Feb 2019 09:56:29 +0000 (10:56 +0100)]
serialization: rework printing content
We want to print content from both serialized and XML.
This makes a common base for printing content in the similar way.
Change-Id: If010b8adb1e39e6ada7b08b7949a0b446470160a
Mateusz Moscicki [Fri, 8 Feb 2019 11:44:32 +0000 (12:44 +0100)]
serializer: add dbuspolicyserializer do the spec file
Change-Id: I25616008fd2d4bb43c084deaea79fae0adda0db4
Mateusz Moscicki [Fri, 8 Feb 2019 11:44:02 +0000 (12:44 +0100)]
serialization: add dbuspolicyserializer to Makefile
Change-Id: I9b75dcae61188665f01611f124459f0ec44196cb
Mateusz Moscicki [Thu, 14 Feb 2019 07:04:05 +0000 (08:04 +0100)]
serialization: add serialization class
Change-Id: I8eb5d24012b24830c1f8e671805eb091b1d2c9a1
Mateusz Moscicki [Fri, 8 Feb 2019 11:46:05 +0000 (12:46 +0100)]
serializer: add schema file
Change-Id: I35ab9247800fa2a00d22fb7f44a3390ff4273e3d
Mateusz Moscicki [Fri, 8 Feb 2019 11:45:34 +0000 (12:45 +0100)]
serialization: add Flatbuffers
Change-Id: Iafb4e0840c4b80e894af53c0c50b89cecd0f773c
Mateusz Moscicki [Thu, 14 Feb 2019 07:58:42 +0000 (08:58 +0100)]
serialization: move TreeNode definition and add getters
Change-Id: I40c7bc6c59f29bfc6b35930893aa54eacbab6fb4
Adrian Szyndela [Wed, 13 Feb 2019 14:10:14 +0000 (15:10 +0100)]
serialization: add interface for getting policies
Serialization needs access to stored structures.
This introduces access functions on Db->Policy level.
Change-Id: I46b21886c6026a7f6de4741ba20f3a0f228a6cb1
Adrian Szyndela [Wed, 13 Feb 2019 11:24:49 +0000 (12:24 +0100)]
refactoring: extract Policy containers
Preparing for serialization.
Serialization needs to iterate over db structures. It needs a bit of insight
into the actual types stored.
This extracts Policy container classes from naive_policy_db.cpp.
Change-Id: I51d1ce5c63eef28c58423b0e64ff9f5a2bc5d09c
Hyotaek Shim [Mon, 25 Feb 2019 02:38:51 +0000 (11:38 +0900)]
Apply the highest priority to constructors
__attribute__((constructor(101)))
Change-Id: Ic08c64eb9bae900c6be90c21074e64804e2fabc7
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Adrian Szyndela [Thu, 14 Feb 2019 13:54:32 +0000 (14:54 +0100)]
refactoring: making bus type a type - part 2
This makes bus type a type in one more function in addition to commit 7b3249.
Change-Id: I22a119ffc09b3e111e6409006baba1a05d857a50
Adrian Szyndela [Thu, 14 Feb 2019 12:46:05 +0000 (13:46 +0100)]
refactoring: simplify name string handling in Own
ItemOwn stores names as std::string, but it gives them as const char *.
Then, it is used again as std::string.
This commit removes conversions, by passing const references to std::string
everywhere.
Change-Id: I0d606cecd554e8619848e271e4e1aa48f5dae453
Adrian Szyndela [Thu, 14 Feb 2019 12:00:12 +0000 (13:00 +0100)]
refactoring: simplify privilege string handling
DecisionItem::__privilege is std::string, but it is converted to const char *
and then converted again to std::string.
This removes conversions, passing const reference to std::string and converting
only when necessary.
Change-Id: I86e9a0e91f4c323d743fac6f88349aff37872998
Adrian Szyndela [Wed, 13 Feb 2019 13:19:07 +0000 (14:19 +0100)]
tests: bring back compile-time tests
It appears one-liner 'make all-tests check' does not work the same way
as two lines:
make all-tests
make check
This brings back two lines, because with one line 'make check' is
not executed.
Change-Id: I3f04b72b4421aab74dcc1a70f4146a329db87bfd
Adrian Szyndela [Wed, 13 Feb 2019 09:44:06 +0000 (10:44 +0100)]
refactoring: remove unneeded template param
Since Items got typedef match_type, they are explicitly
tied to their Match counterparts. Therefore, we no longer need
to tie both type categories explicitly in other places.
Change-Id: I63f048787ae857c97b0087ccf091f80401f98ed6
Adrian Szyndela [Wed, 13 Feb 2019 09:24:20 +0000 (10:24 +0100)]
refactoring: remove exec rights from the source code
Change-Id: I99e1c4ada233637ea0810945f866f468ac3dafff
Adrian Szyndela [Tue, 12 Feb 2019 14:20:01 +0000 (15:20 +0100)]
refactoring: move "parse" methods to the "parser"
Change-Id: Ibd543e118e7546d409f1441e4f7de99b964b4d8f
Adrian Szyndela [Tue, 12 Feb 2019 12:12:07 +0000 (13:12 +0100)]
refactoring: remove unnecessary params in parseRule
Removed params policy_type and policy_type_value from
DbAdapter::parsePolicyAttribute() as they are used once and
are references to policy_type and policy_type_value members.
Change-Id: I59850b91fe739cd275d122a3df83ffb988c2cd74
Adrian Szyndela [Thu, 7 Feb 2019 10:43:49 +0000 (11:43 +0100)]
refactoring: templatize addItem
Change-Id: I40429772c49a74e5d7b3420c72882e3bd8c0a12f
Adrian Szyndela [Wed, 6 Feb 2019 10:28:07 +0000 (11:28 +0100)]
refactoring: make bus type a type instead of bool
Change-Id: Idadba8b5d9aa5cb7b801be89b08699c53767905f
Adrian Szyndela [Fri, 1 Feb 2019 08:27:34 +0000 (09:27 +0100)]
refactoring: remove duplicate db access method
This removes duplicated db access method from naive_policy_checker.
Additionally, friend declaration is removed for DbAdapter,
the access method made public, and code that uses removed method is reworked.
Change-Id: Ifac510e13ba0001390c25d5584c7500c89d665be
Adrian Szyndela [Wed, 6 Feb 2019 07:39:37 +0000 (08:39 +0100)]
refactoring: make pimpl in naive_policy_db
naive_policy_db got a bit bloated, including several internal classes etc.
To clean things up this introduces impl pattern, moving all the private
stuff into implementation file, leaving only public nonvirtual interface.
Change-Id: I32dd22bd219826994a2f52baa12aa64649ac0af2
Adrian Szyndela [Tue, 5 Feb 2019 16:27:43 +0000 (17:27 +0100)]
refactoring: remove user and group from access PolicySet
Additionally, this adds specialized method for getting different
policies to get rid of artificial parameterization with PolicyType
and PolicyTypeValue.
Change-Id: Ib22191aafc8d2823cb52af9b5e61ccf31d207acf
Adrian Szyndela [Tue, 5 Feb 2019 15:09:40 +0000 (16:09 +0100)]
refactoring: simplify PolicySet
This splits artificial context array into separate contextMandatory
and contextDefault.
Change-Id: I05a0b3a66d2f3370f73b6b4992de4a911db331f4
Adrian Szyndela [Tue, 5 Feb 2019 14:53:06 +0000 (15:53 +0100)]
refactoring: prepare for PolicySet customization
PolicySets are composed of context, user, and group policies.
However, PolicySet for PolicyAccess does not need user and group
policies.
This commit prepares base classes for PolicySets that will allow
handy customization of behaviour and composition.
Change-Id: Idde9daf06e2caa2975d899b99f091ece49b66113
Adrian Szyndela [Tue, 5 Feb 2019 13:17:09 +0000 (14:17 +0100)]
refactoring: templatize NaivePolicyChecker::check
This converts check() methods for MatchItemOwn, MatchItemSend and
MatchItemReceive to single template method.
The MatchItemAccess check() method stays in place as it requires
different params.
Change-Id: Ibbc2c0498bb9289f6dbce5ffd3206abf93115d17
Adrian Szyndela [Tue, 5 Feb 2019 12:57:15 +0000 (13:57 +0100)]
refactoring: eliminate NaivePolicyDb::getPolicy()
Change-Id: I4378947432a01974f27ebf115e785556e52155d5
Adrian Szyndela [Tue, 5 Feb 2019 12:20:08 +0000 (13:20 +0100)]
refactoring: simplify NaivePolicyDb::getGroups
It affects dependencies, which mostly lose unnecessary ItemType
parameter.
Change-Id: I32056de6f2c8edf389909cd816a0de656b4f3830
Adrian Szyndela [Tue, 5 Feb 2019 11:05:53 +0000 (12:05 +0100)]
refactoring: eliminate template params in getDecisionItem
Affects dependencies, which also lost unnecessary params.
Policy classes can be now private, it allows single private
and single public section in NaivePolicyDb.
Change-Id: I5f01d2e43f2ffd3f58ef2aa76b1cd06d83365b7b
Adrian Szyndela [Tue, 5 Feb 2019 10:37:12 +0000 (11:37 +0100)]
refactoring: simplify NaivePolicyDb::getPolicy()
Change-Id: I3be0a3682dd7be9510a0145d16cd3b750ee129c9
Adrian Szyndela [Tue, 5 Feb 2019 10:13:37 +0000 (11:13 +0100)]
refactoring: make Policy classes more private
Change-Id: If2724b9f8de024da28e04710a81ba8435dcdf515
Adrian Szyndela [Tue, 5 Feb 2019 09:20:26 +0000 (10:20 +0100)]
refactoring: group methods from same classes
Change-Id: Id6f8124fc7b5423ee4b9922b017f153b99b249b4
Adrian Szyndela [Mon, 4 Feb 2019 15:25:11 +0000 (16:25 +0100)]
refactoring: make own_tree more const-correct
Change-Id: I4c6f7cb72f743e597f6fa295cb4731e01cfcda55
Adrian Szyndela [Mon, 4 Feb 2019 15:06:33 +0000 (16:06 +0100)]
refactoring: make parsing lazy
We don't need to reset all the potential items on every rule.
This commit resets items on first encounter of given type.
Change-Id: I9bd1abe38516c188dd295697109bfe1a337eaf0b
Adrian Szyndela [Mon, 4 Feb 2019 14:20:47 +0000 (15:20 +0100)]
refactoring: get rid of unnecessary MessageDirection
Things done to accomplish removing MessageDirection:
- used ItemSend/ItemReceive instead of ItemSendReceive
- used MatchItemSend/MatchItemReceive instead of MatchItemSR
- used PolicySend/PolicyReceive instead of PolicySR
- database no longer contains pointers
Change-Id: I1c5957dad2181a6c1c42dee0e77be3e8b0ccc471
Adrian Szyndela [Mon, 4 Feb 2019 11:56:49 +0000 (12:56 +0100)]
refactoring: introduce Send/Receive split types
This will help with getting rid of some unnecessary switches/ifs and types.
Change-Id: I784e133063c78f2b14ee50c81d526253ec173f0c
Adrian Szyndela [Mon, 4 Feb 2019 11:31:30 +0000 (12:31 +0100)]
refactoring: move addItem() declarations
This is a move towards making single public and single private
section in NaivePolicyDb.
Change-Id: Ib300da409a4442b1578f3a48ae888c1982de24fa
Adrian Szyndela [Mon, 4 Feb 2019 11:09:25 +0000 (12:09 +0100)]
refactoring: group maps moved into Policies
Change-Id: I5def57a4ed74a2a72ab76a527091c4e56d5c1b67
Adrian Szyndela [Mon, 4 Feb 2019 09:12:47 +0000 (10:12 +0100)]
refactoring: make common interface for Policy classes
Change-Id: I02efdddbafcce4bbbd8e7f7630cececaa1b362ed
Adrian Szyndela [Mon, 4 Feb 2019 08:00:53 +0000 (09:00 +0100)]
refactoring: move PolicySet methods into proper class
Change-Id: Ia9c72791fd592017ac3e0284f1e72f753f398f10
Adrian Szyndela [Fri, 1 Feb 2019 15:11:29 +0000 (16:11 +0100)]
refactoring: introduce MatchItemOwn for matching
Change-Id: I0c01db965a1b4d61cea0ac7f0b825d93cb331ed9
Adrian Szyndela [Fri, 1 Feb 2019 14:54:47 +0000 (15:54 +0100)]
refactoring: remove params from ItemSendReceive()
Params for ItemSendReceive are never used.
Change-Id: I0c4c6bbaf68a4f65472267b3498c14f335561d12
Adrian Szyndela [Fri, 1 Feb 2019 14:29:14 +0000 (15:29 +0100)]
refactoring: replace char* with C++ strings
Change-Id: I2554b13d0d00ed1b8ce5dbdfba7cb5f9cb6db6c7
Adrian Szyndela [Fri, 1 Feb 2019 11:10:29 +0000 (12:10 +0100)]
refactoring: replaced snprintf with to_string
Moved string conversion to cynara.cpp.
Eliminated snprintf, char array in favor of single call to to_string().
Reworked ifs to switch.
Change-Id: Ib57f459183328f55a16412af84214e77f7750f58
Adrian Szyndela [Fri, 8 Feb 2019 14:43:49 +0000 (15:43 +0100)]
tests: make tests passing again
Do not confuse with 'make tests great again'.
But at least they should work and give results now.
Change-Id: I7f0c69f329e7ef1a1813c23eb51387494c717226
Adrian Szyndela [Thu, 7 Feb 2019 12:50:16 +0000 (13:50 +0100)]
tests: build tests in a single build
Spec file makes two builds: one with --enable-tests, and second
without tests. This was used to add a special function for changing
creds and checking config file.
This commit exports the behaviour which is different in both versions
to separate files and uses those files for linking with proper versions.
It also makes the special function not exported anymore, as it is not needed
for static linking with test programs.
Change-Id: I72cc44e35c17da85e73ac503bbd447a4ee24e6cc
Adrian Szyndela [Fri, 8 Feb 2019 07:58:44 +0000 (08:58 +0100)]
internal: fix mistaken getgid()->getuid()
Change-Id: I97a0514e779c3a5efc3e0dc1aae3e770d8769102
sanghyeok.oh [Mon, 28 Jan 2019 07:22:33 +0000 (16:22 +0900)]
svace fix
Change-Id: I33fb1fc35dd8f8edb6dc13545868120528a3885a
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
Adrian Szyndela [Wed, 23 Jan 2019 14:45:38 +0000 (15:45 +0100)]
internal: make logs less cluttering
Many logs are under an if-clause, making them take more space
than necessary. This replaces most of if-clause-and-logs
with one-liners to improve readability.
Change-Id: I7e9ada35160974c8cc38de1c6e0217de15912c6e
Adrian Szyndela [Wed, 23 Jan 2019 10:37:22 +0000 (11:37 +0100)]
internal: replaced manual reverse iterator with STL-provided
PolicyConstIterator's purpose is identical to vector::const_reverse_iterator
from vector. This removes the unnecessary code, replacing it with
the usage of vector::const_reverse_iterator.
Change-Id: Ib3063eb6eb2a4fd23f8da8a2cce75c808abb3c00
Adrian Szyndela [Tue, 22 Jan 2019 14:37:34 +0000 (15:37 +0100)]
internal: make debug logs small to be more readable
The logs take relatively large space within actual source code.
This makes them smaller to help with avoiding distraction.
Change-Id: Iafca91f5e30f4446e28215cafbf78325ac9287bd
Adrian Szyndela [Fri, 18 Jan 2019 11:36:18 +0000 (12:36 +0100)]
internal: make nondestructible global static_parser
This should help with destructing global variable
while using it in other thread.
Multi-threaded daemons often kill the main thread before killing the other threads.
This patch prevents instance memory release when the main thread exits.
, and thus required to avoid crash on released memory.
.#0 ldp_xml_parser::ItemBuilder::~ItemBuilder (this=0xb67a980c <ldp_xml_parser::static_parser>, __in_chrg=<optimized out>) at src/internal/policy.cpp:510
.#1 0xb67a5de8 in ldp_xml_parser::XmlParser::~XmlParser (this=0xb67a980c <ldp_xml_parser::static_parser>, __in_chrg=<optimized out>) at /usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/include/c++/ext/new_allocator.h:110
.#2 0xb695806c in __cxa_finalize (d=0xb67a9438) at cxa_finalize.c:83
.#3 0xb679bcea in __do_global_dtors_aux () from /lib/libdbuspolicy1.so.1
.#4 0xb6fdfa1c in _dl_fini () at dl-fini.c:235
.#5 0xb6957a44 in __run_exit_handlers (status=<optimized out>, listp=<optimized out>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:106
.#6 0xb6957b6c in __GI_exit (status=<optimized out>) at exit.c:137
.#7 0xb6940640 in __libc_start_main (main=0xbefffe44, argc=-
1230635008, argv=0xb6940640 <__libc_start_main+280>, init=<optimized out>, fini=0x7f55f69c <__libc_csu_fini>, rtld_fini=0xb6fdf7e4 <_dl_fini>, stack_end=0xbefffe44)
. at libc-start.c:323
.#8 0x7f5589e0 in _start () at ../sysdeps/arm/start.S:110
Change-Id: I0cc0a2623eee688b0498fccacb8a2bc219fd3a94
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
Adrian Szyndela [Fri, 7 Dec 2018 12:54:36 +0000 (13:54 +0100)]
tests for send_destination_prefix
Change-Id: Ic7943971b11eeae8dae55ccd50b884beb84dba0a