test: add the test-kdbus-policy test
authorDjalal Harouni <tixxdz@opendz.org>
Fri, 20 Jun 2014 16:49:59 +0000 (17:49 +0100)
committerDaniel Mack <zonque@gmail.com>
Fri, 20 Jun 2014 17:36:08 +0000 (19:36 +0200)
commit45090b06346023b05fff678359fe59b00597a616
treef255a3c47622aae34ea5256932694f4e0e438a2f
parent88a232f5a837dbc15561b5ec7aa0be58df4483e5
test: add the test-kdbus-policy test

Add the test-kdbus-policy that performs:

1) Register a policy holder
2) Try to register the same name as an activator:
   kdbus will break here due to a corrupted db->entries_hash
   in kdbus_policy_set().
   Will be fixed in the next patches.
3) Acquire the name for the policy holder
4) Create and test the connections
5) Fork and drop privileges, then create and test connections which
   should be cached in the send cache after the tests.

   Here we inspect the send cache and we have located several bugs,
   which will be fixed in the next patches.

6) Call kdbus_set_policy_talk() to test KDBUS_CMD_CONN_UPDATE ioctl
   and restrict TALK access to KDBUS_POLICY_ACCESS_USER

7) Redo test 5), now connections should all fail with -EPERM since
   TALK access was restricted.

To test this we need the right capabilities to perform the setuid() and
drop privileges, so this test just check if it was exec by root.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
.gitignore
test/Makefile
test/test-kdbus-policy.c [new file with mode: 0644]