>From 2fe848ff555967adf582a68bc1759362b266b984 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 26 Jun 2013 22:43:57 +0200 Subject: [PATCH 2/2] AD: Write out domain-realm mappings --- src/providers/ad/ad_subdomains.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c index 07b523df5466319739e1f44164b7f08156ea214b..2e0452ace2a569d559fab93f1a22faf6a6a4f037 100644 --- a/src/providers/ad/ad_subdomains.c +++ b/src/providers/ad/ad_subdomains.c @@ -86,6 +86,29 @@ struct ad_subdomains_req_ctx { }; static errno_t +ad_write_subdom_mappings(struct sss_domain_info *domain) +{ + errno_t ret; + + ret = sss_write_domain_mappings(domain); + if (ret) { + DEBUG(SSSDBG_OP_FAILURE, ("couldn't write domain-realm mappings\n")); + } + + /* Some mappings might have been written, touch krb5.conf */ + + /* touch krb5.conf to ensure that new mappings are loaded */ + ret = sss_krb5_touch_config(); + if (ret != EOK) { + DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to change last modification time " + "of krb5.conf. Created mappings may not be loaded.\n")); + return ret; + } + + return EOK; +} + +static errno_t ads_store_sdap_subdom(struct ad_subdomains_ctx *ctx, struct sss_domain_info *parent) { @@ -736,6 +759,13 @@ static void ad_subdomains_get_slave_domain_done(struct tevent_req *req) DEBUG(SSSDBG_OP_FAILURE, ("ads_store_sdap_subdom failed.\n")); goto done; } + + ret = ad_write_subdom_mappings(ctx->sd_ctx->be_ctx->domain); + if (ret != EOK) { + DEBUG(SSSDBG_MINOR_FAILURE, + ("sss_krb5_write_mappings failed.\n")); + /* Just continue */ + } } ret = EOK; -- 1.8.3.1