summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2015-01-22 17:03:00 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-01-23 13:26:33 +0100
commit79a818a4f473e3517b2bfe4ad03391e2d82fe33d (patch)
tree846ea3bc0f3c9c4e787df0892caefdcc87bd4e52 /src/tests
parent7407b227b67749d854d1632cd04f6106606cbdda (diff)
downloadsssd-79a818a4f473e3517b2bfe4ad03391e2d82fe33d.tar.gz
sssd-79a818a4f473e3517b2bfe4ad03391e2d82fe33d.tar.xz
sssd-79a818a4f473e3517b2bfe4ad03391e2d82fe33d.zip
IPA: properly handle mixed-case trusted domains
In the SSSD cache domain names are handled case-sensitive. As a result fully-qualified names in RDN contain the domain part in the original spelling. When IPA client lookup up group-memberships on the IPA server via the extdom plugin the names returned are all lower case. To make sure new DNs are generated correctly the domain part must adjusted. Related to https://fedorahosted.org/sssd/ticket/2159 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cmocka/test_utils.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/tests/cmocka/test_utils.c b/src/tests/cmocka/test_utils.c
index 5dc00c4cc..dc6e35dc0 100644
--- a/src/tests/cmocka/test_utils.c
+++ b/src/tests/cmocka/test_utils.c
@@ -1030,6 +1030,48 @@ void test_sss_write_krb5_conf_snippet(void **state)
free(path);
}
+
+void test_fix_domain_in_name_list(void **state)
+{
+ struct name_init_test_ctx *test_ctx;
+
+ int ret;
+ struct sss_domain_info *sd;
+ struct sss_domain_info *dom;
+ const char *in[] = { "abc@test.case.dom", "def@TEST.case.DOM", NULL};
+ char **out = NULL;
+
+ test_ctx = talloc_get_type(*state, struct name_init_test_ctx);
+ assert_non_null(test_ctx);
+
+ ret = confdb_get_domains(test_ctx->confdb, &dom);
+ assert_int_equal(ret, EOK);
+
+ ret = sss_names_init(dom, test_ctx->confdb, NULL, &dom->names);
+ assert_int_equal(ret, EOK);
+
+ sd = talloc_zero(test_ctx, struct sss_domain_info);
+ assert_non_null(sd);
+ sd->name = talloc_strdup(sd, "TesT.CasE.DoM");
+ assert_non_null(sd->name);
+ sd->names = dom->names;
+ DLIST_ADD(dom->subdomains, sd);
+ sd->parent = dom;
+
+ ret = fix_domain_in_name_list(test_ctx, dom, discard_const(in), &out);
+ assert_int_equal(ret, EOK);
+ assert_non_null(out);
+ assert_non_null(out[0]);
+ assert_string_equal(out[0], "abc@TesT.CasE.DoM");
+ assert_non_null(out[1]);
+ assert_string_equal(out[1], "def@TesT.CasE.DoM");
+ assert_null(out[2]);
+
+ talloc_free(out);
+ talloc_free(sd);
+ talloc_free(dom);
+}
+
int main(int argc, const char *argv[])
{
poptContext pc;
@@ -1078,6 +1120,8 @@ int main(int argc, const char *argv[])
setup_add_strings_lists,
teardown_add_strings_lists),
unit_test(test_sss_write_krb5_conf_snippet),
+ unit_test_setup_teardown(test_fix_domain_in_name_list,
+ confdb_test_setup, confdb_test_teardown),
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */