]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Composites: Allow partial match
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 5 Nov 2020 12:56:21 +0000 (12:56 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 5 Nov 2020 12:56:21 +0000 (12:56 +0000)
src/libserver/composites.c
test/functional/cases/109_composites.robot
test/functional/configs/composites.conf

index f3c25d1bc105130335b739ea5b69f84d976429b9..3ec7704394eb2945f5a57bbd3653f87644a5911e 100644 (file)
@@ -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;
index 4fb3aee3dd5c145732ad8c7bdab3c32f4bf618b6..ef154603a5779c54c69c5fdc79534b9487f09838 100644 (file)
@@ -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
index d57e09818d2e16ea38ce5645cdec2d2838aa0a3c..71e453deff161b3663c9c301ef19810ff7d2f063 100644 (file)
@@ -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;
+    }
 }