summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-06-19 07:19:15 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-07-07 10:25:46 +0200
commitaccff8ebe158251b1d25a95b3b035fe7e08fd1ee (patch)
tree08537756662bcfd378ab00d4f6e926bf76bcaf6e /src/tests
parent78f9a9d4a2725f1b2cb6e582c965b5e6f7bdff7d (diff)
downloadsssd-accff8ebe158251b1d25a95b3b035fe7e08fd1ee.tar.gz
sssd-accff8ebe158251b1d25a95b3b035fe7e08fd1ee.tar.xz
sssd-accff8ebe158251b1d25a95b3b035fe7e08fd1ee.zip
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 <sbose@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cmocka/test_utils.c14
1 files changed, 10 insertions, 4 deletions
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 */