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