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/confdb/confdb.c | 10 ++-------- src/confdb/confdb.h | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'src/confdb') diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c index 14e9f057..31efd944 100644 --- a/src/confdb/confdb.c +++ b/src/confdb/confdb.c @@ -1122,7 +1122,7 @@ int confdb_get_domains(struct confdb_ctx *cdb, struct sss_domain_info **domains) { TALLOC_CTX *tmp_ctx; - struct sss_domain_info *domain, *prevdom = NULL; + struct sss_domain_info *domain = NULL; char **domlist; int ret, i; @@ -1155,13 +1155,7 @@ int confdb_get_domains(struct confdb_ctx *cdb, continue; } - if (cdb->doms == NULL) { - cdb->doms = domain; - prevdom = cdb->doms; - } else { - prevdom->next = domain; - prevdom = domain; - } + DLIST_ADD_END(cdb->doms, domain, struct sss_domain_info *); } if (cdb->doms == NULL) { diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index 71c30367..c1b92534 100644 --- a/src/confdb/confdb.h +++ b/src/confdb/confdb.h @@ -229,14 +229,14 @@ struct sss_domain_info { struct sysdb_ctx *sysdb; struct sss_names_ctx *names; - struct sss_domain_info **subdomains; - uint32_t subdomain_count; struct sss_domain_info *parent; + struct sss_domain_info *subdomains; char *realm; char *flat_name; char *domain_id; struct timeval subdomains_last_checked; + struct sss_domain_info *prev; struct sss_domain_info *next; bool disabled; -- cgit