platform/core/system/libdbuspolicy.git
5 years agosrc: fix non-linking with some compilers/linkers 44/213544/1 accepted/tizen/unified/20190909.050752 submit/tizen/20190906.120330
Adrian Szyndela [Fri, 6 Sep 2019 11:06:31 +0000 (13:06 +0200)]
src: fix non-linking with some compilers/linkers

We got a report that the library does not link within some
environments, giving messages like:

 undefined reference to `BusPathResolver::KDBUS_SYSTEM_BUS_PATH'

This is due to missing definition of static constexpr fields.
It is not necessary to give such definition when a field is initialized
inline since C++17, but this is compiled with C++11.

This commit adds definition of static constexpr fields.

Change-Id: Ia354f0e1aa5f1051571bf328fc654627f69c5dbd

5 years agoprinter: fix 'v' argument 45/213245/1
Adrian Szyndela [Tue, 3 Sep 2019 08:11:22 +0000 (10:11 +0200)]
printer: fix 'v' argument

':' in getopt list means that the option requires an argument.
'v' option does not require argument.

Change-Id: I63052b80e8ed9cc6df93524b7052f8f1c77a8773

5 years agocoverity fix 59/212759/1 accepted/tizen/unified/20190828.011000 submit/tizen/20190827.083850
sanghyeok.oh [Mon, 26 Aug 2019 11:53:10 +0000 (20:53 +0900)]
coverity fix

Change-Id: I124109dfd923f30471c2a0799fa5774f29ee091c
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agoMerge "dbuspolicy-printer: add xml format" into tizen
Hyotaek Shim [Tue, 6 Aug 2019 01:59:03 +0000 (01:59 +0000)]
Merge "dbuspolicy-printer: add xml format" into tizen

5 years agoMerge "dbuspolicy-printer: fix segfault due to invalid input" into tizen
Hyotaek Shim [Tue, 6 Aug 2019 01:58:57 +0000 (01:58 +0000)]
Merge "dbuspolicy-printer: fix segfault due to invalid input" into tizen

5 years agodbuspolicy-printer: add xml format 64/211164/2
sanghyeok.oh [Tue, 30 Jul 2019 13:01:33 +0000 (22:01 +0900)]
dbuspolicy-printer: add xml format

Change-Id: I67cc1f29fb8e4f2fded530dea7719c46f74c0568
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agodbuspolicy-printer: fix segfault due to invalid input 28/211128/1
sanghyeok.oh [Tue, 30 Jul 2019 08:06:38 +0000 (17:06 +0900)]
dbuspolicy-printer: fix segfault due to invalid input

-i opt expecting serialized file.

Change-Id: I31bde3750deaa43c8148f2469e74a52e7ef4ba15
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agoMigrate to openssl 1.1 86/210386/2 accepted/tizen/unified/20190801.113500 submit/tizen/20190730.065826 submit/tizen/20190731.065916
Dariusz Michaluk [Thu, 18 Jul 2019 12:43:33 +0000 (14:43 +0200)]
Migrate to openssl 1.1

Change-Id: I07c62e6cf0e0fd9173a5d92b40b4b34756f05861

5 years agochange 'constructor with 1 argument' to explicit constructor 99/210199/1 accepted/tizen/unified/20190724.063739 submit/tizen/20190722.121816
sanghyeok.oh [Wed, 17 Jul 2019 00:19:21 +0000 (09:19 +0900)]
change 'constructor with 1 argument' to explicit constructor

* implicit conversion
The compiler is allowed to make one implicit conversion to resolve the parameters to a function.
What this means is that the compiler can use constructors callable with a single parameter to convert from one type to another in order to get the right type for a parameter.

Change-Id: I79da863d9d86d3ea19e43089f2c836d2f52ef6d8
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agoFix a dangling pointer / needless copy 45/209645/2
Michal Bloch [Tue, 9 Jul 2019 12:53:34 +0000 (14:53 +0200)]
Fix a dangling pointer / needless copy

Change-Id: I388462ea3d8949f7512228e1b65e4c9ccbc25bdb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agoAdd a missing whitespace 47/209547/1
Michal Bloch [Mon, 8 Jul 2019 13:48:31 +0000 (15:48 +0200)]
Add a missing whitespace

"allowown" -> "allow own"

Change-Id: Ied47493a5a678a13b34be421a573a7bed52b62bb
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
5 years agointernal: add send index 22/208522/4 accepted/tizen/unified/20190627.014814 submit/tizen/20190626.110347
Adrian Szyndela [Wed, 29 May 2019 14:17:49 +0000 (16:17 +0200)]
internal: add send index

This adds indexes:
- main index for send rules;
- additional index for send prefix rules;
- indexes for send rules for each user;
- additional indexes for send prefix rules for each user.

Change-Id: I45a4b3625fe67a9fff7525d04ae6ebf8879e14f1

5 years agorefactoring: remove unnecessary includes 23/208523/3
Adrian Szyndela [Tue, 25 Jun 2019 11:39:29 +0000 (13:39 +0200)]
refactoring: remove unnecessary includes

Change-Id: I07f76694014d24d89964b95d834d10b4b3f8b38b

5 years agonew printing pattern 32/208132/6
Baumann [Tue, 18 Jun 2019 10:39:13 +0000 (12:39 +0200)]
new printing pattern

Change-Id: Ifb3f31c44ba845a35490f26d63e74f05cb8c6658

5 years agodbuspolicy-finder documentation 28/207728/11
Baumann [Tue, 11 Jun 2019 14:18:14 +0000 (16:18 +0200)]
dbuspolicy-finder documentation

Change-Id: Ia6617d124a4e4da8a1377eefba2b70b971b65c23

5 years agoadded policy rejected message as input 50/207650/12
Baumann [Thu, 30 May 2019 14:41:19 +0000 (16:41 +0200)]
added policy rejected message as input

Change-Id: I15f921221f02d9d8d72097d93aa54f92f91895c0

5 years agoadded dbuspolicy-finder utility 42/205142/29
Baumann [Mon, 8 Apr 2019 17:19:37 +0000 (19:19 +0200)]
added dbuspolicy-finder utility

It shows filters policies and possible privilege combinations.

Change-Id: Ia4078eb76a7fde3fc457280a08189208089464d2

5 years agofix maybe-uninitialized error in serializer.cpp 88/208488/2
Himanshu Maithani [Tue, 25 Jun 2019 05:35:11 +0000 (11:05 +0530)]
fix maybe-uninitialized error in serializer.cpp

Function Serializer::serialize(const std::string config_path, size_t &size) can
return nullptr in case of error, thus leaving size to be uninitialized.

[   50s] src/internal/serializer.cpp: In member function 'serialize':
[   50s] src/internal/serializer.cpp:133:50: error: 'size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
[   50s]   output.write(reinterpret_cast<char *>(buf), size);
[   50s]                                                   ^
[   50s] src/internal/serializer.cpp:130:9: note: 'size' was declared here
[   50s]   size_t size

Change-Id: If8b2c735e6b01e73b592827b937e0dfe8f94a615
Signed-off-by: Himanshu Maithani <himanshu.m@samsung.com>
5 years agoChange the config value of the "RemainAfterExit=" ("true" -> "yes") 37/208537/2
INSUN PYO [Wed, 26 Jun 2019 00:21:53 +0000 (09:21 +0900)]
Change the config value of the "RemainAfterExit=" ("true" -> "yes")

Change-Id: I969b67e81bb7db736d1db7a566cb361bbb281a1a

5 years agobugfix: LOGE messed with errno 25/207225/4
Adrian Szyndela [Thu, 30 May 2019 10:37:53 +0000 (12:37 +0200)]
bugfix: LOGE messed with errno

Change-Id: I626c8e4e809791e5a0050a3096b392336f85cc60

5 years agorefactoring: make less dependencies 24/207224/4
Adrian Szyndela [Thu, 30 May 2019 09:42:34 +0000 (11:42 +0200)]
refactoring: make less dependencies

Change-Id: I8ec4031716f0a089e62ca0cae6fe1bfc3f5e9529

5 years agotests: add 'worst case' performance test 23/207223/2
Adrian Szyndela [Wed, 29 May 2019 09:38:33 +0000 (11:38 +0200)]
tests: add 'worst case' performance test

Change-Id: I4d14eeb5bea1e7054674793ebd8d0861c876eb59

5 years agotests: add missing deny for build-time tests 34/206834/3
Adrian Szyndela [Mon, 27 May 2019 13:56:54 +0000 (15:56 +0200)]
tests: add missing deny for build-time tests

Previous commit somehow didn't get additional deny, which
is needed for passing build-time tests.

Change-Id: Id29a11a14e6f2b586d1cab58fd8b27ef576cf713

5 years agoMerge "extracted helper functions to a separate header" into tizen
Adrian Szyndela [Tue, 28 May 2019 08:53:14 +0000 (08:53 +0000)]
Merge "extracted helper functions to a separate header" into tizen

5 years agoMerge "Makefile now conforms to libtool naming standard" into tizen
Adrian Szyndela [Tue, 28 May 2019 08:44:03 +0000 (08:44 +0000)]
Merge "Makefile now conforms to libtool naming standard" into tizen

5 years agoextracted helper functions to a separate header 00/206500/3
Baumann [Mon, 20 May 2019 15:05:06 +0000 (17:05 +0200)]
extracted helper functions to a separate header

Change-Id: I777b45cf0166611e215bf38c275b62db777dd9dd

5 years agotests: make denying method calls narrower 16/206416/1
Adrian Szyndela [Fri, 17 May 2019 11:07:18 +0000 (13:07 +0200)]
tests: make denying method calls narrower

After commit 329ae0e41 the cynara test stopped working. It was due to
different order of reading configuration files, as method.tests.conf
denied all the method calls.

This makes method.tests.conf deny only method calls to org.test.*, which
covers all destinations defined in the file.

Change-Id: I9a181bb184d41af83585c000b458fb9edd78cfb9

5 years agointernal bugfix: handle no-interface messages 36/206336/4
Adrian Szyndela [Thu, 16 May 2019 12:39:20 +0000 (14:39 +0200)]
internal bugfix: handle no-interface messages

No-interface messages should be handled in a special way.
Dbus says in bus/policy.c:

 The interface is optional in messages. For allow rules, if the message
 has no interface we want to skip the rule (and thus not allow);
 for deny rules, if the message has no interface we want to use the
 rule (and thus deny).

For example, a rule of type:
 <deny send_type="method_call" send_interface="foo.bar"/>
should:
- deny method_calls with foo.bar interface;
- deny method_calls with no interface.
A rule of type:
 <allow send_type="method_call" send_interface="foo.bar"/>
should:
- allow method_calls with foo.bar interface;
- not allow method_calls with not interface (the rule should be ignored).

The point is to make libdbuspolicy work as close as possible to how
dbus-daemon works with policies.

Change-Id: I99563d3728047a67fa4719948719a2df9c5d9f97

5 years agoMakefile now conforms to libtool naming standard 49/206249/2
Baumann [Wed, 15 May 2019 10:46:46 +0000 (12:46 +0200)]
Makefile now conforms to libtool naming standard

Change-Id: I61f5d06ca5aeb5aa63875cc087c438b6b93ecc9a

5 years agoadd missing PolicyOwn::ItemType 79/205479/3
Baumann [Mon, 6 May 2019 14:28:48 +0000 (16:28 +0200)]
add missing PolicyOwn::ItemType

Change-Id: I04fc8c0a51d3ff717834f9985acd883800be074e

5 years agoserializer: define order of including files in includedir 77/205477/1
Adrian Szyndela [Mon, 6 May 2019 11:03:09 +0000 (13:03 +0200)]
serializer: define order of including files in includedir

In the reference documentation <includedir> has an undefined
order of including files from a directory.

This makes the order unoficially and implicitly defined to make
generated serialized files equal for the same set of files.
It does not mean that users may now rely on it.

The order is alphabetical.

Change-Id: I07fd137e6a9646a541387bb0ef205edfc012f5f9

5 years agoserialization: file version verification 76/205476/1
Adrian Szyndela [Mon, 6 May 2019 11:57:56 +0000 (13:57 +0200)]
serialization: file version verification

This adds flatbuffers file identifier and uses it during
verification.

Change-Id: I2d49607d8c5ca0b9678e9bc68a9dc6201ef4c7b5

5 years agoserializer: add SHA1 and FlatBuffers verification 38/205238/1
Adrian Szyndela [Tue, 30 Apr 2019 13:07:21 +0000 (15:07 +0200)]
serializer: add SHA1 and FlatBuffers verification

Change-Id: I8c78971f8b6481d1cd00c54dce7b2f0466f1ce61

5 years agotizen: Add new package to perform data verification on boot 90/204590/6
Karol Lewandowski [Wed, 24 Apr 2019 12:10:05 +0000 (14:10 +0200)]
tizen: Add new package to perform data verification on boot

emergency.target is started on verification failure.

Change-Id: I5c67e624d76440f9667602930aecb5adff233ecc

5 years agoserialization: change tool name 13/205213/3 accepted/tizen/unified/20190502.051437 submit/tizen/20190430.084305
sanghyeok.oh [Tue, 30 Apr 2019 07:50:05 +0000 (16:50 +0900)]
serialization: change tool name

For readability and easy typing

dbuspolicyserializer > dbuspolicy-serializer
dbuspolicyprinter > dbuspolicy-printer

Change-Id: I3a416805d66f31c16465a3a2854ceda15d783e9f
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agoMerge "serializer: add option for checking for updates" into tizen accepted/tizen/unified/20190424.040758 submit/tizen/20190423.100702
Hyotaek Shim [Tue, 23 Apr 2019 04:52:53 +0000 (04:52 +0000)]
Merge "serializer: add option for checking for updates" into tizen

5 years agoserialization: make input consistency between printer and serializer 31/203931/4
sanghyeok.oh [Thu, 18 Apr 2019 07:00:22 +0000 (16:00 +0900)]
serialization: make input consistency between printer and serializer

Change-Id: I7ef136fde2a3b7cdd3cf117ccdc32fc5e0dce52c
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agoserialization: printer: change log level from silent to default 30/203930/4
sanghyeok.oh [Thu, 18 Apr 2019 06:59:45 +0000 (15:59 +0900)]
serialization: printer: change log level from silent to default

Change-Id: I294e9b3f202002922ed266504ab99ff048ddb94c
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agoxml_parser: modified log to print out filename 29/203929/3
sanghyeok.oh [Thu, 18 Apr 2019 06:59:07 +0000 (15:59 +0900)]
xml_parser: modified log to print out filename

Change-Id: I63510b0b15e21aa8d583b98cb29b18d08bada5ab
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agotslog: change name log to log_debug 28/203928/4
sanghyeok.oh [Thu, 18 Apr 2019 06:58:35 +0000 (15:58 +0900)]
tslog: change name log to log_debug

Change-Id: Ib362f0cd385298a20443f90f9d4b78bcad84a8cc
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agotslog: modified to support log level 27/203927/6
sanghyeok.oh [Thu, 18 Apr 2019 06:57:49 +0000 (15:57 +0900)]
tslog: modified to support log level

Change-Id: I9f5a4b9cae82737db6037ce56cf7b75bf8e8af0a
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
5 years agoserializer: add option for checking for updates 26/203526/2
Adrian Szyndela [Mon, 15 Apr 2019 11:47:37 +0000 (13:47 +0200)]
serializer: add option for checking for updates

Developers may need to check if they already updated their
serialized policy file. This adds -j option which does not write
anything to the output file, but rather just checks if the generated
file would have the same contents as an existing output file.

Change-Id: I28ab3e992416d25c04206279275f007c0ca08919

5 years agorefactoring: group helper functions into a namespace 04/203204/5
Adrian Szyndela [Wed, 10 Apr 2019 14:04:52 +0000 (16:04 +0200)]
refactoring: group helper functions into a namespace

This groups helper functions into an anonymous namespace.

Change-Id: I1bf32e719f4268886014757a1423ef2c24b4c242

5 years agorefactoring: group path resolving ops into a class 03/203203/5
Adrian Szyndela [Wed, 10 Apr 2019 14:04:13 +0000 (16:04 +0200)]
refactoring: group path resolving ops into a class

This introduces BusPathResolver class.

Change-Id: I56d22e0b6b5e565415b1ff6d070986efa97c7502

5 years agorefactoring: group kconn ops into a class 06/203206/4
Adrian Szyndela [Wed, 10 Apr 2019 14:25:24 +0000 (16:25 +0200)]
refactoring: group kconn ops into a class

This moves functions dealing with kconn into the kconn class.

Change-Id: I27422ae661071ec33d27bced8b2954ea744d16d0

5 years agorefactoring: group checker functions into a class 05/203205/4
Adrian Szyndela [Wed, 10 Apr 2019 14:22:21 +0000 (16:22 +0200)]
refactoring: group checker functions into a class

This introduces local Checker class that helps with initializing
and selecting NaivePolicyChecker instances.

Change-Id: Ia859e63903b4ea173fe4cae5de9cfadc1aa94d4a

5 years agorefactoring: group g_udesc operations into a struct 01/203201/4
Adrian Szyndela [Wed, 10 Apr 2019 13:02:42 +0000 (15:02 +0200)]
refactoring: group g_udesc operations into a struct

Change-Id: I474a61e811cb7eb316ad8b57c298b8730f74eb25

5 years agorefactoring: getNames() -> prepareNames() 00/203200/4
Adrian Szyndela [Wed, 10 Apr 2019 12:37:33 +0000 (14:37 +0200)]
refactoring: getNames() -> prepareNames()

prepareNames() is more proper name for the function as it
prepares an array of names in the KdbusConnectionInfo object,
it does not return them.

Change-Id: I9f86ae80c138a2371456c86543757e962d23e25a

5 years agorefactoring: use checker directly instead BusType in configuration 04/202904/6
Adrian Szyndela [Fri, 5 Apr 2019 11:20:59 +0000 (13:20 +0200)]
refactoring: use checker directly instead BusType in configuration

This makes configuration use pointer to checker in place of previously
used BusType. This way on queries, the object is used throught the pointer
instead of selecting correct checker with yet another 'if' clause.

Change-Id: I79f129be899ff501a01ff1fbf1a95c5d194e3abf

5 years agorefactoring: make BusType a local type 03/202903/6
Adrian Szyndela [Fri, 5 Apr 2019 10:47:19 +0000 (12:47 +0200)]
refactoring: make BusType a local type

BusType does not need to be a global type, because in fact
it is needed only to choose a correct policy checker.

In the test cases, or in the command line tools we explicitly know
which checker we need to choose.

Thus, it is only required for the API, where we still keep it
in the configuration.

This will allow further simplifications.

Change-Id: I61663d496279b47a6a0338b93434b5ae42326f33

5 years agorefactoring: remove the remains of internal.cpp 02/202902/6
Adrian Szyndela [Fri, 5 Apr 2019 10:20:30 +0000 (12:20 +0200)]
refactoring: remove the remains of internal.cpp

This removes the remains of internal.cpp by replacing all __internal_init
functions with more direct calls.

This allows removing of internal.cpp.

Change-Id: I064d919d06a25888cae6079bf9d37cd535f9b8b6

5 years agorefactoring: remove tslog-related functions from "internal" 01/202901/5
Adrian Szyndela [Fri, 5 Apr 2019 09:32:44 +0000 (11:32 +0200)]
refactoring: remove tslog-related functions from "internal"

This removes tslog-related functions from internal.{cpp,h}.
Needed functionality is moved to tslog, the rest is eliminated,
as obsolete.

Additionally, RAII object LogLock is provided to make it look
prettier in places where transaction_guard for __internal_enter and
__internal_exit was used.

Change-Id: I48e5b9c5bf352eb03c50b2a4b4c109c2df0c11bc

5 years agorefactoring: eliminate __internal_init_sup_group() 00/202900/3
Adrian Szyndela [Fri, 5 Apr 2019 08:51:30 +0000 (10:51 +0200)]
refactoring: eliminate __internal_init_sup_group()

This removes __internal_init_sup_group(), which no longer serves
as anything more than a useless proxy.

Change-Id: Ie460c9f2b71413235e7141ec84b5112be27e0f5b

5 years agorefactoring: clean up tests (a bit) 99/202899/3
Adrian Szyndela [Thu, 4 Apr 2019 14:15:52 +0000 (16:15 +0200)]
refactoring: clean up tests (a bit)

This uses more understandable expected results of checking, like ALLOW or DENY
instead of true or false.

Aimed to increase readability.

Change-Id: I48be2de6005812778463be537ea3fa475256f91f

5 years agorefactoring: eliminate __internal_can_* functions 98/202898/3
Adrian Szyndela [Thu, 4 Apr 2019 13:39:48 +0000 (15:39 +0200)]
refactoring: eliminate __internal_can_* functions

This removes __internal_can_* functions as they do not really
do anything useful anymore...

And, as always, it allows further simplifications.

Change-Id: Id30db12afbf8d60dce87c23355c41cff0d907d05

5 years agorefactoring: don't copy string_refs for matching 97/202897/3
Adrian Szyndela [Thu, 4 Apr 2019 09:42:37 +0000 (11:42 +0200)]
refactoring: don't copy string_refs for matching

This modifies MatchItemSR to use externally built array of names instead of
copying input arrays. The external array was built anyway in case
names were taken from KDBUS_CMD_CONN_INFO ioctl.

The other case, where the array is built from space separated string is
changed in a way that the building process is performed outside of
MatchItemSR. This allows further simplifications.

Change-Id: I13cfba0940f3347be91c9281614a3c66b8cb11b6

5 years agorefactoring: reorder includes 53/202753/5
Agnieszka Baumann [Wed, 3 Apr 2019 16:46:33 +0000 (18:46 +0200)]
refactoring: reorder includes

Makes it easier to spot duplicated includes

Change-Id: I6f0ef0cd5bf558500020ee715e301f708fffb04d

5 years agointroduce KdbusConnection and KdbusConnectionInfo classes 55/202555/6
Adrian Szyndela [Fri, 29 Mar 2019 15:27:51 +0000 (16:27 +0100)]
introduce KdbusConnection and KdbusConnectionInfo classes

Change-Id: Ie9b80624f6f6d09e08338ed68e23657f5dc33480

5 years agorefactoring: simplify getting conf file names 54/202554/6
Adrian Szyndela [Fri, 29 Mar 2019 15:24:12 +0000 (16:24 +0100)]
refactoring: simplify getting conf file names

Change-Id: Ib452c4c11480ab388c69296d6e220ac725e83ee0

5 years agorefactoring: extract function getting bus owner from path 53/202553/6
Adrian Szyndela [Fri, 29 Mar 2019 15:15:43 +0000 (16:15 +0100)]
refactoring: extract function getting bus owner from path

Change-Id: I967484c5149f8eda1220e4e2045deb54ad84a4ab

5 years agokdbus: free cmd earlier while doing hello() 52/202552/6
Adrian Szyndela [Fri, 29 Mar 2019 15:12:43 +0000 (16:12 +0100)]
kdbus: free cmd earlier while doing hello()

Change-Id: I1b22db1d9296277de188d9e21e790390a24e7627

5 years agorefactoring: remove 'struct's 51/202551/6
Adrian Szyndela [Fri, 29 Mar 2019 15:12:19 +0000 (16:12 +0100)]
refactoring: remove 'struct's

Change-Id: I38349fb759a1a23873892d80642698580c7bbbfb

5 years agorefactoring: generalize and use setting string item 50/202550/6
Adrian Szyndela [Fri, 29 Mar 2019 15:00:31 +0000 (16:00 +0100)]
refactoring: generalize and use setting string item

Change-Id: Iabedbee561b73df704f97392ae064cfcc97806a5

5 years agorefactoring: manage kdbus commands 49/202549/6
Adrian Szyndela [Fri, 29 Mar 2019 14:53:31 +0000 (15:53 +0100)]
refactoring: manage kdbus commands

This introduces helper class kdbus_command which makes it easy
to allocate stack space for kdbus commands, including space needed
for optional items.

Change-Id: If4b9ab6cbc92f4705b21373af3d94f9d88a7fd6a

5 years agorefactoring: merge 'can' with 'can_multi' functions 48/202548/6
Adrian Szyndela [Fri, 29 Mar 2019 14:22:52 +0000 (15:22 +0100)]
refactoring: merge 'can' with 'can_multi' functions

Change-Id: I17889df47ac3a5f740eb528f7f56c3e3b8b7edc5

5 years agorefactoring: replace bool return type with RAII 46/202546/6
Adrian Szyndela [Fri, 29 Mar 2019 14:18:05 +0000 (15:18 +0100)]
refactoring: replace bool return type with RAII

This changes return type of bus path resolving to shared_ptr<const char> from bool.
This is sufficient to carry all the needed information, and allows
removing of explicit free()s and gotos.

Change-Id: Ic05a734aea49439182fca4ea912086213a6cf91a

5 years agorefactoring: use string_ref for extracting bus_owner 45/202545/4
Adrian Szyndela [Fri, 29 Mar 2019 14:15:41 +0000 (15:15 +0100)]
refactoring: use string_ref for extracting bus_owner

Change-Id: I4009d4bf06ba09c3e8177c8ffbb0dec6a1d05000

5 years agorefactoring: remove not needed types 44/202544/3
Adrian Szyndela [Fri, 22 Mar 2019 14:05:17 +0000 (15:05 +0100)]
refactoring: remove not needed types

Change-Id: Iff52dbdab0e4b4b45c52d971beb0934cb22044a7

5 years agouse call_once for initialization 43/202543/3
Adrian Szyndela [Thu, 21 Mar 2019 09:41:37 +0000 (10:41 +0100)]
use call_once for initialization

Change-Id: I5dae342a7ba7083903d1fa30a4440700629b6945

5 years agoAPI: documentation update 42/202542/3
Adrian Szyndela [Fri, 29 Mar 2019 13:12:39 +0000 (14:12 +0100)]
API: documentation update

Change-Id: I002b6ce0869677f3a522162d8a68bda536ddbc9e

5 years agoAPI: mark dbuspolicy1_init as deprecated 41/202541/3
Adrian Szyndela [Fri, 29 Mar 2019 12:37:06 +0000 (13:37 +0100)]
API: mark dbuspolicy1_init as deprecated

Change-Id: I6ca78933941a57018130bcc67732ff07550fa0d6

5 years agocpp-ify libdbuspolicy1.c 40/202540/3
Adrian Szyndela [Thu, 21 Mar 2019 08:23:00 +0000 (09:23 +0100)]
cpp-ify libdbuspolicy1.c

Change-Id: I6f0ef0cb5bf558500020ee715e301f708fffb04d

5 years agoextract kdbus operations to separate file 39/202539/3
Adrian Szyndela [Wed, 20 Mar 2019 15:04:30 +0000 (16:04 +0100)]
extract kdbus operations to separate file

Change-Id: Ia33922128de417e5457a0daf5f9757a6f130cfa3

5 years agosimplify string duplication 38/202538/2
Adrian Szyndela [Wed, 20 Mar 2019 13:43:26 +0000 (14:43 +0100)]
simplify string duplication

Change-Id: Ie228964fcabf0f3fea8225e80ed2cdf82d12119d

5 years agokdbus: simplify handling names 37/202537/2
Adrian Szyndela [Wed, 20 Mar 2019 13:27:01 +0000 (14:27 +0100)]
kdbus: simplify handling names

Change-Id: I4330f299a7bcf1b2325205ac2dd6b54526a2b8c1

5 years agosimplify freeing kdbus structs 36/202536/1
Adrian Szyndela [Wed, 20 Mar 2019 13:05:10 +0000 (14:05 +0100)]
simplify freeing kdbus structs

Change-Id: I483b64423c5beddb62254aebb9d8f3e4ea987c35

5 years agoserialization: printer: check initialization status 09/202409/4 accepted/tizen/unified/20190401.225023 submit/tizen/20190329.024052
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>
5 years agoserialization: check max size of serialized file 08/202408/2
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>
5 years agoAdd libdbuspolicy-serializer as requirement 00/201800/3 accepted/tizen/unified/20190327.160617 submit/tizen/20190326.094001
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

5 years agosvace fix 72/201672/2 accepted/tizen/unified/20190322.075526 submit/tizen/20190321.094448
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>
5 years agointernal: use strerror_r instead of strerror 60/201560/1
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

5 years agoserializer: set output name to .serialized 66/201466/3
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

5 years agosvace: add noexcept to MatchItemSR::addNames 02/201402/4
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

5 years agoAdd license headers 01/201401/4
Adrian Szyndela [Wed, 13 Mar 2019 14:54:02 +0000 (15:54 +0100)]
Add license headers

Change-Id: I90a104cb4452a7f6e616e90f84bf417d7e05fe6e

5 years agospec: enable parallel building 00/201400/4
Adrian Szyndela [Wed, 13 Mar 2019 14:53:25 +0000 (15:53 +0100)]
spec: enable parallel building

Change-Id: Ia2d1ea4534bf76aab5ba6cd116d79657d7117165

5 years agoadd support for sharing fd and pool with clients 14/201214/4
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

5 years agorefactoring: change logError parameter type 08/201108/1
Mateusz Moscicki [Fri, 8 Mar 2019 09:50:30 +0000 (10:50 +0100)]
refactoring: change logError parameter type

Change-Id: I4fcaf121159d9a503a44e69d281bfd1147b8c5d1

5 years agoCheck if config_name is NULL or empty 01/201101/2
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

5 years agorefactoring: simplify StorageBackendXMLImpl 47/201047/2
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

5 years agotests: add -v (verify) command line parameter 43/201043/2
Mateusz Moscicki [Thu, 7 Mar 2019 11:22:36 +0000 (12:22 +0100)]
tests: add -v (verify) command line parameter

Change-Id: Iaf03cab80eecc12839610121786abfb3a1d102c9

5 years agoAdd warning when serialized file is missing 41/201041/2
Adrian Szyndela [Thu, 7 Mar 2019 11:12:55 +0000 (12:12 +0100)]
Add warning when serialized file is missing

Change-Id: I604b94cad042a5e65275705f7ca6a88b9fbaa9fb

5 years agoAdd design documentation 40/201040/2
Adrian Szyndela [Thu, 7 Mar 2019 10:44:53 +0000 (11:44 +0100)]
Add design documentation

Change-Id: I123ed895c624fe712d4bd3f6da8f72c820e3a87f

5 years agorefactoring: change string to ref-to-string in own tree 37/201037/2
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

5 years agorefactoring: remove unused code 36/201036/2
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

5 years agorefactoring: remove unused parameters and "using namespace std" 30/201030/2
Mateusz Moscicki [Thu, 7 Mar 2019 08:17:29 +0000 (09:17 +0100)]
refactoring: remove unused parameters and "using namespace std"

Change-Id: I886c7dfd075fce52bfa5a8d1e7bf6d9aeb301ec9

5 years agoserialization: switch backend to serialized 72/200972/3
Adrian Szyndela [Wed, 6 Mar 2019 13:30:30 +0000 (14:30 +0100)]
serialization: switch backend to serialized

Change-Id: I87bf5d7461c168ceb6c2dda034f153060bfe39ee

5 years agoserialization: add missing method to serialized storage 71/200971/3
Adrian Szyndela [Wed, 6 Mar 2019 11:37:50 +0000 (12:37 +0100)]
serialization: add missing method to serialized storage

Change-Id: Ieb56be3dd3f303dca7c851c02757fe6ab5eb64ae

5 years agorefactoring: merge NaivePolicyDb to NaivePolicyChecker 70/200970/3
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

5 years agorefactoring: make two checkers for two buses 69/200969/3
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

5 years agoAdd test to check performance of loading config files 56/200956/4
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