Skip to content

Commit

Permalink
doveconf: Do not skip over secrets when hiding them
Browse files Browse the repository at this point in the history
All candidates for hiding need to be considered, otherwise
it might skip over some of them and leave them unhidden.
  • Loading branch information
cmouse committed Aug 21, 2018
1 parent 57d83da commit 5bd69c6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/config/doveconf.c
Expand Up @@ -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
Expand Down

0 comments on commit 5bd69c6

Please sign in to comment.