summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-10-22 16:21:01 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-10-25 22:18:55 +0200
commite1ac5897cd266d054ba3045dfed8a36a95901d81 (patch)
treeff01500459304fb092f57564fa1fe00b10646c2f
parent6f31312c95a67abe7c77a6ba985e10d58468addb (diff)
downloadsssd-e1ac5897cd266d054ba3045dfed8a36a95901d81.tar.gz
sssd-e1ac5897cd266d054ba3045dfed8a36a95901d81.tar.xz
sssd-e1ac5897cd266d054ba3045dfed8a36a95901d81.zip
dp: free sdap domain if subdomain is removed
Resolves: https://fedorahosted.org/sssd/ticket/1968
-rw-r--r--src/providers/ad/ad_subdomains.c11
-rw-r--r--src/providers/ipa/ipa_subdomains.c4
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,