diff options
author | Pavel Březina <pbrezina@redhat.com> | 2013-10-22 16:21:01 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-10-25 22:12:19 +0200 |
commit | d19e343d3fcb0780300d69ba5813ca4762ca9b98 (patch) | |
tree | de59bb71d5f00a981bd45541535446751924b351 | |
parent | a09ef85a90b52c0524af420c18f29f888a723412 (diff) | |
download | sssd-d19e343d3fcb0780300d69ba5813ca4762ca9b98.tar.gz sssd-d19e343d3fcb0780300d69ba5813ca4762ca9b98.tar.xz sssd-d19e343d3fcb0780300d69ba5813ca4762ca9b98.zip |
dp: free sdap domain if subdomain is removed
Resolves:
https://fedorahosted.org/sssd/ticket/1968
-rw-r--r-- | src/providers/ad/ad_subdomains.c | 11 | ||||
-rw-r--r-- | src/providers/ipa/ipa_subdomains.c | 4 |
2 files changed, 15 insertions, 0 deletions
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, |