From: Aki Tuomi Date: Wed, 1 Aug 2018 05:47:34 +0000 (+0300) Subject: doveconf: Do not skip over secrets when hiding them X-Git-Tag: 2.3.4~301 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b11b13f224f320e11322e189f12175d22bdea685;p=thirdparty%2Fdovecot%2Fcore.git doveconf: Do not skip over secrets when hiding them All candidates for hiding need to be considered, otherwise it might skip over some of them and leave them unhidden. --- diff --git a/src/config/doveconf.c b/src/config/doveconf.c index c574350f9e..5384427906 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -182,14 +182,17 @@ static bool value_need_quote(const char *value) static const char *find_next_secret(const char *input, const char **secret_r) { const char *const *secret; + const char *ptr = NULL; for(secret = secrets; *secret != NULL; secret++) { - const char *ptr; - if ((ptr = strstr(input, *secret)) != NULL) { - *secret_r = *secret; - return ptr; + const char *cptr; + if ((cptr = strstr(input, *secret)) != NULL) { + if (ptr == NULL || cptr < ptr) { + *secret_r = *secret; + ptr = cptr; + } } } - return NULL; + return ptr; } static bool