From: Michal Bloch Date: Thu, 30 Apr 2020 16:23:24 +0000 (+0200) Subject: libdlog: add `enable_secure_logs` config entry X-Git-Tag: submit/tizen/20200506.124304~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27b7c97eea371be89f75d3e29edf0d56646db8dd;p=platform%2Fcore%2Fsystem%2Fdlog.git libdlog: add `enable_secure_logs` config entry If it is set to 0, __dlog_sec_print will just return 0. Defaults to 1. Change-Id: Ie3a00c5aa25bd4035444ae27383d649acf0e1d23 Signed-off-by: Michal Bloch --- diff --git a/configs/dlog.conf b/configs/dlog.conf index f50a6fd..b150cfc 100644 --- a/configs/dlog.conf +++ b/configs/dlog.conf @@ -30,6 +30,11 @@ limiter_apply_to_all_buffers=1 # dynamic config_path - specifies the path to a DIRECTORY to enable dynamic runtime config changes (use dlogctl for control) dynamic_config_path=/run/dlog/filters.d/ +# Whether secure printing is enabled. +# If this setting is set to 0, secure logs +# are dropped and don't go into the buffer. +enable_secure_logs=1 + ##### Settings used by the logging daemon # See also 20-pipe.conf for more info diff --git a/src/libdlog/log.c b/src/libdlog/log.c index b43bd7a..c6d4606 100644 --- a/src/libdlog/log.c +++ b/src/libdlog/log.c @@ -63,6 +63,7 @@ bool limiter; static bool dynamic_config; static bool plog[LOG_ID_MAX]; static bool plog_default_values[LOG_ID_MAX]; +static bool enable_secure_logs = true; static int debugmode; static int fatal_assert; @@ -121,6 +122,7 @@ static void __configure_parameters(struct log_config *config) __update_plog(config); __set_plog_default_values(); + enable_secure_logs = log_config_get_boolean(config, "enable_secure_logs", enable_secure_logs); debugmode = log_config_get_int(config, "debugmode", DEFAULT_CONFIG_DEBUGMODE); fatal_assert = access(DEBUGMODE_FILE, F_OK) != -1; limiter = log_config_get_boolean(config, "limiter", DEFAULT_CONFIG_LIMITER); @@ -578,6 +580,9 @@ int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, .. */ int __dlog_sec_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...) { + if (!enable_secure_logs) + return 0; + va_list ap; va_start(ap, fmt);