From 07b5dd9640071cf5ca5cd91acfc84af8d0cf69fe Mon Sep 17 00:00:00 2001
From: Tomas Halman <thalman@redhat.com>
Date: Fri, 19 Jul 2019 16:52:43 +0200
Subject: [PATCH 48/48] DYNDNS: dyndns_update is not enough
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When dyndns_update is set to True and dyndns_refresh_interval is
not set or set to 0, DNS is not updated at all.
With this patch DNS is updated when sssd changes its state to
online.
If dyndns_refresh_interval is set, updates are performed as
before - i. e. when comming online and then every
dyndns_refresh_interval.
Resolves:
https://pagure.io/SSSD/sssd/issue/4047
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
---
src/providers/ad/ad_dyndns.c | 6 ++++--
src/providers/ipa/ipa_dyndns.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/providers/ad/ad_dyndns.c b/src/providers/ad/ad_dyndns.c
index c9763d449..00e1d253a 100644
--- a/src/providers/ad/ad_dyndns.c
+++ b/src/providers/ad/ad_dyndns.c
@@ -56,6 +56,7 @@ errno_t ad_dyndns_init(struct be_ctx *be_ctx,
errno_t ret;
const time_t ptask_first_delay = 10;
int period;
+ uint32_t extraflags = 0;
/* nsupdate is available. Dynamic updates
* are supported
@@ -93,15 +94,16 @@ errno_t ad_dyndns_init(struct be_ctx *be_ctx,
period = dp_opt_get_int(ad_opts->dyndns_ctx->opts, DP_OPT_DYNDNS_REFRESH_INTERVAL);
if (period == 0) {
- DEBUG(SSSDBG_OP_FAILURE, "Dyndns update task can't be started, "
+ DEBUG(SSSDBG_TRACE_FUNC, "DNS will not be updated periodically, "
"dyndns_refresh_interval is 0\n");
- return EINVAL;
+ extraflags |= BE_PTASK_NO_PERIODIC;
}
ret = be_ptask_create(ad_opts, be_ctx, period, ptask_first_delay, 0, 0,
period, 0,
ad_dyndns_update_send, ad_dyndns_update_recv, ad_opts,
"Dyndns update",
+ extraflags |
BE_PTASK_OFFLINE_DISABLE |
BE_PTASK_SCHEDULE_FROM_LAST,
NULL);
diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c
index f8831287a..9404ea9cb 100644
--- a/src/providers/ipa/ipa_dyndns.c
+++ b/src/providers/ipa/ipa_dyndns.c
@@ -58,6 +58,7 @@ errno_t ipa_dyndns_init(struct be_ctx *be_ctx,
errno_t ret;
const time_t ptask_first_delay = 10;
int period;
+ uint32_t extraflags = 0;
ctx->be_res = be_ctx->be_res;
if (ctx->be_res == NULL) {
@@ -68,15 +69,16 @@ errno_t ipa_dyndns_init(struct be_ctx *be_ctx,
period = dp_opt_get_int(ctx->dyndns_ctx->opts, DP_OPT_DYNDNS_REFRESH_INTERVAL);
if (period == 0) {
- DEBUG(SSSDBG_OP_FAILURE, "Dyndns task can't be started, "
+ DEBUG(SSSDBG_TRACE_FUNC, "DNS will not be updated periodically, "
"dyndns_refresh_interval is 0\n");
- return EINVAL;
+ extraflags |= BE_PTASK_NO_PERIODIC;
}
ret = be_ptask_create(ctx, be_ctx, period, ptask_first_delay, 0, 0, period,
0,
ipa_dyndns_update_send, ipa_dyndns_update_recv, ctx,
"Dyndns update",
+ extraflags |
BE_PTASK_OFFLINE_DISABLE |
BE_PTASK_SCHEDULE_FROM_LAST,
NULL);
--
2.20.1