test: sync the policy tests with the recent activators and policy holders changes

Recent commit 7015a1e6746e0c2 prevents special-purpose connections from
owning names, so update the test-kdbus-policy tests to follow and test
these changes.

Create a new policy holder connection which will register the policy for
an X name, and make the first conn_db[0] connection own that name.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
handle: return -EOPNOTSUPP instead of -EPERM if an operation is not supported

If userspace calls in with the wrong connection type, just return
-EOPNOTSUPP instead of -EPERM.

This will not confuse unprivileged and privileged processes, and permits
to identify legitimate -EPERM errors.

This just converts errors introduced in commit 7015a1e6746

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
handle: allow KDBUS_CMD_CONN_UPDATE ioctl for policy holders

Allow KDBUS_CMD_CONN_UPDATE for KDBUS_CONN_POLICY_HOLDER connections.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: improve kdbus_cmd_conn_update() connection type checks

Do another round of connection type checks inside the KDBUS_ITEM
iterator.

We need this since we do not want to allow ordinary connections to
update policy entries that belong to another policy holder connection.

We also do it for the attach flags since only ordinary connections are
interessted in it.

And update a kdbus_policy_set() call to only pass a one name per
policy-holding connection

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test: split conn_update() into update attach-flags and update policy

Since ordinary connections are only interested in the attach-flags and
policy holders in policies, split conn_update() into:
1) conn_update_attach_flags()
2) conn_update_policy()

This way we use the conn_update_policy() function in test-kdbus-policy
with a policy-holding connection and we pass all the tests. This
prevents messing up with the attach-flags.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
Merge remote-tracking branch 'kdbus/master' into 3.16/kdbus