[PATCH 1/6] kdbus/selftests: fix CAP translation tests

From: David Herrmann
Date: Thu Jul 02 2015 - 04:29:34 EST


We now support CAP translations. Make sure our tests reflect that. So far
they made sure we drop CAPS on namespace borders. This is wrong, though.
We really need to just make sure that no _or_ the correctly translated
caps are returned. Fix this.

Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxx>
---
tools/testing/selftests/kdbus/test-metadata-ns.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/kdbus/test-metadata-ns.c b/tools/testing/selftests/kdbus/test-metadata-ns.c
index ccdfae0..1f6edc0 100644
--- a/tools/testing/selftests/kdbus/test-metadata-ns.c
+++ b/tools/testing/selftests/kdbus/test-metadata-ns.c
@@ -168,9 +168,8 @@ static int __kdbus_clone_userns_test(const char *bus,
ASSERT_EXIT(ret == 0);
ASSERT_EXIT(msg->dst_id == userns_conn->id);

- /* Different namespaces no CAPS */
item = kdbus_get_item(msg, KDBUS_ITEM_CAPS);
- ASSERT_EXIT(item == NULL);
+ ASSERT_EXIT(item);

/* uid/gid not mapped, so we have unpriv cached creds */
ret = kdbus_match_kdbus_creds(msg, &unmapped_creds);
@@ -196,9 +195,8 @@ static int __kdbus_clone_userns_test(const char *bus,
ASSERT_EXIT(ret == 0);
ASSERT_EXIT(msg->dst_id == KDBUS_DST_ID_BROADCAST);

- /* Different namespaces no CAPS */
item = kdbus_get_item(msg, KDBUS_ITEM_CAPS);
- ASSERT_EXIT(item == NULL);
+ ASSERT_EXIT(item);

/* uid/gid not mapped, so we have unpriv cached creds */
ret = kdbus_match_kdbus_creds(msg, &unmapped_creds);
@@ -358,9 +356,8 @@ static int kdbus_clone_userns_test(const char *bus,

userns_conn_id = msg->src_id;

- /* We do not share the userns, os no KDBUS_ITEM_CAPS */
item = kdbus_get_item(msg, KDBUS_ITEM_CAPS);
- ASSERT_RETURN(item == NULL);
+ ASSERT_RETURN(item);

/*
* Compare received items, creds must be translated into
--
2.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/