]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveconf: Do not skip over secrets when hiding them
authorAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 1 Aug 2018 05:47:34 +0000 (08:47 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 3 Aug 2018 07:24:41 +0000 (07:24 +0000)
All candidates for hiding need to be considered, otherwise
it might skip over some of them and leave them unhidden.

src/config/doveconf.c

index 73e7b1261c2debbc8896be2f7bd3006092e2f857..f4cc593035f3b9bcb63b18bd9f4ab801eff09ff4 100644 (file)
@@ -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