* policy holder connection for this name will update the policy
* entries, so different use cases can be tested.
*/
-static struct kdbus_conn **conn_db;
+static struct kdbus_conn **g_conn_db;
static wur void *kdbus_recv_echo(void *ptr)
{
if (!all_uids_gids_are_mapped())
return TEST_SKIP;
- ASSERT_NONZERO(conn_db = calloc(MAX_CONN, sizeof(struct kdbus_conn *)));
+ ASSERT_NONZERO(g_conn_db = calloc(MAX_CONN, sizeof(struct kdbus_conn *)));
- memset(conn_db, 0, MAX_CONN * sizeof(struct kdbus_conn *));
+ memset(g_conn_db, 0, MAX_CONN * sizeof(struct kdbus_conn *));
- ASSERT_NONZERO(conn_db[0] = kdbus_hello(bus, 0, NULL, 0));
+ ASSERT_NONZERO(g_conn_db[0] = kdbus_hello(bus, 0, NULL, 0));
- ASSERT_ZERO(kdbus_add_match_empty(conn_db[0]));
+ ASSERT_ZERO(kdbus_add_match_empty(g_conn_db[0]));
- ASSERT_EXIT_ZERO(kdbus_fork_test_by_id(bus, conn_db, -EPERM, -EPERM));
+ ASSERT_EXIT_ZERO(kdbus_fork_test_by_id(bus, g_conn_db, -EPERM, -EPERM));
ASSERT_ZERO(kdbus_register_policy_holder(bus, POLICY_NAME, &policy_holder));
ASSERT_ZERO(kdbus_register_same_activator(bus, POLICY_NAME, &activator));
/* Acquire POLICY_NAME */
- ASSERT_ZERO(kdbus_name_acquire(conn_db[0], POLICY_NAME, NULL));
+ ASSERT_ZERO(kdbus_name_acquire(g_conn_db[0], POLICY_NAME, NULL));
- ASSERT_ZERO(kdbus_normal_test(bus, POLICY_NAME, conn_db));
+ ASSERT_ZERO(kdbus_normal_test(bus, POLICY_NAME, g_conn_db));
- ASSERT_ZERO(kdbus_list(conn_db[0], KDBUS_LIST_NAMES | KDBUS_LIST_UNIQUE | KDBUS_LIST_ACTIVATORS | KDBUS_LIST_QUEUED));
+ ASSERT_ZERO(kdbus_list(g_conn_db[0], KDBUS_LIST_NAMES | KDBUS_LIST_UNIQUE | KDBUS_LIST_ACTIVATORS | KDBUS_LIST_QUEUED));
- ASSERT_ZERO(kdbus_fork_test(bus, POLICY_NAME, conn_db, EXIT_SUCCESS));
+ ASSERT_ZERO(kdbus_fork_test(bus, POLICY_NAME, g_conn_db, EXIT_SUCCESS));
/*
* children connections are able to talk to conn_db[0] since
* -EPERM but since it is a privileged bus user the TALK is
* allowed.
*/
- ASSERT_EXIT_ZERO(kdbus_fork_test_by_id(bus, conn_db, EXIT_SUCCESS, EXIT_SUCCESS));
+ ASSERT_EXIT_ZERO(kdbus_fork_test_by_id(bus, g_conn_db, EXIT_SUCCESS, EXIT_SUCCESS));
/*
* Connections that can talk are perhaps being destroyed now.
* After setting the policy re-check connections
* we expect the children to fail with -EPERM
*/
- ASSERT_ZERO(kdbus_fork_test(bus, POLICY_NAME, conn_db, ONTIZEN(0,-EPERM)));
+ ASSERT_ZERO(kdbus_fork_test(bus, POLICY_NAME, g_conn_db, ONTIZEN(0,-EPERM)));
/*
* Now expect that both parent and child to fail.
* Since the parent's connection will timeout when receiving
* from the child, we never continue. FWIW just put -EPERM.
*/
- ASSERT_EXIT_ZERO(kdbus_fork_test_by_id(bus, conn_db, -EPERM, -EPERM));
+ ASSERT_EXIT_ZERO(kdbus_fork_test_by_id(bus, g_conn_db, -EPERM, -EPERM));
/* Check if the name can be reached in a new userns */
- ASSERT_ZERO(kdbus_clone_userns_test(bus, POLICY_NAME, conn_db, ONTIZEN(0,-EPERM)));
+ ASSERT_ZERO(kdbus_clone_userns_test(bus, POLICY_NAME, g_conn_db, ONTIZEN(0,-EPERM)));
for (i = 0; i < MAX_CONN; i++)
- kdbus_conn_free(conn_db[i]);
+ kdbus_conn_free(g_conn_db[i]);
kdbus_conn_free(activator);
kdbus_conn_free(policy_holder);
- free(conn_db);
+ free(g_conn_db);
return TEST_OK;
}
ASSERT_ZERO(kdbus_conn_update_policy(conn_a, "com.example.c", &access, 1));
RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
- struct kdbus_conn *owner;
+ struct kdbus_conn *owner_;
- ASSERT_NONZERO(owner = kdbus_hello(env->buspath, 0, NULL, 0));
+ ASSERT_NONZERO(owner_ = kdbus_hello(env->buspath, 0, NULL, 0));
- ASSERT_EXIT_ZERO(kdbus_name_acquire(owner, "com.example.c", NULL));
+ ASSERT_EXIT_ZERO(kdbus_name_acquire(owner_, "com.example.c", NULL));
ASSERT_ZERO(kdbus_msg_send(unpriv, "com.example.c", 0xdeadbeef, 0, 0, 0, 0));
- ASSERT_EXIT(0,<=,kdbus_msg_recv_poll(owner, 100, NULL, NULL));
+ ASSERT_EXIT(0,<=,kdbus_msg_recv_poll(owner_, 100, NULL, NULL));
- kdbus_conn_free(owner);
+ kdbus_conn_free(owner_);
}));
/*