Blame SOURCES/0065-sss_domain_info-add-not_found_counter.patch

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