[syslog-ng] [Bug 225] patterndb can not use HOST as variable in pattern

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Tue Mar 12 21:52:29 CET 2013


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





--- Comment #1 from Balazs Scheidler <bazsi at balabit.hu>  2013-03-12 21:52:29 ---
This patch pushed to github, branch f/fixed-setting-host-in-patterns should fix this.

Algernon, can you pls pull this? Thanks.

commit 3d2d2d3de8fc3599d90c94d006c30c118f05c731
Author: Balazs Scheidler <bazsi at balabit.hu>
Date:   Tue Mar 12 21:51:00 2013 +0100

    patterndb: fixed a failed assertion when using builtin values in a pattern

    An assertion was failed when using a db-parser() pattern that contains
    a builtin name-value pair, like:

    replace HOST with @ANYSTRING:HOST@

    This is fixed by this patch.

    Reported-By: Evan Rempel <erempel at uvic.ca>
    Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>

diff --git a/lib/logmsg.h b/lib/logmsg.h
index 966c89e..b09b870 100644
--- a/lib/logmsg.h
+++ b/lib/logmsg.h
@@ -203,6 +203,12 @@ gboolean log_msg_is_handle_macro(NVHandle handle);
 gboolean log_msg_is_handle_sdata(NVHandle handle);
 gboolean log_msg_is_handle_match(NVHandle handle);

+static inline gboolean
+log_msg_is_handle_settable_with_an_indirect_value(NVHandle handle)
+{
+  return (handle < LM_V_MAX);
+}
+
 const gchar *log_msg_get_macro_value(LogMessage *self, gint id, gssize *value_len);

 static inline const gchar *
diff --git a/modules/dbparser/patterndb.c b/modules/dbparser/patterndb.c
index 243ce03..09571b6 100644
--- a/modules/dbparser/patterndb.c
+++ b/modules/dbparser/patterndb.c
@@ -1302,7 +1302,7 @@ log_db_add_matches(LogMessage *msg, GArray *matches, NVHandle ref_handle, const
           log_msg_set_value(msg, match->handle, match->match, match->len);
           g_free(match->match);
         }
-      else if (ref_handle != LM_V_NONE)
+      else if (ref_handle != LM_V_NONE && log_msg_is_handle_settable_with_an_indirect_value(match->handle))
         {
           log_msg_set_value_indirect(msg, match->handle, ref_handle, match->type, match->ofs, match->len);
         }


-- 
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