summaryrefslogtreecommitdiffstats
path: root/src/tests/common_dom.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-09-16 15:31:02 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-09-22 13:45:56 +0200
commitcffe3defa3cb5011efc92a7773fe113a1e69774f (patch)
treeb17aaee6ae4a42d2d6ec9c2ed83564c0be920237 /src/tests/common_dom.c
parent67625b1b4f856510bf4e169649b3fb30c2c14152 (diff)
downloadsssd-cffe3defa3cb5011efc92a7773fe113a1e69774f.tar.gz
sssd-cffe3defa3cb5011efc92a7773fe113a1e69774f.tar.xz
sssd-cffe3defa3cb5011efc92a7773fe113a1e69774f.zip
tests: Move named_domain from test_utils to common test code
This handy function should be reused by other parts of the code. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/tests/common_dom.c')
-rw-r--r--src/tests/common_dom.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/common_dom.c b/src/tests/common_dom.c
index 46ea0b782..24d1f5a8a 100644
--- a/src/tests/common_dom.c
+++ b/src/tests/common_dom.c
@@ -371,3 +371,25 @@ void test_dom_suite_cleanup(const char *tests_path,
test_multidom_suite_cleanup(tests_path, cdb_file, domains);
}
+
+struct sss_domain_info *named_domain(TALLOC_CTX *mem_ctx,
+ const char *name,
+ struct sss_domain_info *parent)
+{
+ struct sss_domain_info *dom = NULL;
+
+ dom = talloc_zero(mem_ctx, struct sss_domain_info);
+ if (dom == NULL) {
+ return NULL;
+ }
+
+ dom->name = talloc_strdup(dom, name);
+ if (dom->name == NULL) {
+ talloc_free(dom);
+ return NULL;
+ }
+
+ dom->parent = parent;
+
+ return dom;
+}