diff --git a/src/lib-sieve/plugins/variables/variables-match.sieve b/src/lib-sieve/plugins/variables/variables-match.sieve index 9920fa64fe5ab4b56893c2c64a5f46db436fcb13..1a10a8e5f7c04e38ae4fb04a8d50e42171176543 100644 --- a/src/lib-sieve/plugins/variables/variables-match.sieve +++ b/src/lib-sieve/plugins/variables/variables-match.sieve @@ -21,3 +21,10 @@ set "match2" "toptoptop"; if string :matches "${match2}" "*top" { fileinto "TEST 3: ${1}"; } + +set "match3" "ik ben een tukker met grote oren en een lelijke broek."; + +# Test 4 +if string :matches "${match3}" "ik ben * met * en *." { + fileinto "TEST 4: Hij is een ${1} met ${2} en ${3}!"; +} diff --git a/src/lib-sieve/sieve-match-types.c b/src/lib-sieve/sieve-match-types.c index 4d23ded4f6f897a2bcd5d42f8f8073ade7790d65..753d46277daeb01f35cc0373d55685657ad4dacf 100644 --- a/src/lib-sieve/sieve-match-types.c +++ b/src/lib-sieve/sieve-match-types.c @@ -725,6 +725,7 @@ static bool mtch_matches_match const struct sieve_comparator *cmp = mctx->comparator; struct sieve_match_values *mvalues; string_t *match = t_str_new(32); + bool match_found = FALSE; const char *vend = (const char *) val + val_size; const char *kend = (const char *) key + key_size; const char *vp = val; /* Value pointer */ @@ -772,7 +773,7 @@ static bool mtch_matches_match } else wildcard = '\0'; - if ( kp > key+1 ) { + if ( match_found ) { debug_printf("MATCH value (previous): %s %d\n", str_c(match), kp-key); sieve_match_values_add(mvalues, match); } @@ -781,6 +782,9 @@ static bool mtch_matches_match /* Find this section (starting at kp and ending at wp-1)*/ if ( wp > kp ) { + if ( kp > key ) + match_found = TRUE; + while ( (vp < vend) && (kp < wp) ) { #ifdef MATCH_DEBUG const char *skp = kp;