summaryrefslogtreecommitdiffstats
path: root/src/providers/ipa
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-12-17 17:22:45 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-12-19 20:22:25 +0100
commit3a1056929310cf304449baf3feed94bc8fe46383 (patch)
tree76930b8fb808e439bad344576d79427a78f655c4 /src/providers/ipa
parent1213f1a45e222b3c1b304262c51900d8ab2a886a (diff)
downloadsssd-3a1056929310cf304449baf3feed94bc8fe46383.tar.gz
sssd-3a1056929310cf304449baf3feed94bc8fe46383.tar.xz
sssd-3a1056929310cf304449baf3feed94bc8fe46383.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/ipa')
-rw-r--r--src/providers/ipa/ipa_subdomains.c51
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"));