Blame SOURCES/0113-LDAP-Log-autofs-rfc2307-config-changes-only-with-ena.patch

b2d430
From b415b9d2b6d016928a2bbcaa710cdc876e4ecc9c Mon Sep 17 00:00:00 2001
b2d430
From: Lukas Slebodnik <lslebodn@redhat.com>
b2d430
Date: Tue, 16 Aug 2016 13:32:06 +0200
b2d430
Subject: [PATCH 113/115] LDAP: Log autofs rfc2307 config changes only with
b2d430
 enabled responder
b2d430
MIME-Version: 1.0
b2d430
Content-Type: text/plain; charset=UTF-8
b2d430
Content-Transfer-Encoding: 8bit
b2d430
b2d430
grep -nE "0x0040" /var/log/sssd/sssd_example.com.log
b2d430
361:(Tue Aug 16 13:04:04 2016) [sssd[be[example.com]]]
b2d430
  [ldap_get_autofs_options] (0x0040): Your configuration uses the autofs
b2d430
  provider with schema set to rfc2307 and default attribute mappings.
b2d430
  The default map has changed in this release, please make sure
b2d430
  the configuration matches the server attributes.
b2d430
b2d430
Reviewed-by: Petr Čech <pcech@redhat.com>
b2d430
---
b2d430
 src/providers/ldap/ldap_options.c | 23 ++++++++++++++++++++++-
b2d430
 1 file changed, 22 insertions(+), 1 deletion(-)
b2d430
b2d430
diff --git a/src/providers/ldap/ldap_options.c b/src/providers/ldap/ldap_options.c
b2d430
index 018f6c31fb6360952308e44979581790b8477dc3..15a2609f07506b6dd442b180651a7e25461976c0 100644
b2d430
--- a/src/providers/ldap/ldap_options.c
b2d430
+++ b/src/providers/ldap/ldap_options.c
b2d430
@@ -444,6 +444,10 @@ static bool has_defaults(struct confdb_ctx *cdb,
b2d430
 static bool ldap_rfc2307_autofs_defaults(struct confdb_ctx *cdb,
b2d430
                                          const char *conf_path)
b2d430
 {
b2d430
+    char **services = NULL;
b2d430
+    errno_t ret;
b2d430
+    bool has_autofs_defaults = false;
b2d430
+
b2d430
     const char *attrs[] = {
b2d430
         rfc2307_autofs_entry_map[SDAP_OC_AUTOFS_ENTRY].opt_name,
b2d430
         /* SDAP_AT_AUTOFS_ENTRY_KEY missing on purpose, its value was
b2d430
@@ -455,7 +459,24 @@ static bool ldap_rfc2307_autofs_defaults(struct confdb_ctx *cdb,
b2d430
         NULL,
b2d430
     };
b2d430
 
b2d430
-    return has_defaults(cdb, conf_path, attrs);
b2d430
+    ret = confdb_get_string_as_list(cdb, cdb,
b2d430
+                                    CONFDB_MONITOR_CONF_ENTRY,
b2d430
+                                    CONFDB_MONITOR_ACTIVE_SERVICES, &services);
b2d430
+    if (ret != EOK) {
b2d430
+        DEBUG(SSSDBG_FATAL_FAILURE, "Unable to read from confdb [%d]: %s\n",
b2d430
+              ret, sss_strerror(ret));
b2d430
+        goto done;
b2d430
+    }
b2d430
+
b2d430
+    if (string_in_list("autofs", services, true) == false) {
b2d430
+        goto done;
b2d430
+    }
b2d430
+
b2d430
+    has_autofs_defaults = has_defaults(cdb, conf_path, attrs);
b2d430
+done:
b2d430
+    talloc_free(services);
b2d430
+
b2d430
+    return has_autofs_defaults;
b2d430
 }
b2d430
 
b2d430
 int ldap_get_autofs_options(TALLOC_CTX *memctx,
b2d430
-- 
b2d430
2.4.11
b2d430