Blame SOURCES/0095-BACKEND-Reload-resolv.conf-after-initialization.patch

5ddef6
From c52a5a640f0574f28281dd62238ffc7303eb4391 Mon Sep 17 00:00:00 2001
5ddef6
From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= <allopez@redhat.com>
5ddef6
Date: Fri, 4 Nov 2022 12:18:50 +0100
5ddef6
Subject: [PATCH] BACKEND: Reload resolv.conf after initialization
5ddef6
MIME-Version: 1.0
5ddef6
Content-Type: text/plain; charset=UTF-8
5ddef6
Content-Transfer-Encoding: 8bit
5ddef6
5ddef6
Once the backend initialization is finished, in particular after D-Bus
5ddef6
is initialized, reload the resolv.conf file to reload any change
5ddef6
signaled through D-Bus before its initializiation.
5ddef6
5ddef6
Resolves: https://github.com/SSSD/sssd/issues/6383
5ddef6
5ddef6
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
5ddef6
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
5ddef6
---
5ddef6
 src/monitor/monitor_sbus.c       | 5 +++++
5ddef6
 src/providers/data_provider_be.c | 8 ++++++++
5ddef6
 2 files changed, 13 insertions(+)
5ddef6
5ddef6
diff --git a/src/monitor/monitor_sbus.c b/src/monitor/monitor_sbus.c
5ddef6
index 9d3cd478e..cf70552b3 100644
5ddef6
--- a/src/monitor/monitor_sbus.c
5ddef6
+++ b/src/monitor/monitor_sbus.c
5ddef6
@@ -156,6 +156,11 @@ int monitor_common_res_init(struct sbus_request *dbus_req, void *data)
5ddef6
         return EIO;
5ddef6
     }
5ddef6
 
5ddef6
+    if (dbus_req == NULL) {
5ddef6
+        /* No reply needed */
5ddef6
+        return EOK;
5ddef6
+    }
5ddef6
+
5ddef6
     /* Send an empty reply to acknowledge receipt */
5ddef6
     return sbus_request_return_and_finish(dbus_req, DBUS_TYPE_INVALID);
5ddef6
 }
5ddef6
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
5ddef6
index fb72d99e3..2699f3b3a 100644
5ddef6
--- a/src/providers/data_provider_be.c
5ddef6
+++ b/src/providers/data_provider_be.c
5ddef6
@@ -549,6 +549,14 @@ errno_t be_process_init(TALLOC_CTX *mem_ctx,
5ddef6
         goto done;
5ddef6
     }
5ddef6
 
5ddef6
+    /* Load the resolv.conf file in case a call to dbus' resInit() was missed */
5ddef6
+    if (monitor_be_methods.resInit != NULL) {
5ddef6
+        ret = monitor_be_methods.resInit(NULL, (void *) be_ctx);
5ddef6
+        if (ret != EOK) {
5ddef6
+            DEBUG(SSSDBG_MINOR_FAILURE, "Unable to reload resolv.conf\n");
5ddef6
+        }
5ddef6
+    }
5ddef6
+
5ddef6
     ret = EOK;
5ddef6
 
5ddef6
 done:
5ddef6
-- 
5ddef6
2.37.3
5ddef6