From f511e73867f22fff9d0867b07013accb4f44cb1f Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Wed, 14 Apr 2021 17:22:06 +0200
Subject: [PATCH 65/66] sss_domain_info: add not_found_counter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This new counter should be used to track how often a domain could not be
found while discovering the environment so that it can be deleted after
a number of failed attempts.
Resolves: https://github.com/SSSD/sssd/issues/5528
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
(cherry picked from commit 5d65411f1aa16af929ae2271ee4d3d9101728a67 with changes)
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
---
src/confdb/confdb.c | 1 +
src/confdb/confdb.h | 4 ++++
src/db/sysdb_subdomains.c | 2 ++
3 files changed, 7 insertions(+)
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index 97de6d3b1..a33f352e7 100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -1474,6 +1474,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
domain->view_name = NULL;
domain->state = DOM_ACTIVE;
+ domain->not_found_counter = 0;
*_domain = domain;
ret = EOK;
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
index b0d52ba49..a1ac676a6 100644
--- a/src/confdb/confdb.h
+++ b/src/confdb/confdb.h
@@ -406,6 +406,10 @@ struct sss_domain_info {
/* Do not use the _output_fqnames property directly in new code, but rather
* use sss_domain_info_{get,set}_output_fqnames(). */
bool output_fqnames;
+
+ /* Counts how often the domain was not found during a refresh of the
+ * domain list */
+ size_t not_found_counter;
};
/**
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index ee3c7f1aa..cbb11342e 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -171,6 +171,8 @@ struct sss_domain_info *new_subdomain(TALLOC_CTX *mem_ctx,
dom->homedir_substr = parent->homedir_substr;
dom->override_gid = parent->override_gid;
+ dom->not_found_counter = 0;
+
if (parent->sysdb == NULL) {
DEBUG(SSSDBG_OP_FAILURE, "Missing sysdb context in parent domain.\n");
goto fail;
--
2.26.3