Thursday, June 8, 2017

[389-commits] [389-ds-base] 01/01: Ticket 49227 - ldapsearch does not return the expected Error log level

This is an automated email from the git hooks/post-receive script.

mreynolds pushed a commit to branch 389-ds-base-1.3.6
in repository 389-ds-base.

commit 2141ea7ad503673a87d9d7ff24afc4be97090980
Author: Mark Reynolds <mreynolds@redhat.com>
Date: Wed Jun 7 15:29:48 2017 -0400

Ticket 49227 - ldapsearch does not return the expected Error log level

Bug Description: The default log level 16384 is stripped from the loglevel
returned to a client. This can return an unexpected result.

Fix Description: Do not strip the default level. Also removed old code that
logged a useless message if verbose logging was being used.

https://pagure.io/389-ds-base/issue/49227

Reviewed by: firstyear(Thanks!)

(cherry picked from commit 3cf8563b07a7e70e8e402b1f880953fc8fe36136)
---
dirsrvtests/tests/tickets/ticket49227_test.py | 36 +++++++++++++++++++++++++++
ldap/servers/slapd/config.c | 14 -----------
ldap/servers/slapd/libglobs.c | 2 ++
3 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/dirsrvtests/tests/tickets/ticket49227_test.py b/dirsrvtests/tests/tickets/ticket49227_test.py
index 86e0b9a..494063f 100644
--- a/dirsrvtests/tests/tickets/ticket49227_test.py
+++ b/dirsrvtests/tests/tickets/ticket49227_test.py
@@ -15,7 +15,10 @@ if DEBUGGING:
else:
logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
+
DEFAULT_LEVEL = "16384"
+COMB_LEVEL = "73864" # 65536+8192+128+8 = 73864
+COMB_DEFAULT_LEVEL = "90248" # 65536+8192+128+8+16384 = 90248


def set_level(topo, level):
@@ -103,6 +106,39 @@ def test_ticket49227(topo):
log.fatal('Connection logging is still on')
assert False

+ # Set a combined level that includes the default level
+ set_level(topo, COMB_DEFAULT_LEVEL)
+ level = get_level(topo)
+ if level != COMB_DEFAULT_LEVEL:
+ log.fatal('Incorrect combined logging level with default level: %s expected %s' %
+ (level, COMB_DEFAULT_LEVEL))
+ assert False
+
+ # Set a combined level that does not includes the default level
+ set_level(topo, COMB_LEVEL)
+ level = get_level(topo)
+ if level != COMB_LEVEL:
+ log.fatal('Incorrect combined logging level without default level: %s expected %s' %
+ (level, COMB_LEVEL))
+ assert False
+
+ # Check our level is present after a restart - previous level was COMB_LEVEL
+ topo.standalone.restart()
+ log_size = get_log_size(topo) # Grab the log size for our next check
+ level = get_level(topo) # This should trigger connection logging
+ if level != COMB_LEVEL:
+ log.fatal('Incorrect combined logging level with default level: %s expected %s' %
+ (level, COMB_LEVEL))
+ assert False
+
+ # Now check the actual levels are still working
+ new_size = get_log_size(topo)
+ if new_size == log_size:
+ # Size should be different
+ log.fatal('Combined logging is not working')
+ assert False
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index 83a6f2b..e37179d 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -289,20 +289,6 @@ slapd_bootstrap_config(const char *configdir)
CONFIG_LOGLEVEL_ATTRIBUTE, errorbuf);
}
}
- else
- {
- if (strcmp(loglevel, "0") ||
- config_get_errorlog_level() != SLAPD_DEFAULT_ERRORLOG_LEVEL)
- {
- /*
- * loglevel of zero and SLAPD_DEFAULT_ERRORLOG_LEVEL are the
- * same. Only report an error if they are different.
- */
- slapi_log_err(SLAPI_LOG_NOTICE, "slapd_bootstrap_config",
- "%s: ignoring %s (since -d %d was given on the command line)\n",
- CONFIG_LOGLEVEL_ATTRIBUTE, loglevel, config_get_errorlog_level());
- }
- }
}

/* set the cert dir; needed in slapd_nss_init */
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index e488885..cd2ebab 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -7735,6 +7735,8 @@ config_set_value(
* but as its real value.
*/
ival = LDAP_DEBUG_ANY;
+ } else {
+ ival = *(int *)value;
}
slapi_entry_attr_set_int(e, cgas->attr_name, ival);
}

--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org

No comments:

Post a Comment