Blob Blame History Raw
From b415b9d2b6d016928a2bbcaa710cdc876e4ecc9c Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Tue, 16 Aug 2016 13:32:06 +0200
Subject: [PATCH 113/115] LDAP: Log autofs rfc2307 config changes only with
 enabled responder
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

grep -nE "0x0040" /var/log/sssd/sssd_example.com.log
361:(Tue Aug 16 13:04:04 2016) [sssd[be[example.com]]]
  [ldap_get_autofs_options] (0x0040): Your configuration uses the autofs
  provider with schema set to rfc2307 and default attribute mappings.
  The default map has changed in this release, please make sure
  the configuration matches the server attributes.

Reviewed-by: Petr Čech <pcech@redhat.com>
---
 src/providers/ldap/ldap_options.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/providers/ldap/ldap_options.c b/src/providers/ldap/ldap_options.c
index 018f6c31fb6360952308e44979581790b8477dc3..15a2609f07506b6dd442b180651a7e25461976c0 100644
--- a/src/providers/ldap/ldap_options.c
+++ b/src/providers/ldap/ldap_options.c
@@ -444,6 +444,10 @@ static bool has_defaults(struct confdb_ctx *cdb,
 static bool ldap_rfc2307_autofs_defaults(struct confdb_ctx *cdb,
                                          const char *conf_path)
 {
+    char **services = NULL;
+    errno_t ret;
+    bool has_autofs_defaults = false;
+
     const char *attrs[] = {
         rfc2307_autofs_entry_map[SDAP_OC_AUTOFS_ENTRY].opt_name,
         /* SDAP_AT_AUTOFS_ENTRY_KEY missing on purpose, its value was
@@ -455,7 +459,24 @@ static bool ldap_rfc2307_autofs_defaults(struct confdb_ctx *cdb,
         NULL,
     };
 
-    return has_defaults(cdb, conf_path, attrs);
+    ret = confdb_get_string_as_list(cdb, cdb,
+                                    CONFDB_MONITOR_CONF_ENTRY,
+                                    CONFDB_MONITOR_ACTIVE_SERVICES, &services);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_FATAL_FAILURE, "Unable to read from confdb [%d]: %s\n",
+              ret, sss_strerror(ret));
+        goto done;
+    }
+
+    if (string_in_list("autofs", services, true) == false) {
+        goto done;
+    }
+
+    has_autofs_defaults = has_defaults(cdb, conf_path, attrs);
+done:
+    talloc_free(services);
+
+    return has_autofs_defaults;
 }
 
 int ldap_get_autofs_options(TALLOC_CTX *memctx,
-- 
2.4.11