From 238a9080c6e80856145210a374b35e613d4cb11e Mon Sep 17 00:00:00 2001 From: Suphanat Chunhapanya Date: Tue, 15 Jan 2019 12:16:23 +0700 Subject: hs-v3: add an option param to safe log functions We add an option param to safe_str and safe_str_client because in some case we need to use those functions before global_options is set. --- src/app/config/config.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/app/config/config.c') diff --git a/src/app/config/config.c b/src/app/config/config.c index c71ed01843..7bd850eddb 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -1086,10 +1086,14 @@ config_free_all(void) * (We return "[scrubbed]" if SafeLogging is "1", and address otherwise.) */ const char * -safe_str_client(const char *address) +safe_str_client_opts(const or_options_t *options, const char *address) { tor_assert(address); - if (get_options()->SafeLogging_ == SAFELOG_SCRUB_ALL) + if (!options) { + options = get_options(); + } + + if (options->SafeLogging_ == SAFELOG_SCRUB_ALL) return "[scrubbed]"; else return address; @@ -1103,10 +1107,14 @@ safe_str_client(const char *address) * otherwise.) */ const char * -safe_str(const char *address) +safe_str_opts(const or_options_t *options, const char *address) { tor_assert(address); - if (get_options()->SafeLogging_ != SAFELOG_SCRUB_NONE) + if (!options) { + options = get_options(); + } + + if (options->SafeLogging_ != SAFELOG_SCRUB_NONE) return "[scrubbed]"; else return address; -- cgit v1.2.3-54-g00ecf