From 07f85a31bd4a83e60c0cd57177e2490b5a36c1b0 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Wed, 24 Sep 2014 13:03:53 +0200 Subject: [PATCH 02/15] new_subdomain: copy view data from parent Since a view applies to the whole domain-subdomain tree the view data is copied from the parent the new created domains. --- src/util/domain_info_utils.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c index 8ffbec2..4e2c14c 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -220,6 +220,17 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx, } dom->parent = parent; + + /* Sub-domains always have the same view as the parent */ + dom->has_views = parent->has_views; + if (parent->view_name != NULL) { + dom->view_name = talloc_strdup(dom, parent->view_name); + if (dom->view_name == NULL) { + DEBUG(SSSDBG_OP_FAILURE, "Failed to copy parent's view name.\n"); + goto fail; + } + } + dom->name = talloc_strdup(dom, name); if (dom->name == NULL) { DEBUG(SSSDBG_OP_FAILURE, "Failed to copy domain name.\n"); -- 1.8.3.1