summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorFabiano Fidêncio <fidencio@redhat.com>2017-03-26 00:27:50 +0100
committerJakub Hrozek <jhrozek@redhat.com>2017-03-29 14:00:17 +0200
commit66c8e92eb5a4985bb7f64c349a53b08030a000cf (patch)
tree7481643c4a8149067da217b4f9b8f5cfa12562c6 /src/tests
parent34228050af1e25706f61ec9df648852284b61c2b (diff)
downloadsssd-66c8e92eb5a4985bb7f64c349a53b08030a000cf.tar.gz
sssd-66c8e92eb5a4985bb7f64c349a53b08030a000cf.tar.xz
sssd-66c8e92eb5a4985bb7f64c349a53b08030a000cf.zip
CACHE_REQ: Make use of domainResolutionOrder
domainResolutionOrder has been introduced in the previous commits and allows the admin to set up a specific order which the domains will be resolved during a lookup and with this patch we can take advantage of this. In order to have it working a new structure has been added (struct domain_resolution_order) to the responder context and will be used by the cache_req to perform the lookups based on this list. As the ipaDomainResolutionOrder may be set globally on IPA or per View, SSSD does respect the following precedence order: View > Globally. The way the list is built is quite simple, basically having the domains present on ipaDomainResolutionOrder as the first domains (in that specific order) and then appending the remaining domains to this list. The final result is a completely flat list with all the domains respecting the specified order (it's important to remember that the domains not specified won't follow any specific order, they're just "random" based on the domains list present in the responder context. Related: https://pagure.io/SSSD/sssd/issue/3001 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Sumit Bose <sbose@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cmocka/common_mock_resp.c6
-rw-r--r--src/tests/cmocka/common_mock_resp_dp.c7
-rw-r--r--src/tests/cmocka/test_nss_srv.c4
-rw-r--r--src/tests/cwrap/Makefile.am1
4 files changed, 18 insertions, 0 deletions
diff --git a/src/tests/cmocka/common_mock_resp.c b/src/tests/cmocka/common_mock_resp.c
index 88808b1b9..175101fc5 100644
--- a/src/tests/cmocka/common_mock_resp.c
+++ b/src/tests/cmocka/common_mock_resp.c
@@ -51,6 +51,12 @@ mock_rctx(TALLOC_CTX *mem_ctx,
rctx->ev = ev;
rctx->domains = domains;
rctx->pvt_ctx = pvt_ctx;
+ if (domains != NULL) {
+ ret = sss_resp_populate_cr_domains(rctx);
+ if (ret != EOK) {
+ return NULL;
+ }
+ }
return rctx;
}
diff --git a/src/tests/cmocka/common_mock_resp_dp.c b/src/tests/cmocka/common_mock_resp_dp.c
index 5db5255ab..4b38a38e6 100644
--- a/src/tests/cmocka/common_mock_resp_dp.c
+++ b/src/tests/cmocka/common_mock_resp_dp.c
@@ -21,6 +21,7 @@
*/
#include "util/util.h"
+#include "responder/common/responder.h"
#include "tests/cmocka/common_mock_resp.h"
/* Mock DP requests that finish immediatelly and return
@@ -165,6 +166,12 @@ sss_dp_get_domains_send(TALLOC_CTX *mem_ctx,
bool force,
const char *hint)
{
+ errno_t ret;
+ ret = sss_resp_populate_cr_domains(rctx);
+ if (ret != EOK) {
+ return NULL;
+ }
+
return test_req_succeed_send(mem_ctx, rctx->ev);
}
diff --git a/src/tests/cmocka/test_nss_srv.c b/src/tests/cmocka/test_nss_srv.c
index ede72b341..2f526660c 100644
--- a/src/tests/cmocka/test_nss_srv.c
+++ b/src/tests/cmocka/test_nss_srv.c
@@ -3440,6 +3440,10 @@ static int nss_subdom_test_setup(void **state)
nss_test_ctx->tctx->confdb);
assert_int_equal(ret, EOK);
+ ret = sss_resp_populate_cr_domains(nss_test_ctx->rctx);
+ assert_int_equal(ret, EOK);
+ assert_non_null(nss_test_ctx->rctx->cr_domains);
+
nss_test_ctx->subdom = nss_test_ctx->tctx->dom->subdomains;
ret = store_group(nss_test_ctx, nss_test_ctx->subdom,
diff --git a/src/tests/cwrap/Makefile.am b/src/tests/cwrap/Makefile.am
index 4a4090df9..c99ebde5f 100644
--- a/src/tests/cwrap/Makefile.am
+++ b/src/tests/cwrap/Makefile.am
@@ -41,6 +41,7 @@ SSSD_CACHE_REQ_OBJ = \
../../../src/responder/common/cache_req/cache_req_result.c \
../../../src/responder/common/cache_req/cache_req_search.c \
../../../src/responder/common/cache_req/cache_req_data.c \
+ ../../../src/responder/common/cache_req/cache_req_domain.c \
../../../src/responder/common/cache_req/plugins/cache_req_common.c \
../../../src/responder/common/cache_req/plugins/cache_req_enum_users.c \
../../../src/responder/common/cache_req/plugins/cache_req_enum_groups.c \