You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-admin/syslog-ng/files/3.4/syslog-ng-3.4.1-rollup.patch

304 lines
11 KiB

diff -ru syslog-ng-3.4.1/contrib/systemd/syslog-ng.service syslog-ng-3.4-master/contrib/systemd/syslog-ng.service
--- syslog-ng-3.4.1/contrib/systemd/syslog-ng.service 2013-01-06 15:38:58.000000000 -0500
+++ syslog-ng-3.4-master/contrib/systemd/syslog-ng.service 2013-04-16 10:11:23.000000000 -0400
@@ -7,6 +7,7 @@
ExecStart=/usr/sbin/syslog-ng -F
ExecReload=/bin/kill -HUP $MAINPID
StandardOutput=null
+Restart=on-failure
[Install]
WantedBy=multi-user.target
diff -ru syslog-ng-3.4.1/lib/cfg-tree.c syslog-ng-3.4-master/lib/cfg-tree.c
--- syslog-ng-3.4.1/lib/cfg-tree.c 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/cfg-tree.c 2013-04-16 10:11:23.000000000 -0400
@@ -588,6 +588,22 @@
return FALSE;
}
+static void
+cfg_tree_propagate_expr_node_properties_to_pipe(LogExprNode *node, LogPipe *pipe)
+{
+ if (node->flags & LC_FALLBACK)
+ pipe->flags |= PIF_BRANCH_FALLBACK;
+
+ if (node->flags & LC_FINAL)
+ pipe->flags |= PIF_BRANCH_FINAL;
+
+ if (node->flags & LC_FLOW_CONTROL)
+ pipe->flags |= PIF_HARD_FLOW_CONTROL;
+
+ if (!pipe->expr_node)
+ pipe->expr_node = node;
+}
+
/**
* cfg_tree_compile_sequence:
*
@@ -713,10 +729,6 @@
{
source_join_pipe = last_pipe = log_pipe_new();
g_ptr_array_add(self->initialized_pipes, source_join_pipe);
-
- source_join_pipe->expr_node = node;
- if (node->flags & LC_FLOW_CONTROL)
- source_join_pipe->flags |= PIF_HARD_FLOW_CONTROL;
}
log_pipe_append(sub_pipe_tail, source_join_pipe);
}
@@ -724,16 +736,13 @@
if (first_pipe)
{
- if (node->flags & LC_FALLBACK)
- first_pipe->flags |= PIF_BRANCH_FALLBACK;
-
- if (node->flags & LC_FINAL)
- first_pipe->flags |= PIF_BRANCH_FINAL;
-
- if (node->flags & LC_FLOW_CONTROL)
- first_pipe->flags |= PIF_HARD_FLOW_CONTROL;
- if (!first_pipe->expr_node)
- first_pipe->expr_node = node;
+ /* we actually return something as sub_pipe_head, which means that we
+ * have to propagate flags upwards */
+ cfg_tree_propagate_expr_node_properties_to_pipe(node, first_pipe);
+ }
+ else if (last_pipe)
+ {
+ cfg_tree_propagate_expr_node_properties_to_pipe(node, last_pipe);
}
diff -ru syslog-ng-3.4.1/lib/control.c syslog-ng-3.4-master/lib/control.c
--- syslog-ng-3.4.1/lib/control.c 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/control.c 2013-04-16 10:11:23.000000000 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2012 BalaBit IT Ltd, Budapest, Hungary
+ * Copyright (c) 2002-2013 BalaBit IT Ltd, Budapest, Hungary
* Copyright (c) 1998-2012 Balázs Scheidler
*
* This library is free software; you can redistribute it and/or
@@ -208,8 +208,8 @@
}
else if (rc == 0)
{
- msg_error("EOF on control channel, closing connection",
- NULL);
+ msg_notice("EOF on control channel, closing connection",
+ NULL);
goto destroy_connection;
}
else
diff -ru syslog-ng-3.4.1/lib/filter.c syslog-ng-3.4-master/lib/filter.c
--- syslog-ng-3.4.1/lib/filter.c 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/filter.c 2013-04-16 10:11:23.000000000 -0400
@@ -46,6 +46,12 @@
self->ref_cnt = 1;
}
+/*
+ * In case the filter would modify the message the caller has to make sure
+ * that the message is writable. You can always archieve that with
+ * filter_expr_eval_root() below, but you have to be on a processing path to
+ * do that.
+ */
gboolean
filter_expr_eval_with_context(FilterExprNode *self, LogMessage **msg, gint num_msg)
{
@@ -65,6 +71,21 @@
return filter_expr_eval_with_context(self, &msg, 1);
}
+gboolean
+filter_expr_eval_root_with_context(FilterExprNode *self, LogMessage **msg, gint num_msg, const LogPathOptions *path_options)
+{
+ if (self->modify)
+ log_msg_make_writable(&msg[0], path_options);
+
+ return filter_expr_eval_with_context(self, msg, num_msg);
+}
+
+gboolean
+filter_expr_eval_root(FilterExprNode *self, LogMessage **msg, const LogPathOptions *path_options)
+{
+ return filter_expr_eval_root_with_context(self, msg, 1, path_options);
+}
+
FilterExprNode *
filter_expr_ref(FilterExprNode *self)
{
@@ -98,6 +119,7 @@
self->left->init(self->left, cfg);
if (self->right && self->right->init)
self->right->init(self->right, cfg);
+ self->super.modify = self->left->modify || self->right->modify;
}
static void
@@ -132,7 +154,6 @@
fop_init_instance(self);
self->super.eval = fop_or_eval;
- self->super.modify = e1->modify || e2->modify;
self->left = e1;
self->right = e2;
self->super.type = "OR";
@@ -154,7 +175,6 @@
fop_init_instance(self);
self->super.eval = fop_and_eval;
- self->super.modify = e1->modify || e2->modify;
self->left = e1;
self->right = e2;
self->super.type = "AND";
@@ -509,6 +529,7 @@
self->filter_expr = ((LogFilterPipe *) rule->children->object)->expr;
+ self->super.modify = self->filter_expr->modify;
}
else
{
@@ -699,10 +720,8 @@
evt_tag_str("rule", self->name),
evt_tag_str("location", log_expr_node_format_location(s->expr_node, buf, sizeof(buf))),
NULL);
- if (self->expr->modify)
- log_msg_make_writable(&msg, path_options);
- res = filter_expr_eval(self->expr, msg);
+ res = filter_expr_eval_root(self->expr, &msg, path_options);
msg_debug("Filter rule evaluation result",
evt_tag_str("result", res ? "match" : "not-match"),
evt_tag_str("rule", self->name),
diff -ru syslog-ng-3.4.1/lib/filter.h syslog-ng-3.4-master/lib/filter.h
--- syslog-ng-3.4.1/lib/filter.h 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/filter.h 2013-04-16 10:11:23.000000000 -0400
@@ -48,6 +48,8 @@
gboolean filter_expr_eval(FilterExprNode *self, LogMessage *msg);
gboolean filter_expr_eval_with_context(FilterExprNode *self, LogMessage **msgs, gint num_msg);
+gboolean filter_expr_eval_root(FilterExprNode *self, LogMessage **msg, const LogPathOptions *path_options);
+gboolean filter_expr_eval_root_with_context(FilterExprNode *self, LogMessage **msgs, gint num_msg, const LogPathOptions *path_options);
void filter_expr_unref(FilterExprNode *self);
typedef struct _FilterRE
diff -ru syslog-ng-3.4.1/lib/logmpx.c syslog-ng-3.4-master/lib/logmpx.c
--- syslog-ng-3.4.1/lib/logmpx.c 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/logmpx.c 2013-04-16 10:11:23.000000000 -0400
@@ -39,9 +39,15 @@
for (i = 0; i < self->next_hops->len; i++)
{
- LogPipe *next_hop = g_ptr_array_index(self->next_hops, i);
+ LogPipe *branch_head = g_ptr_array_index(self->next_hops, i);
+ LogPipe *p;
+
+ for (p = branch_head; p; p = p->pipe_next)
+ {
+ branch_head->flags |= (p->flags & PIF_BRANCH_PROPERTIES);
+ }
- if ((next_hop->flags & PIF_BRANCH_FALLBACK) != 0)
+ if (branch_head->flags & PIF_BRANCH_FALLBACK)
{
self->fallback_exists = TRUE;
}
diff -ru syslog-ng-3.4.1/lib/logmsg.h syslog-ng-3.4-master/lib/logmsg.h
--- syslog-ng-3.4.1/lib/logmsg.h 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/logmsg.h 2013-04-16 10:11:23.000000000 -0400
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002-2012 BalaBit IT Ltd, Budapest, Hungary
- * Copyright (c) 1998-2012 Balázs Scheidler
+ * Copyright (c) 2002-2013 BalaBit IT Ltd, Budapest, Hungary
+ * Copyright (c) 1998-2013 Balázs Scheidler
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -203,6 +203,12 @@
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 -ru syslog-ng-3.4.1/lib/logpipe.h syslog-ng-3.4-master/lib/logpipe.h
--- syslog-ng-3.4.1/lib/logpipe.h 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/logpipe.h 2013-04-16 10:11:23.000000000 -0400
@@ -47,6 +47,7 @@
/* log statement flags that are copied to the head of a branch */
#define PIF_BRANCH_FINAL 0x0004
#define PIF_BRANCH_FALLBACK 0x0008
+#define PIF_BRANCH_PROPERTIES (PIF_BRANCH_FINAL + PIF_BRANCH_FALLBACK)
/* branch starting with this pipe wants hard flow control */
#define PIF_HARD_FLOW_CONTROL 0x0010
diff -ru syslog-ng-3.4.1/lib/logrewrite.c syslog-ng-3.4-master/lib/logrewrite.c
--- syslog-ng-3.4.1/lib/logrewrite.c 2013-01-31 01:58:05.000000000 -0500
+++ syslog-ng-3.4-master/lib/logrewrite.c 2013-04-16 10:11:23.000000000 -0400
@@ -45,7 +45,7 @@
gssize length;
const gchar *value;
- if (self->condition && !filter_expr_eval(self->condition, msg))
+ if (self->condition && !filter_expr_eval_root(self->condition, &msg, path_options))
{
msg_debug("Rewrite condition unmatched, skipping rewrite",
evt_tag_str("value", log_msg_get_value_name(self->value_handle, NULL)),
diff -ru syslog-ng-3.4.1/lib/persist-state.c syslog-ng-3.4-master/lib/persist-state.c
--- syslog-ng-3.4.1/lib/persist-state.c 2013-01-06 15:40:30.000000000 -0500
+++ syslog-ng-3.4-master/lib/persist-state.c 2013-04-28 00:43:29.703864600 -0400
@@ -26,6 +26,7 @@
#include "serialize.h"
#include "messages.h"
#include "mainloop.h"
+#include "misc.h"
#include <sys/types.h>
#include <unistd.h>
@@ -218,6 +219,7 @@
NULL);
return FALSE;
}
+ g_fd_set_cloexec(self->fd, TRUE);
self->current_key_block = offsetof(PersistFileHeader, initial_key_store);
self->current_key_ofs = 0;
self->current_key_size = sizeof((((PersistFileHeader *) NULL))->initial_key_store);
diff -ru syslog-ng-3.4.1/modules/dbparser/patterndb.c syslog-ng-3.4-master/modules/dbparser/patterndb.c
--- syslog-ng-3.4.1/modules/dbparser/patterndb.c 2013-01-17 06:43:50.000000000 -0500
+++ syslog-ng-3.4-master/modules/dbparser/patterndb.c 2013-04-16 10:11:23.000000000 -0400
@@ -1302,7 +1302,7 @@
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);
}
diff -ru syslog-ng-3.4.1/tests/loggen/loggen.c syslog-ng-3.4-master/tests/loggen/loggen.c
--- syslog-ng-3.4.1/tests/loggen/loggen.c 2013-01-06 15:38:59.000000000 -0500
+++ syslog-ng-3.4-master/tests/loggen/loggen.c 2013-04-16 10:11:23.000000000 -0400
@@ -847,6 +847,12 @@
{
static struct sockaddr_un saun;
+ if (argc < 1)
+ {
+ fprintf(stderr, "No target path specified\n");
+ return 1;
+ }
+
saun.sun_family = AF_UNIX;
strncpy(saun.sun_path, argv[0], sizeof(saun.sun_path));