diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2013-12-17 17:22:45 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-12-18 17:33:13 +0100 |
commit | 495ae80f2096e11473f1e4e8b12fe84ffc1daa5d (patch) | |
tree | 68c191350b10a840a90b23b70f83f10ebcd5b4af /src/providers | |
parent | 6df937237ef5c8341cca7abd669610e55c94ce62 (diff) | |
download | sssd-495ae80f2096e11473f1e4e8b12fe84ffc1daa5d.tar.gz sssd-495ae80f2096e11473f1e4e8b12fe84ffc1daa5d.tar.xz sssd-495ae80f2096e11473f1e4e8b12fe84ffc1daa5d.zip |
IPA: Refresh subdomain data structures on startup
Write domain-mappings at startup and initialize internal data structures
on provider startup, not only during updates.
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/ipa/ipa_subdomains.c | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c index 416e21913..56fd4f996 100644 --- a/src/providers/ipa/ipa_subdomains.c +++ b/src/providers/ipa/ipa_subdomains.c @@ -267,6 +267,35 @@ ipa_ad_subdom_refresh(struct be_ctx *be_ctx, return EOK; } +static errno_t +ipa_subdom_reinit(struct ipa_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 = ipa_ad_subdom_refresh(ctx->be_ctx, ctx->id_ctx, ctx->be_ctx->domain); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, ("ipa_ad_subdom_refresh failed.\n")); + return ret; + } + + ret = sss_write_domain_mappings(ctx->be_ctx->domain, + dp_opt_get_bool(ctx->id_ctx->ipa_options->basic, + IPA_SERVER_MODE)); + if (ret != EOK) { + DEBUG(SSSDBG_MINOR_FAILURE, + ("sss_krb5_write_mappings failed.\n")); + /* Just continue */ + } + + return EOK; +} + static void ipa_ad_subdom_remove(struct ipa_subdomains_ctx *ctx, struct sss_domain_info *subdom) @@ -921,27 +950,11 @@ static void ipa_subdomains_handler_done(struct tevent_req *req) } if (refresh_has_changes) { - ret = sysdb_update_subdomains(domain); + ret = ipa_subdom_reinit(ctx->sd_ctx); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("sysdb_update_subdomains failed.\n")); + DEBUG(SSSDBG_OP_FAILURE, ("Could not reinitialize subdomains\n")); goto done; } - - ret = ipa_ad_subdom_refresh(ctx->sd_ctx->be_ctx, ctx->sd_ctx->id_ctx, - domain); - if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("ipa_ad_subdom_refresh failed.\n")); - goto done; - } - - ret = sss_write_domain_mappings(domain, - dp_opt_get_bool(ctx->sd_ctx->id_ctx->ipa_options->basic, - IPA_SERVER_MODE)); - if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, - ("sss_krb5_write_mappings failed.\n")); - /* Just continue */ - } } ret = sysdb_master_domain_update(domain); @@ -1289,7 +1302,7 @@ int ipa_subdom_init(struct be_ctx *be_ctx, DEBUG(SSSDBG_MINOR_FAILURE, ("Failed to add subdom offline callback")); } - ret = sysdb_update_subdomains(be_ctx->domain); + ret = ipa_subdom_reinit(ctx); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, ("Could not load the list of subdomains. " "Users from trusted domains might not be resolved correctly\n")); |