dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0030-be-use-be_is_offline-for-the-main-domain-when-asking.patch

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