dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0034-IPA-Call-ipa_ad_subdom_refresh-when-server-mode-is-i.patch

2fc102
From 414d36bc08bf3ddb8c742f4548711cc0b448bb85 Mon Sep 17 00:00:00 2001
2fc102
From: Jakub Hrozek <jhrozek@redhat.com>
2fc102
Date: Wed, 18 Dec 2013 18:14:46 +0100
2fc102
Subject: [PATCH 34/34] IPA: Call ipa_ad_subdom_refresh when server mode is
2fc102
 initialized
2fc102
2fc102
ipa_ad_subdom_refresh was called before IPA server context was
2fc102
initialized. On IPA server, this caused the code to dereference a NULL
2fc102
pointer and crash.
2fc102
---
2fc102
 src/providers/ipa/ipa_subdomains.c | 20 ++++++++++++++------
2fc102
 1 file changed, 14 insertions(+), 6 deletions(-)
2fc102
2fc102
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
2fc102
index 56fd4f99654aa07f822c49d6d39526765785f0de..2d28d7cd0538b204eb2818e71e029dec19456a1c 100644
2fc102
--- a/src/providers/ipa/ipa_subdomains.c
2fc102
+++ b/src/providers/ipa/ipa_subdomains.c
2fc102
@@ -278,12 +278,6 @@ ipa_subdom_reinit(struct ipa_subdomains_ctx *ctx)
2fc102
         return ret;
2fc102
     }
2fc102
 
2fc102
-    ret = ipa_ad_subdom_refresh(ctx->be_ctx, ctx->id_ctx, ctx->be_ctx->domain);
2fc102
-    if (ret != EOK) {
2fc102
-        DEBUG(SSSDBG_OP_FAILURE, ("ipa_ad_subdom_refresh failed.\n"));
2fc102
-        return ret;
2fc102
-    }
2fc102
-
2fc102
     ret = sss_write_domain_mappings(ctx->be_ctx->domain,
2fc102
                     dp_opt_get_bool(ctx->id_ctx->ipa_options->basic,
2fc102
                     IPA_SERVER_MODE));
2fc102
@@ -955,6 +949,13 @@ static void ipa_subdomains_handler_done(struct tevent_req *req)
2fc102
             DEBUG(SSSDBG_OP_FAILURE, ("Could not reinitialize subdomains\n"));
2fc102
             goto done;
2fc102
         }
2fc102
+
2fc102
+        ret = ipa_ad_subdom_refresh(ctx->sd_ctx->be_ctx, ctx->sd_ctx->id_ctx,
2fc102
+                                    domain);
2fc102
+        if (ret != EOK) {
2fc102
+            DEBUG(SSSDBG_OP_FAILURE, ("ipa_ad_subdom_refresh failed.\n"));
2fc102
+            goto done;
2fc102
+        }
2fc102
     }
2fc102
 
2fc102
     ret = sysdb_master_domain_update(domain);
2fc102
@@ -1316,6 +1317,7 @@ int ipa_ad_subdom_init(struct be_ctx *be_ctx,
2fc102
 {
2fc102
     char *realm;
2fc102
     char *hostname;
2fc102
+    errno_t ret;
2fc102
 
2fc102
     if (dp_opt_get_bool(id_ctx->ipa_options->basic,
2fc102
                         IPA_SERVER_MODE) == false) {
2fc102
@@ -1360,5 +1362,11 @@ int ipa_ad_subdom_init(struct be_ctx *be_ctx,
2fc102
     id_ctx->server_mode->trusts = NULL;
2fc102
     id_ctx->server_mode->ext_groups = NULL;
2fc102
 
2fc102
+    ret = ipa_ad_subdom_refresh(be_ctx, id_ctx, be_ctx->domain);
2fc102
+    if (ret != EOK) {
2fc102
+        DEBUG(SSSDBG_OP_FAILURE, ("ipa_ad_subdom_refresh failed.\n"));
2fc102
+        return ret;
2fc102
+    }
2fc102
+
2fc102
     return EOK;
2fc102
 }
2fc102
-- 
2fc102
1.8.4.2
2fc102