summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2017-08-31 22:30:25 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2017-09-06 16:28:26 +0200
commitf00591a4615720640cf01b1c408315b57dd397dc (patch)
tree2c97bf044a85a9cf404889174aa6fcde008f8a69
parent2e72ababbbadda4c4036f99528460c1d595e0941 (diff)
downloadsssd-f00591a4615720640cf01b1c408315b57dd397dc.tar.gz
sssd-f00591a4615720640cf01b1c408315b57dd397dc.tar.xz
sssd-f00591a4615720640cf01b1c408315b57dd397dc.zip
ipa: make sure view name is initialized at startup
sysdb_master_domain_update() can only set the view name properly if it was not set before but it might be called multiple times before the view name is available if the cache is empty. Since ipa_apply_view() keeps track if the view name was already set at startup or not the name can safely be cleaned here before sysdb_master_domain_update() is called. Resolves: https://pagure.io/SSSD/sssd/issue/3501 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r--src/providers/ipa/ipa_subdomains.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
index 7f8bcdbad..8a4657bc0 100644
--- a/src/providers/ipa/ipa_subdomains.c
+++ b/src/providers/ipa/ipa_subdomains.c
@@ -780,6 +780,18 @@ done:
return ret;
}
+static void clean_view_name(struct sss_domain_info *domain)
+{
+ struct sss_domain_info *dom = domain;
+
+ while (dom) {
+ dom->has_views = false;
+ talloc_free(discard_const(dom->view_name));
+ dom->view_name = NULL;
+ dom = get_next_domain(dom, SSS_GND_DESCEND);
+ }
+}
+
static errno_t ipa_apply_view(struct sss_domain_info *domain,
struct ipa_id_ctx *ipa_id_ctx,
const char *view_name,
@@ -872,7 +884,12 @@ static errno_t ipa_apply_view(struct sss_domain_info *domain,
}
if (!read_at_init) {
- /* refresh view data of all domains at startup */
+ /* refresh view data of all domains at startup, since
+ * sysdb_master_domain_update and sysdb_update_subdomains might have
+ * been called earlier without the proper view name the name is
+ * cleaned here before the calls. This is acceptable because this is
+ * the initial setup (!read_at_init). */
+ clean_view_name(domain);
ret = sysdb_master_domain_update(domain);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, "sysdb_master_domain_update failed "