URL: https://github.com/SSSD/sssd/pull/730
Author: thalman
 Title: #730: confdb: sssd tools don't handle the implicit domain
Action: synchronized

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/730/head:pr730
git checkout pr730
From 5897e14326817c694a74e1e40e08f0bd7034b87f Mon Sep 17 00:00:00 2001
From: Tomas Halman <thal...@redhat.com>
Date: Wed, 9 Jan 2019 15:59:34 +0100
Subject: [PATCH] confdb: sssd tools don't handle the implicit domain

When no sssd.conf exists, sssctl can not read objects from the cache
This happend because implicit files domain is not taken into
account when creating list of domains. With implicit files domain
it should expand at least to this one domain.

Resolves:
https://pagure.io/SSSD/sssd/issue/3769
---
 src/confdb/confdb.c   | 15 +++++++++++++--
 src/confdb/confdb.h   |  3 ---
 src/monitor/monitor.c | 11 -----------
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index d3fdd3199..6939b3721 100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -42,6 +42,9 @@
 #define RETRIEVE_DOMAIN_ERROR_MSG "Error (%d [%s]) retrieving domain [%s], "\
                                   "skipping!\n"
 
+/* SSSD domain name that is used for the auto-configured files domain */
+#define IMPLICIT_FILES_DOMAIN_NAME "implicit_files"
+
 static char *prepend_cn(char *str, int *slen, const char *comp, int clen)
 {
     char *ret;
@@ -1932,8 +1935,8 @@ static int activate_files_domain(struct confdb_ctx *cdb,
     return ret;
 }
 
-int confdb_ensure_files_domain(struct confdb_ctx *cdb,
-                               const char *implicit_files_dom_name)
+static int confdb_ensure_files_domain(struct confdb_ctx *cdb,
+                                      const char *implicit_files_dom_name)
 {
 #ifdef ADD_FILES_DOMAIN
     const bool default_enable_files = true;
@@ -2166,6 +2169,14 @@ int confdb_expand_app_domains(struct confdb_ctx *cdb)
         return ENOMEM;
     }
 
+    ret = confdb_ensure_files_domain(cdb, IMPLICIT_FILES_DOMAIN_NAME);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_MINOR_FAILURE,
+              "Cannot add the implicit files domain [%d]: %s\n",
+              ret, strerror(ret));
+        /* Not fatal */
+    }
+
     ret = confdb_get_string_as_list(cdb, tmp_ctx,
                                     CONFDB_MONITOR_CONF_ENTRY,
                                     CONFDB_MONITOR_ACTIVE_DOMAINS,
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
index 741d4bc47..76a83de51 100644
--- a/src/confdb/confdb.h
+++ b/src/confdb/confdb.h
@@ -437,9 +437,6 @@ int confdb_get_domain(struct confdb_ctx *cdb,
 int confdb_get_domains(struct confdb_ctx *cdb,
                        struct sss_domain_info **domains);
 
-int confdb_ensure_files_domain(struct confdb_ctx *cdb,
-                               const char *implicit_files_dom_name);
-
 int confdb_expand_app_domains(struct confdb_ctx *cdb);
 
 /**
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 136cf8f27..a227bcf05 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -90,9 +90,6 @@
                                  "that the file is accessible only by the "\
                                  "owner and owned by root.root.\n"
 
-/* SSSD domain name that is used for the auto-configured files domain */
-#define IMPLICIT_FILES_DOMAIN_NAME "implicit_files"
-
 int cmdline_debug_level;
 int cmdline_debug_timestamps;
 int cmdline_debug_microseconds;
@@ -970,14 +967,6 @@ static int get_monitor_config(struct mt_ctx *ctx)
         return ret;
     }
 
-    ret = confdb_ensure_files_domain(ctx->cdb, IMPLICIT_FILES_DOMAIN_NAME);
-    if (ret != EOK) {
-        DEBUG(SSSDBG_MINOR_FAILURE,
-              "Cannot add the implicit files domain [%d]: %s\n",
-              ret, strerror(ret));
-        /* Not fatal */
-    }
-
     ret = confdb_expand_app_domains(ctx->cdb);
     if (ret != EOK) {
         DEBUG(SSSDBG_FATAL_FAILURE, "Failed to expand application domains\n");
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org

Reply via email to