[syslog-ng] [Bug 241] pdbtool test --validate returns success when matching wrong pattern

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Fri Jul 26 14:31:39 CEST 2013


https://bugzilla.balabit.com/show_bug.cgi?id=241


Balint Kovacs <blint at balabit.hu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blint at balabit.hu




--- Comment #1 from Balint Kovacs <blint at balabit.hu>  2013-07-26 14:31:39 ---
Can you please try with the attached patch? It should cause pdbtool to return with exit code 2 if any of the pattern examples produces a wrong match.

diff --git a/modules/dbparser/pdbtool/pdbtool.c b/modules/dbparser/pdbtool/pdbtool.c
index 4264735..4bc2bfd 100644
--- a/modules/dbparser/pdbtool/pdbtool.c
+++ b/modules/dbparser/pdbtool/pdbtool.c
@@ -761,12 +761,16 @@ pdbtool_test(int argc, char *argv[])

               pattern_db_process(patterndb, PDB_INPUT_WRAP_MESSAGE(&input, msg));

-              if (!pdbtool_test_value(msg, ".classifier.rule_id", example->rule->rule_id) && debug_pattern)
+              if (!pdbtool_test_value(msg, ".classifier.rule_id", example->rule->rule_id))
                 {
-                  match_message = example->message;
-                  match_program = example->program;
-                  patterndb_file = argv[arg_pos];
-                  pdbtool_match(0, NULL);
+                  failed_to_match = TRUE;
+                  if (debug_pattern)
+                    {
+                      match_message = example->message;
+                      match_program = example->program;
+                      patterndb_file = argv[arg_pos];
+                      pdbtool_match(0, NULL);
+                    }
                 }

               for (i = 0; example->values && i < example->values->len; i++)


-- 
Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the syslog-ng mailing list