Blame SOURCES/0048-DYNDNS-dyndns_update-is-not-enough.patch

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