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