From 64e02a0ac79bd1bd14adcbf7cb3eba299e17a2b5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 6 Oct 2016 21:40:18 +0200 Subject: [PATCH] logging: protect VPN_PLUGIN logging domain VPN_PLUGIN is special. With # nmcli general logging level TRACE domains ALL the logging verbosity of VPN_PLUGIN domain should not be set higher then info. The user has to explicitly set it via: # nmcli general logging level TRACE domains ALL,VPN_PLUGIN:TRACE This was not the case for # nmcli general logging level TRACE Fix that. --- src/nm-logging.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nm-logging.c b/src/nm-logging.c index e695a60a25..f8ecf0c94b 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -329,6 +329,13 @@ nm_logging_setup (const char *level, bits = 0; + if (domains_free) { + /* The caller didn't provide any domains to set (`nmcli general logging level DEBUG`). + * We reset all domains that were previously set, but we still want to protect + * VPN_PLUGIN domain. */ + protect = LOGD_VPN_PLUGIN; + } + /* Check for combined domains */ if (!g_ascii_strcasecmp (*iter, LOGD_ALL_STRING)) { bits = LOGD_ALL; @@ -380,7 +387,7 @@ nm_logging_setup (const char *level, new_logging[i] &= ~bits; else { new_logging[i] |= bits; - if ( protect + if ( (protect & bits) && i < LOGL_INFO) new_logging[i] &= ~protect; }