commit 7c63add: [Fix] Composites: Allow partial match
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Nov 5 13:00:08 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-11-05 12:56:21 +0000
URL: https://github.com/rspamd/rspamd/commit/7c63add10c03134013fc186a5ac49cdb2d22eca2 (HEAD -> master)
[Fix] Composites: Allow partial match
---
src/libserver/composites.c | 4 ++--
test/functional/cases/109_composites.robot | 6 ++++++
test/functional/configs/composites.conf | 4 ++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/libserver/composites.c b/src/libserver/composites.c
index f3c25d1bc..3ec770439 100644
--- a/src/libserver/composites.c
+++ b/src/libserver/composites.c
@@ -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;
diff --git a/test/functional/cases/109_composites.robot b/test/functional/cases/109_composites.robot
index 4fb3aee3d..ef154603a 100644
--- a/test/functional/cases/109_composites.robot
+++ b/test/functional/cases/109_composites.robot
@@ -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
\ No newline at end of file
diff --git a/test/functional/configs/composites.conf b/test/functional/configs/composites.conf
index d57e09818..71e453def 100644
--- a/test/functional/configs/composites.conf
+++ b/test/functional/configs/composites.conf
@@ -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;
+ }
}
More information about the Commits
mailing list