Hello community, here is the log from the commit of package syslog-ng checked in at Mon Mar 5 15:37:10 CET 2007. -------- --- syslog-ng/syslog-ng.changes 2006-11-14 15:21:25.000000000 +0100 +++ /mounts/work_src_done/STABLE/syslog-ng/syslog-ng.changes 2007-03-03 15:52:21.000000000 +0100 @@ -1,0 +2,26 @@ +Sat Mar 3 15:52:10 CET 2007 - mt@suse.de + +- Bug #250562: Fixed to set signal handlers before the config + and thus the log destinations are initialized to avoid the + creation of zombie processes when a program (e.g. destination) + fails to execute, e.g. because apparmor profile prohibits it. + Changed to use sigaction() instead of the signal() function. + New patch file: syslog-ng-sigaction.dif +- Cleaned up the syslog-ng-filter_checks patch (fix for #240676). +- Added remote logserver destination example to the config file. +- Moved the allmessages example to the begin to catch all msgs. + +------------------------------------------------------------------- +Thu Mar 1 20:29:17 CET 2007 - mt@suse.de + +- Bug #249555: Fix for additional log sockets extension; syslog-ng + dropped messages on the sockets after a config file reload. + Fixed patch file: syslog-ng-additional-log-sockets.dif + +------------------------------------------------------------------- +Wed Feb 28 12:16:08 CET 2007 - mt@suse.de + +- Bug #240676: Implemented checks to detect recursive filter + definitions. New patch file: syslog-ng-filter_checks.dif + +------------------------------------------------------------------- New: ---- syslog-ng-filter_checks.dif syslog-ng-sigaction.dif ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ syslog-ng.spec ++++++ --- /var/tmp/diff_new_pack.ae9100/_old 2007-03-05 15:36:17.000000000 +0100 +++ /var/tmp/diff_new_pack.ae9100/_new 2007-03-05 15:36:17.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package syslog-ng (Version 1.6.11) # -# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # @@ -13,7 +13,7 @@ Name: syslog-ng BuildRequires: gperf libol-devel tcpd-devel Version: 1.6.11 -Release: 17 +Release: 32 License: GNU General Public License (GPL) Group: System/Daemons Summary: new-generation syslog-daemon @@ -33,8 +33,10 @@ Patch1: syslog-ng-afunix_no_hostname.dif Patch2: syslog-ng-update_own_hostname.dif Patch3: syslog-ng-afunix_dest_reconnect.dif -patch4: syslog-ng-additional-log-sockets.dif -patch5: syslog-ng-handle-line.diff +Patch4: syslog-ng-additional-log-sockets.dif +Patch5: syslog-ng-handle-line.diff +Patch6: syslog-ng-filter_checks.dif +Patch7: syslog-ng-sigaction.dif BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -70,7 +72,9 @@ %patch2 -p0 %patch3 -p0 %patch4 -p0 -%patch5 +%patch5 -p0 +%patch6 -p0 +%patch7 -p0 %{?suse_update_config:%{suse_update_config -f}} %build @@ -233,7 +237,24 @@ %config(noreplace) /etc/logrotate.d/syslog-ng /var/adm/fillup-templates/sysconfig.syslog-ng -%changelog -n syslog-ng +%changelog +* Sat Mar 03 2007 - mt@suse.de +- Bug #250562: Fixed to set signal handlers before the config + and thus the log destinations are initialized to avoid the + creation of zombie processes when a program (e.g. destination) + fails to execute, e.g. because apparmor profile prohibits it. + Changed to use sigaction() instead of the signal() function. + New patch file: syslog-ng-sigaction.dif +- Cleaned up the syslog-ng-filter_checks patch (fix for #240676). +- Added remote logserver destination example to the config file. +- Moved the allmessages example to the begin to catch all msgs. +* Thu Mar 01 2007 - mt@suse.de +- Bug #249555: Fix for additional log sockets extension; syslog-ng + dropped messages on the sockets after a config file reload. + Fixed patch file: syslog-ng-additional-log-sockets.dif +* Wed Feb 28 2007 - mt@suse.de +- Bug #240676: Implemented checks to detect recursive filter + definitions. New patch file: syslog-ng-filter_checks.dif * Tue Nov 14 2006 - schwab@suse.de - Fix crash in handle_*_line. * Wed Sep 13 2006 - mt@suse.de ++++++ syslog-ng-additional-log-sockets.dif ++++++ --- /var/tmp/diff_new_pack.ae9100/_old 2007-03-05 15:36:17.000000000 +0100 +++ /var/tmp/diff_new_pack.ae9100/_new 2007-03-05 15:36:17.000000000 +0100 @@ -224,9 +224,9 @@ + "to the source group '%S'.\n", + path, dev_log_grp->name); + -+ drv->next_driver = dev_log_drv->next_driver; -+ dev_log_drv->next_driver = drv; -+ dev_log_drv = drv; ++ drv->next_driver = dev_log_grp->drivers; ++ dev_log_grp->drivers = drv; ++ append_log_handler(drv, dev_log_grp); + } + } + } ++++++ syslog-ng.conf.default ++++++ --- syslog-ng/syslog-ng.conf.default 2006-09-13 10:58:21.000000000 +0200 +++ /mounts/work_src_done/STABLE/syslog-ng/syslog-ng.conf.default 2007-03-03 15:34:21.000000000 +0100 @@ -93,6 +93,19 @@ # +# Enable this and adopt IP to send log messages to a log server. +# +#destination logserver { udp("10.10.10.10" port(514)); }; +#log { source(src); destination(logserver); }; + +# +# Enable this, if you want to keep all messages in one file: +# (don't forget to provide logrotation config) +# +#destination allmessages { file("/var/log/allmessages"); }; +#log { source(src); destination(allmessages); }; + +# # Most warning and errors on tty10 and on the xconsole pipe: # destination console { file("/dev/tty10" group(tty) perm(0620)); }; @@ -198,11 +211,4 @@ destination warn { file("/var/log/warn" fsync(yes)); }; log { source(src); filter(f_warn); destination(warn); }; -# -# Enable this, if you want to keep all messages in one file: -# (don't forget to provide logrotation config) -# -#destination allmessages { file("/var/log/allmessages"); }; -#log { source(src); destination(allmessages); }; - ++++++ syslog-ng-filter_checks.dif ++++++ --- src/cfgfile.c +++ src/cfgfile.c 2007/03/02 12:31:26 @@ -335,9 +335,11 @@ res = yyparse(); fclose(cfg); if (!res) { - /* successfully parsed */ - self->resources = empty_resource_list(); - return self; + if( verify_filter_rules(self->filters) == 0) { + /* successfully parsed */ + self->resources = empty_resource_list(); + return self; + } } } else { --- src/filters.c +++ src/filters.c 2007/03/02 13:32:35 @@ -42,8 +42,222 @@ static void free_regexp(regex_t *re); +#define string_equal_oo(l,r) \ + (l->length == r->length && !memcmp(l->data, r->data, l->length)) + +#define string_equal_oc(l,r) \ + (l->length == strlen(r) && !memcmp(l->data, r, l->length)) + +#define string_equal_cc(l,r) \ + (!strcmp(l, r)) + #include "filters.c.x" +/* CLASS: + (class + (name trace_node) + (vars + (name string) + (next object traced_node) + (prev object traced_node) + ) + ) +*/ +/* + CLASS: + (class + (name trace_list) + (vars + (head object traced_node) + (tail object traced_node) + ) + ) +*/ + +static struct trace_node * +make_trace_node(struct ol_string *name) +{ + if(name) + { + NEW(trace_node, self); + self->name = ol_string_use(name); + return self; + } + return NULL; +} + +static struct trace_list * +make_trace_list(struct ol_string *name) +{ + NEW(trace_list, self); + if(name) + { + struct trace_node *temp = make_trace_node(name); + if(temp) + { + self->head = temp; + self->tail = temp; + } + else + { + KILL(self); + return NULL; + } + } + return self; +} + +struct ol_string * +get_trace_info(struct trace_list *list) +{ + struct ol_string *info = NULL; + struct ol_string *temp; + if(list && list->head) + { + struct trace_node *ptr = list->head; + info = c_format("%S", ptr->name); + while( (ptr = ptr->next)) + { + temp = c_format("%S => %S", info, ptr->name); + ol_string_free(info); + info = temp; + } + } + return info; +} + +static int +add_trace_name(struct trace_list *list, struct ol_string *name) +{ + if(list) + { + struct trace_node *temp = make_trace_node(name); + if( temp) + { + if( list->tail) + { + list->tail->next = temp; + temp->prev = list->tail; + list->tail = temp; + } + else + { + list->head = temp; + list->tail = temp; + } + return 0; + } + } + return 1; +} + +static void +pop_trace_name(struct trace_list *list) +{ + if(list) + { + struct trace_node *temp = list->tail; + if(temp) + { + if(temp->prev) + temp->prev->next = NULL; + list->tail = temp->prev; + KILL(temp); + } + } +} + +static int check_filter_expr(struct log_filter *rules, + struct trace_list *trace, + struct filter_expr_node *expr) +{ + struct ol_object *obj = (struct ol_object*)expr; + + if(string_equal_cc(obj->isa->name, "filter_expr_op")) + { + int ret; + CAST(filter_expr_op, o, expr); + + debug( "filter expr check: {%z} (%S)\n", + obj->isa->name, get_trace_info(trace)); + + ret = check_filter_expr(rules, trace, o->left); + if(ret) return ret; + + ret = check_filter_expr(rules, trace, o->right); + if(ret) return ret; + } + else + if(string_equal_cc(obj->isa->name, "filter_expr_call")) + { + int found = 0; + struct log_filter *filter; + CAST(filter_expr_call, c, expr); + + debug( "filter expr check: {%z} (%S)\n", + obj->isa->name, get_trace_info(trace)); + + /* check if we already have the filter name in trace list */ + struct trace_node *ptr = trace->head; + for( ; ptr; ptr=ptr->next) + { + if(string_equal_oo(c->name, ptr->name)) + { + werror( "Recursion in filter rule detected: %S => %S!\n", + get_trace_info(trace), c->name); + return 1; + } + } + + /* find filter (by name) the filter list */ + for(filter=rules; filter; filter=filter->next_filter) + { + if(string_equal_oo(c->name, filter->name)) + { + found++; + + /* OK, filter exists, jump into it */ + if(add_trace_name(trace, filter->name) == 0) + { + int ret; + ret = check_filter_expr(rules, trace, filter->root); + pop_trace_name(trace); + if(ret) + return ret; + } + /* + ** don't break -- filter names are not unique?! + */ + /* break; */ + } + } + if( !found) + { + werror( "The filter rule '%S' references a not existing filter '%S'!\n", + trace->tail->name, c->name); + return 2; + } + } + return 0; +} + +int verify_filter_rules(struct log_filter *filter_rules) +{ + struct log_filter *filter; + for(filter=filter_rules; filter; filter=filter->next_filter) + { + struct trace_list *list = make_trace_list(filter->name); + if(list) + { + int ret; + ret = check_filter_expr(filter_rules, list, filter->root); + KILL( list); + if(ret) return ret; + } + } + return 0; +} + struct log_filter *make_filter_rule(const char *name, struct filter_expr_node *root) { NEW(log_filter, self); --- src/filters.c.x +++ src/filters.c.x 2007/03/02 12:31:26 @@ -1,4 +1,79 @@ #ifndef CLASS_DEFINE +struct trace_node +{ + struct ol_object super; + struct ol_string *name; + struct trace_node *next; + struct trace_node *prev; +}; +extern struct ol_class trace_node_class; +#endif /* !CLASS_DEFINE */ + +#ifndef CLASS_DECLARE +static void do_trace_node_mark(struct ol_object *o, +void (*mark)(struct ol_object *o)) +{ + struct trace_node *i = (struct trace_node *) o; + mark((struct ol_object *) i->next); + mark((struct ol_object *) i->prev); +} + +static void do_trace_node_free(struct ol_object *o) +{ + struct trace_node *i = (struct trace_node *) o; + i->prev = NULL; + i->next = NULL; + ol_string_free(i->name); +} + +struct ol_class trace_node_class = +{ STATIC_HEADER, + 0, "trace_node", sizeof(struct trace_node), + do_trace_node_mark, + do_trace_node_free +}; +#endif /* !CLASS_DECLARE */ + +#ifndef CLASS_DEFINE +struct trace_list +{ + struct ol_object super; + struct trace_node *head; + struct trace_node *tail; +}; +extern struct ol_class trace_list_class; +#endif /* !CLASS_DEFINE */ + +#ifndef CLASS_DECLARE +static void do_trace_list_mark(struct ol_object *o, +void (*mark)(struct ol_object *o)) +{ + struct trace_list *i = (struct trace_list *) o; + mark((struct ol_object *) i->head); + mark((struct ol_object *) i->tail); +} + +static void do_trace_list_free(struct ol_object *o) +{ + struct trace_list *i = (struct trace_list *) o; + struct trace_node *t; + while( (t=i->head)) + { + i->head = i->head->next; + KILL(t); + } + i->tail = NULL; +} + +struct ol_class trace_list_class = +{ STATIC_HEADER, + 0, "trace_list", sizeof(struct trace_list), + do_trace_list_mark, + do_trace_list_free +}; +#endif /* !CLASS_DECLARE */ + +#ifndef CLASS_DEFINE struct filter_expr_op { struct filter_expr_node super; --- src/filters.h +++ src/filters.h 2007/03/02 12:31:26 @@ -56,6 +56,8 @@ extern int lex_filter_params; +int verify_filter_rules(struct log_filter *filter_rules); + struct log_filter *make_filter_rule(const char *name, struct filter_expr_node *root); struct filter_expr_node *make_filter_and(struct filter_expr_node *l, struct filter_expr_node *r); ++++++ syslog-ng-sigaction.dif ++++++ --- src/main.c +++ src/main.c 2007/03/03 13:29:13 @@ -166,7 +166,6 @@ static int sighuprecvd = 0; void sig_hup(int signo) { sighuprecvd = 1; - signal(SIGHUP, sig_hup); } static int sigtermrecvd = 0; @@ -174,14 +173,13 @@ static int sigtermrecvd = 0; void sig_term(int signo) { sigtermrecvd = 1; - signal(SIGTERM, sig_term); } +static int sigchildrecvd = 0; + void sig_child(int signo) { - while (waitpid(-1, NULL, WNOHANG) > 0) - ; - signal(SIGCHLD, sig_child); + sigchildrecvd = 1; } int main_loop(struct syslog_backend *backend) @@ -193,11 +191,6 @@ int main_loop(struct syslog_backend *bac int exit_main_loop = 0, reload_config = 0; - signal(SIGPIPE, SIG_IGN); - signal(SIGHUP, sig_hup); - signal(SIGTERM, sig_term); - signal(SIGCHLD, sig_child); - s.timeout = backend->configuration->stats_freq; s.backend = backend; r.backend = backend; @@ -233,6 +226,11 @@ int main_loop(struct syslog_backend *bac reload_config = 0; } + if (sigchildrecvd) { + sigchildrecvd = 0; + while (waitpid(-1, NULL, WNOHANG) > 0) + ; + } if (sigtermrecvd) { static struct callback wakeup = { STATIC_HEADER, do_flush_wakeup }; @@ -515,6 +513,29 @@ int main(int argc, char **argv) if (debug_flag) { do_fork = 0; } + + { + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sigemptyset(&sa.sa_mask); + + sa.sa_handler = SIG_IGN; + sigaction (SIGPIPE, &sa, NULL); + + sa.sa_handler = sig_hup; + sigaction (SIGHUP, &sa, NULL); + + sa.sa_handler = sig_term; + sigaction (SIGINT, &sa, NULL); + + sa.sa_handler = sig_term; + sigaction (SIGTERM, &sa, NULL); + + sa.sa_handler = sig_child; + sigaction (SIGCHLD, &sa, NULL); + } + if (do_fork) { wakeup_fd = go_background(); } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de