summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ad/ad_common.c4
-rw-r--r--src/providers/ad/ad_dyndns.c7
-rw-r--r--src/providers/dp_dyndns.c16
-rw-r--r--src/providers/dp_dyndns.h7
-rw-r--r--src/providers/ipa/ipa_common.c3
-rw-r--r--src/providers/ipa/ipa_dyndns.c7
6 files changed, 34 insertions, 10 deletions
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
index e0a55c6dc..e34199959 100644
--- a/src/providers/ad/ad_common.c
+++ b/src/providers/ad/ad_common.c
@@ -705,8 +705,8 @@ errno_t ad_get_dyndns_options(struct be_ctx *be_ctx,
{
errno_t ret;
- ret = be_nsupdate_init(ad_opts, be_ctx, ad_dyndns_opts, ad_dyndns_timer,
- ad_opts, &ad_opts->dyndns_ctx);
+ ret = be_nsupdate_init(ad_opts, be_ctx, ad_dyndns_opts,
+ &ad_opts->dyndns_ctx);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
("Cannot initialize AD dyndns opts [%d]: %s\n",
diff --git a/src/providers/ad/ad_dyndns.c b/src/providers/ad/ad_dyndns.c
index 2b2d24625..4e9ed852f 100644
--- a/src/providers/ad/ad_dyndns.c
+++ b/src/providers/ad/ad_dyndns.c
@@ -70,6 +70,13 @@ errno_t ad_dyndns_init(struct be_ctx *be_ctx,
return EINVAL;
}
+ ret = be_nsupdate_init_timer(ad_opts->dyndns_ctx, be_ctx->ev,
+ ad_dyndns_timer, ad_opts);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Could not set up periodic update\n"));
+ return ret;
+ }
+
ret = be_add_online_cb(be_ctx, be_ctx,
ad_dyndns_update,
ad_opts, NULL);
diff --git a/src/providers/dp_dyndns.c b/src/providers/dp_dyndns.c
index 8cf42443a..1b710b554 100644
--- a/src/providers/dp_dyndns.c
+++ b/src/providers/dp_dyndns.c
@@ -1181,8 +1181,6 @@ static struct dp_option default_dyndns_opts[] = {
errno_t
be_nsupdate_init(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx,
struct dp_option *defopts,
- nsupdate_timer_fn_t timer_callback,
- void *timer_pvt,
struct be_nsupdate_ctx **_ctx)
{
errno_t ret;
@@ -1212,10 +1210,20 @@ be_nsupdate_init(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx,
return EINVAL;
}
+ *_ctx = ctx;
+ return ERR_OK;
+}
+
+errno_t be_nsupdate_init_timer(struct be_nsupdate_ctx *ctx,
+ struct tevent_context *ev,
+ nsupdate_timer_fn_t timer_callback,
+ void *timer_pvt)
+{
+ if (ctx == NULL) return EINVAL;
+
ctx->timer_callback = timer_callback;
ctx->timer_pvt = timer_pvt;
- be_nsupdate_timer_schedule(be_ctx->ev, ctx);
+ be_nsupdate_timer_schedule(ev, ctx);
- *_ctx = ctx;
return ERR_OK;
}
diff --git a/src/providers/dp_dyndns.h b/src/providers/dp_dyndns.h
index 14b2dd08b..1e81c9b91 100644
--- a/src/providers/dp_dyndns.h
+++ b/src/providers/dp_dyndns.h
@@ -67,10 +67,13 @@ errno_t be_nsupdate_check(void);
errno_t
be_nsupdate_init(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx,
struct dp_option *defopts,
- nsupdate_timer_fn_t timer_callback,
- void *timer_pvt,
struct be_nsupdate_ctx **_ctx);
+errno_t be_nsupdate_init_timer(struct be_nsupdate_ctx *ctx,
+ struct tevent_context *ev,
+ nsupdate_timer_fn_t timer_callback,
+ void *timer_pvt);
+
void be_nsupdate_timer_schedule(struct tevent_context *ev,
struct be_nsupdate_ctx *ctx);
diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c
index baece274e..509b2abd0 100644
--- a/src/providers/ipa/ipa_common.c
+++ b/src/providers/ipa/ipa_common.c
@@ -1019,8 +1019,7 @@ errno_t ipa_get_dyndns_options(struct be_ctx *be_ctx,
bool update;
int ttl;
- ret = be_nsupdate_init(ctx, be_ctx, ipa_dyndns_opts, ipa_dyndns_timer,
- ctx, &ctx->dyndns_ctx);
+ ret = be_nsupdate_init(ctx, be_ctx, ipa_dyndns_opts, &ctx->dyndns_ctx);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
("Cannot initialize IPA dyndns opts [%d]: %s\n",
diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c
index 81dae94a5..4e75a197a 100644
--- a/src/providers/ipa/ipa_dyndns.c
+++ b/src/providers/ipa/ipa_dyndns.c
@@ -44,6 +44,13 @@ errno_t ipa_dyndns_init(struct be_ctx *be_ctx,
return EINVAL;
}
+ ret = be_nsupdate_init_timer(ctx->dyndns_ctx, be_ctx->ev,
+ ipa_dyndns_timer, ctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Could not set up periodic update\n"));
+ return ret;
+ }
+
ret = be_add_online_cb(be_ctx, be_ctx,
ipa_dyndns_update,
ctx, NULL);