[SSSD] [PATCH] IPA: Call ipa_ad_subdom_refresh when server mode is initialized

Jakub Hrozek jhrozek at redhat.com
Wed Dec 18 17:17:50 UTC 2013


Hi,

I'm sorry, but I broke the IPA server mode with my previous patch :-(

ipa_ad_subdom_refresh was called before IPA server context was
initialized. On IPA server, this caused the code to dereference a NULL
pointer and crash.
-------------- next part --------------
>From 855e3995e88729087c2136a704df6d7dd2e870ce Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 18 Dec 2013 18:14:46 +0100
Subject: [PATCH] IPA: Call ipa_ad_subdom_refresh when server mode is
 initialized

ipa_ad_subdom_refresh was called before IPA server context was
initialized. On IPA server, this caused the code to dereference a NULL
pointer and crash.
---
 src/providers/ipa/ipa_subdomains.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
index 56fd4f99654aa07f822c49d6d39526765785f0de..2d28d7cd0538b204eb2818e71e029dec19456a1c 100644
--- a/src/providers/ipa/ipa_subdomains.c
+++ b/src/providers/ipa/ipa_subdomains.c
@@ -278,12 +278,6 @@ ipa_subdom_reinit(struct ipa_subdomains_ctx *ctx)
         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));
@@ -955,6 +949,13 @@ static void ipa_subdomains_handler_done(struct tevent_req *req)
             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 = sysdb_master_domain_update(domain);
@@ -1316,6 +1317,7 @@ int ipa_ad_subdom_init(struct be_ctx *be_ctx,
 {
     char *realm;
     char *hostname;
+    errno_t ret;
 
     if (dp_opt_get_bool(id_ctx->ipa_options->basic,
                         IPA_SERVER_MODE) == false) {
@@ -1360,5 +1362,11 @@ int ipa_ad_subdom_init(struct be_ctx *be_ctx,
     id_ctx->server_mode->trusts = NULL;
     id_ctx->server_mode->ext_groups = NULL;
 
+    ret = ipa_ad_subdom_refresh(be_ctx, id_ctx, be_ctx->domain);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_OP_FAILURE, ("ipa_ad_subdom_refresh failed.\n"));
+        return ret;
+    }
+
     return EOK;
 }
-- 
1.8.3.1



More information about the sssd-devel mailing list