From accff8ebe158251b1d25a95b3b035fe7e08fd1ee Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Sun, 19 Jun 2016 07:19:15 +0200 Subject: UTIL: expand_homedir_template manages usernames internally expand_homedir_template() can be considered an outward-facing interface, therefore the function and its input structure will accept the internal name format and parse it internally into a username and domain component. Reviewed-by: Sumit Bose --- src/tests/cmocka/test_utils.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/tests') diff --git a/src/tests/cmocka/test_utils.c b/src/tests/cmocka/test_utils.c index e171848f1..ef3e894aa 100644 --- a/src/tests/cmocka/test_utils.c +++ b/src/tests/cmocka/test_utils.c @@ -963,7 +963,7 @@ void check_expanded_value(TALLOC_CTX *tmp_ctx, { char *homedir; - homedir = expand_homedir_template(tmp_ctx, template, homedir_ctx); + homedir = expand_homedir_template(tmp_ctx, template, false, homedir_ctx); if (exp_val != NULL) { assert_string_equal(homedir, exp_val); } else { @@ -983,7 +983,13 @@ static int setup_homedir_ctx(void **state) struct sss_nss_homedir_ctx); assert_non_null(homedir_ctx); - homedir_ctx->username = USERNAME; + homedir_ctx->username = sss_create_internal_fqname(homedir_ctx, + USERNAME, DOMAIN); + if (homedir_ctx->username == NULL) { + talloc_free(homedir_ctx); + return 1; + } + homedir_ctx->uid = UID; homedir_ctx->original = ORIGINAL_HOME; homedir_ctx->domain = DOMAIN; @@ -1027,10 +1033,10 @@ void test_expand_homedir_template_NULL(void **state) homedir_ctx = talloc_zero(tmp_ctx, struct sss_nss_homedir_ctx); assert_non_null(homedir_ctx); - homedir = expand_homedir_template(tmp_ctx, NULL, NULL); + homedir = expand_homedir_template(tmp_ctx, NULL, false, NULL); assert_null(homedir); - homedir = expand_homedir_template(tmp_ctx, "template", NULL); + homedir = expand_homedir_template(tmp_ctx, "template", false, NULL); assert_null(homedir); /* missing data in homedir_ctx */ -- cgit