On Thu, 2014-01-16 at 12:19 -0500, Stephen Gallagher wrote: > On 01/16/2014 12:11 PM, Pavel Reichl wrote: > > Hello, > > > > please see attached patch. > > > > I'd prefer if this was logged as a fatal failure (and logged to > syslog) and then failed to start up. Ignoring it silently may lead to > domains being checked in inconsistent order (they might be earlier in > the list to check than expected). >
Hello Stephen, thanks for review. New patch addressing your concerns is attached. PR
>From a7a91a399ea912ed21f611c4530ae450f7eaed35 Mon Sep 17 00:00:00 2001 From: Pavel Reichl <prei...@redhat.com> Date: Thu, 16 Jan 2014 16:43:19 +0000 Subject: [PATCH] CONFDB: fail if there are domains with same name Fail to start sssd if the domains given in the domains option are the same or only differ in case. Resolves: https://fedorahosted.org/sssd/ticket/2171 --- src/confdb/confdb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c index c5cb0c8643bbdb036bc9ecccd74f6e3fd71e38e9..165eba61abffb71dce70cf6b3106a5e9d00c18cd 100644 --- a/src/confdb/confdb.c +++ b/src/confdb/confdb.c @@ -1187,6 +1187,22 @@ int confdb_get_domains(struct confdb_ctx *cdb, } for (i = 0; domlist[i]; i++) { + /* check if domain name is really unique */ + DLIST_FOR_EACH(domain, cdb->doms) { + if (strcasecmp(domain->name, domlist[i]) == 0) { + DEBUG(SSSDBG_FATAL_FAILURE, + ("Domain '%s' has too similar name to domain '%s'.\n", + domlist[i], domain->name)); + sss_log(SSS_LOG_CRIT, + "Domain '%s' has too similar name to domain '%s'.\n", + domlist[i], domain->name); + + ret = EINVAL; + goto done; + } + } + + domain = NULL; ret = confdb_get_domain_internal(cdb, cdb, domlist[i], &domain); if (ret) { DEBUG(0, ("Error (%d [%s]) retrieving domain [%s], skipping!\n", -- 1.8.4.2
_______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/sssd-devel