From dfa7bf1133f002a9fbbd3495a70909913db25b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Fri, 14 Sep 2018 12:30:57 +0200 Subject: [PATCH 55/83] be: use be_is_offline for the main domain when asking for domain status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DOM_ACTIVE/INACTIVE flag is not used with the main domain as it is used only for subdomains. Resolves: https://pagure.io/SSSD/sssd/issue/3830 Reviewed-by: Michal Židek --- src/providers/data_provider/dp_iface_backend.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/providers/data_provider/dp_iface_backend.c b/src/providers/data_provider/dp_iface_backend.c index 25a00f3..85159a7 100644 --- a/src/providers/data_provider/dp_iface_backend.c +++ b/src/providers/data_provider/dp_iface_backend.c @@ -37,15 +37,23 @@ dp_backend_is_online(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain; if (SBUS_REQ_STRING_IS_EMPTY(domname)) { - *_is_online = be_is_offline(be_ctx); - return EOK; + domain = be_ctx->domain; + } else { + domain = find_domain_by_name(be_ctx->domain, domname, false); + if (domain == NULL) { + return ERR_DOMAIN_NOT_FOUND; + } } - domain = find_domain_by_name(be_ctx->domain, domname, false); - if (domain == NULL) { - return ERR_DOMAIN_NOT_FOUND; + /** + * FIXME: https://pagure.io/SSSD/sssd/issue/3831 + * domain->state is set only for subdomains not for the main domain + */ + if (be_ctx->domain == domain) { + *_is_online = be_is_offline(be_ctx) == false; + } else { + *_is_online = domain->state == DOM_ACTIVE; } - *_is_online = domain->state == DOM_ACTIVE; return EOK; } -- 2.9.5