From e1ac5897cd266d054ba3045dfed8a36a95901d81 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Tue, 22 Oct 2013 16:21:01 +0200 Subject: dp: free sdap domain if subdomain is removed Resolves: https://fedorahosted.org/sssd/ticket/1968 --- src/providers/ad/ad_subdomains.c | 11 +++++++++++ src/providers/ipa/ipa_subdomains.c | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c index 1d6b72c34..88d333ada 100644 --- a/src/providers/ad/ad_subdomains.c +++ b/src/providers/ad/ad_subdomains.c @@ -180,6 +180,7 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx, int count, struct sysdb_attrs **reply, bool *changes) { + struct sdap_domain *sdom; struct sss_domain_info *domain, *dom; bool handled[count]; const char *value; @@ -216,8 +217,18 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx, goto done; } + sdom = sdap_domain_get(ctx->sdap_id_ctx->opts, dom); + if (sdom == NULL) { + DEBUG(SSSDBG_CRIT_FAILURE, ("BUG: Domain does not exist?\n")); + continue; + } + /* Remove the subdomain from the list of LDAP domains */ sdap_domain_remove(ctx->sdap_id_ctx->opts, dom); + + /* terminate all requests for this subdomain so we can free it */ + be_terminate_domain_requests(ctx->be_ctx, dom->name); + talloc_zfree(sdom); } else { /* ok let's try to update it */ ret = ad_subdom_store(ctx, domain, reply[c]); diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c index 64db70dde..150c009ce 100644 --- a/src/providers/ipa/ipa_subdomains.c +++ b/src/providers/ipa/ipa_subdomains.c @@ -295,6 +295,10 @@ ipa_ad_subdom_remove(struct ipa_subdomains_ctx *ctx, sdap_domain_remove(iter->ad_id_ctx->sdap_id_ctx->opts, subdom); DLIST_REMOVE(ctx->id_ctx->server_mode->trusts, iter); + + /* terminate all requests for this subdomain so we can free it */ + be_terminate_domain_requests(ctx->be_ctx, subdom->name); + talloc_zfree(sdom); } const char *get_flat_name_from_subdomain_name(struct be_ctx *be_ctx, -- cgit