From aac3ca699a09090072ae4d68bdda8dec990ae393 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 28 Sep 2012 11:22:59 +0200 Subject: Use flat name for master domain as well --- src/responder/common/responder_common.c | 4 +++- src/responder/common/responder_get_domains.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/responder/common') diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c index 2f8cd84d..4fa81909 100644 --- a/src/responder/common/responder_common.c +++ b/src/responder/common/responder_common.c @@ -878,7 +878,9 @@ responder_get_domain(TALLOC_CTX *sd_mem_ctx, struct resp_ctx *rctx, int i; for (dom = rctx->domains; dom; dom = dom->next) { - if (strcasecmp(dom->name, domain) == 0) { + if (strcasecmp(dom->name, domain) == 0 || + (dom->flat_name != NULL && + strcasecmp(dom->flat_name, domain) == 0)) { ret_dom = dom; break; } diff --git a/src/responder/common/responder_get_domains.c b/src/responder/common/responder_get_domains.c index a98e6634..aff06e63 100644 --- a/src/responder/common/responder_get_domains.c +++ b/src/responder/common/responder_get_domains.c @@ -233,6 +233,7 @@ static errno_t get_domains_done(struct tevent_req *req) struct sss_domain_info **new_sd_list = NULL; size_t subdomain_count; struct sysdb_subdom **subdomains; + struct sysdb_subdom *master_info; state = tevent_req_data(req, struct sss_dp_domains_info); domain = state->dom; @@ -280,6 +281,20 @@ static errno_t get_domains_done(struct tevent_req *req) --c; } + if (domain->flat_name == NULL) { + ret = sysdb_master_domain_get_info(domain, domain->sysdb, &master_info); + if (ret != EOK) { + DEBUG(SSSDBG_FUNC_DATA, ("sysdb_master_domain_get_info " \ + "failed.\n")); + goto done; + } + + domain->flat_name = talloc_strdup(domain, master_info->flat_name); + talloc_free(master_info); + DEBUG(SSSDBG_TRACE_LIBS, ("Adding flat name [%s] to domain [%s].\n", + domain->flat_name, domain->name)); + } + errno = 0; ret = gettimeofday(&domain->subdomains_last_checked, NULL); if (ret == -1) { -- cgit