8eda442b2e
Resolves: rhbz#1488327 - SELinux is preventing selinux_child from write access on the sock_file system_bus_socket Resolves: rhbz#1490402 - SSSD does not create /var/lib/sss/deskprofile and fails to download desktop profile data Resolves: upstream#3485 - getsidbyid does not work with 1.15.3 Resolves: upstream#3488 - SUDO doesn't work for IPA users on IPA clients after applying ID Views for them in IPA server Resolves: upstream#3501 - Accessing IdM kerberos ticket fails while id mapping is applied
113 lines
3.9 KiB
Diff
113 lines
3.9 KiB
Diff
From 9a44e78304f09961dea5148667aef24a88f10bb0 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
|
|
Date: Thu, 31 Aug 2017 18:37:44 +0200
|
|
Subject: [PATCH 098/115] TESTS: Add tests for
|
|
sysdb_search_{users,groups}_by_orig_dn()
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
|
|
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
|
|
---
|
|
src/tests/sysdb-tests.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 74 insertions(+)
|
|
|
|
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
|
|
index c186ed2fbfe8b2ef6e0aab67157217680112b7b6..63572e067b11a7149b872b3a3eae38776e2bcf21 100644
|
|
--- a/src/tests/sysdb-tests.c
|
|
+++ b/src/tests/sysdb-tests.c
|
|
@@ -5408,6 +5408,74 @@ START_TEST(test_sysdb_original_dn_case_insensitive)
|
|
}
|
|
END_TEST
|
|
|
|
+START_TEST(test_sysdb_search_groups_by_orig_dn)
|
|
+{
|
|
+ errno_t ret;
|
|
+ struct sysdb_test_ctx *test_ctx;
|
|
+ struct test_data *data;
|
|
+ const char *no_attrs[] = { NULL };
|
|
+ struct ldb_message **msgs;
|
|
+ size_t num_msgs;
|
|
+
|
|
+ /* Setup */
|
|
+ ret = setup_sysdb_tests(&test_ctx);
|
|
+ fail_if(ret != EOK, "Could not set up the test");
|
|
+
|
|
+ data = test_data_new_group(test_ctx, 456789);
|
|
+ fail_if(data == NULL);
|
|
+
|
|
+ data->orig_dn = talloc_asprintf(data, "cn=%s,cn=example,cn=com", data->groupname);
|
|
+ fail_if(data->orig_dn == NULL);
|
|
+
|
|
+ ret = test_add_incomplete_group(data);
|
|
+ fail_unless(ret == EOK, "sysdb_add_incomplete_group error [%d][%s]",
|
|
+ ret, strerror(ret));
|
|
+
|
|
+ ret = sysdb_search_groups_by_orig_dn(test_ctx, data->ctx->domain, data->orig_dn,
|
|
+ no_attrs, &num_msgs, &msgs);
|
|
+ fail_unless(ret == EOK, "cache search error [%d][%s]",
|
|
+ ret, strerror(ret));
|
|
+ fail_unless(num_msgs == 1, "Did not find the expected number of entries using "
|
|
+ "sysdb_search_groups_by_orign_dn search");
|
|
+}
|
|
+END_TEST
|
|
+
|
|
+START_TEST(test_sysdb_search_users_by_orig_dn)
|
|
+{
|
|
+ errno_t ret;
|
|
+ struct sysdb_test_ctx *test_ctx;
|
|
+ struct test_data *data;
|
|
+ const char *no_attrs[] = { NULL };
|
|
+ struct ldb_message **msgs;
|
|
+ size_t num_msgs;
|
|
+
|
|
+ /* Setup */
|
|
+ ret = setup_sysdb_tests(&test_ctx);
|
|
+ fail_if(ret != EOK, "Could not set up the test");
|
|
+
|
|
+ data = test_data_new_user(test_ctx, 456789);
|
|
+ fail_if(data == NULL);
|
|
+
|
|
+ data->orig_dn = talloc_asprintf(data, "cn=%s,cn=example,cn=com", data->username);
|
|
+ fail_if(data->orig_dn == NULL);
|
|
+
|
|
+ ret = sysdb_attrs_add_string(data->attrs, SYSDB_ORIG_DN, data->orig_dn);
|
|
+ fail_unless(ret == EOK, "sysdb_attrs_add_string failed with [%d][%s].",
|
|
+ ret, strerror(ret));
|
|
+
|
|
+ ret = test_add_user(data);
|
|
+ fail_unless(ret == EOK, "sysdb_add_user error [%d][%s]",
|
|
+ ret, strerror(ret));
|
|
+
|
|
+ ret = sysdb_search_users_by_orig_dn(test_ctx, data->ctx->domain, data->orig_dn,
|
|
+ no_attrs, &num_msgs, &msgs);
|
|
+ fail_unless(ret == EOK, "cache search error [%d][%s]",
|
|
+ ret, strerror(ret));
|
|
+ fail_unless(num_msgs == 1, "Did not find the expected number of entries using "
|
|
+ "sysdb_search_users_by_orign_dn search");
|
|
+}
|
|
+END_TEST
|
|
+
|
|
START_TEST(test_sysdb_search_sid_str)
|
|
{
|
|
errno_t ret;
|
|
@@ -7073,6 +7141,12 @@ Suite *create_sysdb_suite(void)
|
|
/* Test originalDN searches */
|
|
tcase_add_test(tc_sysdb, test_sysdb_original_dn_case_insensitive);
|
|
|
|
+ /* Test sysdb_search_groups_by_orig_dn */
|
|
+ tcase_add_test(tc_sysdb, test_sysdb_search_groups_by_orig_dn);
|
|
+
|
|
+ /* Test sysdb_search_users_by_orig_dn */
|
|
+ tcase_add_test(tc_sysdb, test_sysdb_search_users_by_orig_dn);
|
|
+
|
|
/* Test SID string searches */
|
|
tcase_add_test(tc_sysdb, test_sysdb_search_sid_str);
|
|
|
|
--
|
|
2.14.1
|
|
|