From bba1a5fd62cffcae076d1351df5a83fbc4a6ec17 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 14 Jan 2013 20:30:04 -0500 Subject: Change the way domains are linked. - Use a double-linked list for domains and subdomains. - Never remove a subdomain, simply mark it as disabled if it becomes unused. - Rework the way subdomains are refreshed. Now sysdb_update_subdomains() actually updates the current subdomains and marks as disabled the ones not found in the sysdb or add new ones found. It never removes them. Removal of missing domains from sysdb is deferred to the providers, which will perform it at refresh time, for the ipa provider that is done by ipa_subdomains_write_mappings() now. sysdb_update_subdomains() is then used to update the memory hierarchy of the subdomains. - Removes sysdb_get_subdomains() - Removes copy_subdomain() - Add sysdb_subdomain_delete() --- src/util/usertools.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/util/usertools.c') diff --git a/src/util/usertools.c b/src/util/usertools.c index 33a2a7bd..587fd9cb 100644 --- a/src/util/usertools.c +++ b/src/util/usertools.c @@ -298,24 +298,16 @@ int sss_parse_name(TALLOC_CTX *memctx, return EOK; } -static struct sss_domain_info * match_any_domain_or_subdomain_name ( - struct sss_domain_info *dom, const char *dmatch) +static struct sss_domain_info * match_any_domain_or_subdomain_name( + struct sss_domain_info *dom, + const char *dmatch) { - uint32_t i; - - if (strcasecmp (dom->name, dmatch) == 0 || - (dom->flat_name != NULL && strcasecmp(dom->flat_name, dmatch) == 0)) + if (strcasecmp(dom->name, dmatch) == 0 || + (dom->flat_name != NULL && strcasecmp(dom->flat_name, dmatch) == 0)) { return dom; - - for (i = 0; i < dom->subdomain_count; i++) { - if (strcasecmp(dom->subdomains[i]->name, dmatch) == 0 || - (dom->subdomains[i]->flat_name != NULL && - strcasecmp(dom->subdomains[i]->flat_name, dmatch) == 0)) { - return dom->subdomains[i]; - } } - return NULL; + return find_subdomain_by_name(dom, dmatch, true); } int sss_parse_name_for_domains(TALLOC_CTX *memctx, -- cgit