Bläddra i källkod

[Fix] Composites: Allow partial match

tags/2.7
Vsevolod Stakhov 3 år sedan
förälder
incheckning
7c63add10c

+ 2
- 2
src/libserver/composites.c Visa fil

@@ -449,8 +449,8 @@ rspamd_composite_process_single_symbol (struct composites_data *cd,
}
}
else {
if (rspamd_regexp_match (cur_opt->data.re,
opt->option, opt->optlen, FALSE)) {
if (rspamd_regexp_search (cur_opt->data.re,
opt->option, opt->optlen, NULL, NULL, FALSE, NULL)) {
found = true;

break;

+ 6
- 0
test/functional/cases/109_composites.robot Visa fil

@@ -70,3 +70,9 @@ Composites - Opts RE Hit 2
Expect Symbol With Score SYMOPTS3 6.00
Do Not Expect Symbol SYMOPTS2
Do Not Expect Symbol SYMOPTS1

Composites - Opts RE Hit 3
Scan File ${MESSAGE} opts=example.com->app.link
Expect Symbol With Score SYMOPTS4 6.00
Do Not Expect Symbol SYMOPTS2
Do Not Expect Symbol SYMOPTS1

+ 4
- 0
test/functional/configs/composites.conf Visa fil

@@ -80,4 +80,8 @@ composites {
expression = 'OPTS[sym2,/FoO\\//i]';
score = 6.0;
}
SYMOPTS4 {
expression = 'POSITIVE_A & OPTS[/>app.link$/i] & EXPRESSIONS';
score = 6.0;
}
}

Laddar…
Avbryt
Spara