From 28719c1a91f39b99b6a2e7ec4c9052a6fd41b807 Mon Sep 17 00:00:00 2001 From: Ondrej Kos Date: Mon, 5 Aug 2013 13:44:15 +0200 Subject: Clean list of domain requests https://fedorahosted.org/sssd/ticket/1968 When subdomain is removed, there still might be some requests pending. Provided function goes through the list and matching requests are removed. --- src/providers/ad/ad_subdomains.c | 1 + src/providers/data_provider_be.c | 17 +++++++++++++++++ src/providers/dp_backend.h | 2 ++ src/providers/ipa/ipa_subdomains.c | 1 + 4 files changed, 21 insertions(+) diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c index 6e44680e..12965a4f 100644 --- a/src/providers/ad/ad_subdomains.c +++ b/src/providers/ad/ad_subdomains.c @@ -208,6 +208,7 @@ static errno_t ad_subdomains_refresh(struct ad_subdomains_ctx *ctx, } /* Remove the subdomain from the list of LDAP domains */ + be_clean_dom_req_list(ctx->be_ctx, dom->name); sdap_domain_remove(ctx->sdap_id_ctx->opts, dom); } else { /* ok let's try to update it */ diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 52dc5e03..e751b464 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -454,6 +454,23 @@ done: talloc_free(next_be_req); } +void be_clean_dom_req_list(struct be_ctx *be_ctx, const char *domain_name) +{ + struct be_req *be_req; + + DEBUG(SSSDBG_TRACE_FUNC, + ("Removing requests for domain %s\n", domain_name)); + + DLIST_FOR_EACH(be_req, be_ctx->be_reqlist) { + + if (be_req->domain_name == NULL) continue; + + if (strcmp(domain_name, be_req->domain_name) == 0) { + be_req_terminate(be_req, DP_ERR_FATAL, EIO, NULL); + } + } +} + bool be_is_offline(struct be_ctx *ctx) { time_t now = time(NULL); diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h index 42e03647..5763c122 100644 --- a/src/providers/dp_backend.h +++ b/src/providers/dp_backend.h @@ -211,6 +211,8 @@ int be_add_offline_cb(TALLOC_CTX *mem_ctx, struct be_cb **online_cb); void be_run_offline_cb(struct be_ctx *be); +void be_clean_dom_req_list(struct be_ctx *be_ctx, const char *domain_name); + /* from data_provider_fo.c */ enum be_fo_protocol { BE_FO_PROTO_TCP, diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c index 8c3f1765..cf483df5 100644 --- a/src/providers/ipa/ipa_subdomains.c +++ b/src/providers/ipa/ipa_subdomains.c @@ -551,6 +551,7 @@ static errno_t ipa_subdomains_refresh(struct ipa_subdomains_ctx *ctx, } /* Remove the AD ID ctx from the list of LDAP domains */ + be_clean_dom_req_list(ctx->be_ctx, dom->name); ipa_ad_subdom_remove(ctx, dom); } else { /* ok let's try to update it */ -- cgit