Hello, please see attached patch.
PR
>From c5ad372278d36199c7d3baa2d66cd25dcb2c366b Mon Sep 17 00:00:00 2001 From: Pavel Reichl <[email protected]> Date: Thu, 16 Jan 2014 16:43:19 +0000 Subject: [PATCH] CONFDB: omit domains with same name Omit domains given in the domains option which are the same or only differ in case. Resolves: https://fedorahosted.org/sssd/ticket/2171 --- src/confdb/confdb.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c index c5cb0c8643bbdb036bc9ecccd74f6e3fd71e38e9..787e80428620a430de2cdcbf0abd435e19d778f5 100644 --- a/src/confdb/confdb.c +++ b/src/confdb/confdb.c @@ -1164,6 +1164,7 @@ int confdb_get_domains(struct confdb_ctx *cdb, struct sss_domain_info *domain = NULL; char **domlist; int ret, i; + bool unique_dom_name; if (cdb->doms) { *domains = cdb->doms; @@ -1187,14 +1188,30 @@ int confdb_get_domains(struct confdb_ctx *cdb, } for (i = 0; domlist[i]; i++) { - ret = confdb_get_domain_internal(cdb, cdb, domlist[i], &domain); - if (ret) { - DEBUG(0, ("Error (%d [%s]) retrieving domain [%s], skipping!\n", - ret, strerror(ret), domlist[i])); - continue; + unique_dom_name = true; + /* check if domain name is really unique */ + DLIST_FOR_EACH(domain, cdb->doms) { + if (strcasecmp(domain->name, domlist[i]) == 0) { + DEBUG(SSSDBG_CONF_SETTINGS, + ("Domain '%s' has too similar name to domain '%s'. " + "Therefore it will be omitted.\n", + domlist[i], domain->name)); + unique_dom_name = false; + break; + } } - DLIST_ADD_END(cdb->doms, domain, struct sss_domain_info *); + if (unique_dom_name) { + domain = NULL; + ret = confdb_get_domain_internal(cdb, cdb, domlist[i], &domain); + if (ret) { + DEBUG(0, ("Error (%d [%s]) retrieving domain [%s], skipping!\n", + ret, strerror(ret), domlist[i])); + continue; + } + + DLIST_ADD_END(cdb->doms, domain, struct sss_domain_info *); + } } if (cdb->doms == NULL) { -- 1.8.4.2
_______________________________________________ sssd-devel mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
