Blame SOURCES/0046-Ticket-47636-Error-log-levels-not-displayed-correctl.patch

f92ce9
From cac085393e5d3ea996b9dd19811088f675c15b5f Mon Sep 17 00:00:00 2001
f92ce9
From: Mark Reynolds <mreynolds@redhat.com>
f92ce9
Date: Mon, 8 Dec 2014 15:50:53 -0500
f92ce9
Subject: [PATCH 46/53] Ticket 47636 - Error log levels not displayed correctly
f92ce9
f92ce9
Bug Description:  Searching for nsslapd-errorlog-level returns an
f92ce9
                  unexpected value (the level plus 16384).
f92ce9
f92ce9
Fix Description:  This is a regression from the first fix for this
f92ce9
                  ticket.  The fix is to only adjust the level zero,
f92ce9
                  to its full default value of 16384.
f92ce9
f92ce9
https://fedorahosted.org/389/ticket/47636
f92ce9
f92ce9
Reviewed by: rmeggins(Thanks!)
f92ce9
f92ce9
(cherry picked from commit f12e1216cc7baf128911d519cc8758c1c9277957)
f92ce9
(cherry picked from commit 7b32ab042511f69e544f91b318387edd00129292)
f92ce9
---
f92ce9
 ldap/servers/slapd/libglobs.c | 22 ++++++++++++++++++++--
f92ce9
 1 file changed, 20 insertions(+), 2 deletions(-)
f92ce9
f92ce9
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
f92ce9
index b437112..b2b40d3 100644
f92ce9
--- a/ldap/servers/slapd/libglobs.c
f92ce9
+++ b/ldap/servers/slapd/libglobs.c
f92ce9
@@ -118,6 +118,7 @@ typedef enum {
f92ce9
 	CONFIG_CONSTANT_STRING, /* for #define values, e.g. */
f92ce9
 	CONFIG_SPECIAL_REFERRALLIST, /* this is a berval list */
f92ce9
 	CONFIG_SPECIAL_SSLCLIENTAUTH, /* maps strings to an enumeration */
f92ce9
+	CONFIG_SPECIAL_ERRORLOGLEVEL, /* requires & with LDAP_DEBUG_ANY */
f92ce9
 	CONFIG_STRING_OR_EMPTY, /* use an empty string */
f92ce9
 	CONFIG_SPECIAL_ANON_ACCESS_SWITCH, /* maps strings to an enumeration */
f92ce9
 	CONFIG_SPECIAL_VALIDATE_CERT_SWITCH, /* maps strings to an enumeration */
f92ce9
@@ -289,7 +290,7 @@ slapi_onoff_t init_mempool_switch;
f92ce9
 static int
f92ce9
 isInt(ConfigVarType type)
f92ce9
 {
f92ce9
-    return type == CONFIG_INT || type == CONFIG_ON_OFF || type == CONFIG_SPECIAL_SSLCLIENTAUTH;
f92ce9
+    return type == CONFIG_INT || type == CONFIG_ON_OFF || type == CONFIG_SPECIAL_SSLCLIENTAUTH || type == CONFIG_SPECIAL_ERRORLOGLEVEL;
f92ce9
 }
f92ce9
 
f92ce9
 /* the caller will typically have to cast the result based on the ConfigVarType */
f92ce9
@@ -339,7 +340,7 @@ static struct config_get_and_set {
f92ce9
 	{CONFIG_LOGLEVEL_ATTRIBUTE, config_set_errorlog_level,
f92ce9
 		NULL, 0,
f92ce9
 		(void**)&global_slapdFrontendConfig.errorloglevel,
f92ce9
-		CONFIG_INT, NULL, STRINGIFYDEFINE(SLAPD_DEFAULT_ERRORLOG_LEVEL)},
f92ce9
+		CONFIG_SPECIAL_ERRORLOGLEVEL, NULL, NULL},
f92ce9
 	{CONFIG_ERRORLOG_LOGGING_ENABLED_ATTRIBUTE, NULL,
f92ce9
 		log_set_logging, SLAPD_ERROR_LOG,
f92ce9
 		(void**)&global_slapdFrontendConfig.errorlog_logging_enabled,
f92ce9
@@ -7563,6 +7564,23 @@ config_set_value(
f92ce9
                                      *((char **)value) : "unknown");
f92ce9
         break;
f92ce9
 
f92ce9
+    case CONFIG_SPECIAL_ERRORLOGLEVEL:
f92ce9
+        if (value) {
f92ce9
+            int ival = *(int *)value;
f92ce9
+            ival &= ~LDAP_DEBUG_ANY;
f92ce9
+            if (ival == 0) {
f92ce9
+                /*
f92ce9
+                 * Don't store the default value as zero,
f92ce9
+                 * but as its real value.
f92ce9
+                 */
f92ce9
+                ival = LDAP_DEBUG_ANY;
f92ce9
+            }
f92ce9
+            slapi_entry_attr_set_int(e, cgas->attr_name, ival);
f92ce9
+        }
f92ce9
+        else
f92ce9
+            slapi_entry_attr_set_charptr(e, cgas->attr_name, "");
f92ce9
+        break;
f92ce9
+
f92ce9
     case CONFIG_SPECIAL_ANON_ACCESS_SWITCH:
f92ce9
         if (!value) {
f92ce9
             slapi_entry_attr_set_charptr(e, cgas->attr_name, "off");
f92ce9
-- 
f92ce9
1.9.3
f92ce9