summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/providers/ad/ad_subdomains.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
index 100fb13e9..e438a688c 100644
--- a/src/providers/ad/ad_subdomains.c
+++ b/src/providers/ad/ad_subdomains.c
@@ -414,6 +414,31 @@ done:
return ret;
}
+static errno_t ad_subdom_reinit(struct ad_subdomains_ctx *ctx)
+{
+ errno_t ret;
+
+ ret = sysdb_update_subdomains(ctx->be_ctx->domain);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, ("sysdb_update_subdomains failed.\n"));
+ return ret;
+ }
+
+ ret = sss_write_domain_mappings(ctx->be_ctx->domain, false);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_MINOR_FAILURE, ("sss_krb5_write_mappings failed.\n"));
+ /* Just continue */
+ }
+
+ ret = ads_store_sdap_subdom(ctx, ctx->be_ctx->domain);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE, ("ads_store_sdap_subdom failed.\n"));
+ return ret;
+ }
+
+ return EOK;
+}
+
static void ad_subdomains_get_conn_done(struct tevent_req *req);
static void ad_subdomains_master_dom_done(struct tevent_req *req);
static errno_t ad_subdomains_get_slave(struct ad_subdomains_req_ctx *ctx);
@@ -619,25 +644,15 @@ static void ad_subdomains_get_slave_domain_done(struct tevent_req *req)
goto done;
}
- if (refresh_has_changes) {
- ret = sysdb_update_subdomains(ctx->sd_ctx->be_ctx->domain);
- if (ret != EOK) {
- DEBUG(SSSDBG_OP_FAILURE, ("sysdb_update_subdomains failed.\n"));
- goto done;
- }
+ DEBUG(SSSDBG_TRACE_LIBS, ("There are %schanges\n",
+ refresh_has_changes ? "" : "no "));
- ret = ads_store_sdap_subdom(ctx->sd_ctx, ctx->sd_ctx->be_ctx->domain);
+ if (refresh_has_changes) {
+ ret = ad_subdom_reinit(ctx->sd_ctx);
if (ret != EOK) {
- DEBUG(SSSDBG_OP_FAILURE, ("ads_store_sdap_subdom failed.\n"));
+ DEBUG(SSSDBG_OP_FAILURE, ("Could not reinitialize subdomains\n"));
goto done;
}
-
- ret = sss_write_domain_mappings(ctx->sd_ctx->be_ctx->domain, false);
- if (ret != EOK) {
- DEBUG(SSSDBG_MINOR_FAILURE,
- ("sss_krb5_write_mappings failed.\n"));
- /* Just continue */
- }
}
ret = EOK;
@@ -783,9 +798,9 @@ int ad_subdom_init(struct be_ctx *be_ctx,
return EFAULT;
}
- ret = sysdb_update_subdomains(be_ctx->domain);
+ ret = ad_subdom_reinit(ctx);
if (ret != EOK) {
- DEBUG(SSSDBG_MINOR_FAILURE, ("Could not load the list of subdomains. "
+ DEBUG(SSSDBG_MINOR_FAILURE, ("Could not reinitialize subdomains. "
"Users from trusted domains might not be resolved correctly\n"));
/* Ignore this error and try to discover the subdomains later */
}