From 1dfcd909d90f6fad4a612b6fd998d7473a9da399 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Mon, 18 Aug 2014 17:48:20 +0200 Subject: Imported Upstream version 8.4.0 --- tools/Makefile.am | 2 - tools/Makefile.in | 270 +++++++++++++++++------------------------------------- tools/omfile.c | 83 ++++++++++++++++- tools/pmrfc3164.c | 4 +- tools/rscryutil.1 | 29 +++--- tools/rscryutil.c | 12 +-- tools/rsgtutil.1 | 23 ++--- tools/rsgtutil.c | 4 +- tools/rsyslogd.8 | 12 +-- tools/rsyslogd.c | 124 ++++++++++++------------- tools/syslogd.c | 73 +-------------- 11 files changed, 259 insertions(+), 377 deletions(-) (limited to 'tools') diff --git a/tools/Makefile.am b/tools/Makefile.am index 253cd5f..639dbf2 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -48,9 +48,7 @@ rsyslogd_LDFLAGS = -export-dynamic EXTRA_DIST = $(man_MANS) \ rsgtutil.rst \ - rsgtutil.1 \ rscryutil.rst \ - rscryutil.1 \ recover_qi.pl if ENABLE_DIAGTOOLS diff --git a/tools/Makefile.in b/tools/Makefile.in index 54bb6ba..bc87b45 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,51 +16,6 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -91,8 +47,7 @@ bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) @ENABLE_LIBGCRYPT_TRUE@@ENABLE_USERTOOLS_TRUE@am__append_9 = rscryutil.1 @ENABLE_LIBGCRYPT_TRUE@@ENABLE_USERTOOLS_TRUE@am__append_10 = rscryutil.1 subdir = tools -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \ $(top_srcdir)/m4/atomic_operations_64bit.m4 \ @@ -123,7 +78,6 @@ am__DEPENDENCIES_1 = AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am__v_lt_1 = am__msggen_SOURCES_DIST = msggen.c @ENABLE_DIAGTOOLS_TRUE@am_msggen_OBJECTS = msggen.$(OBJEXT) msggen_OBJECTS = $(am_msggen_OBJECTS) @@ -163,18 +117,6 @@ am__zpipe_SOURCES_DIST = zpipe.c @ENABLE_DIAGTOOLS_TRUE@am_zpipe_OBJECTS = zpipe.$(OBJEXT) zpipe_OBJECTS = $(am_zpipe_OBJECTS) zpipe_DEPENDENCIES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -187,16 +129,20 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(logctl_SOURCES) $(msggen_SOURCES) rscryutil.c rsgtutil.c \ $(rsyslog_diag_hostname_SOURCES) $(rsyslogd_SOURCES) \ $(zpipe_SOURCES) @@ -204,11 +150,6 @@ DIST_SOURCES = $(am__logctl_SOURCES_DIST) $(am__msggen_SOURCES_DIST) \ rscryutil.c rsgtutil.c \ $(am__rsyslog_diag_hostname_SOURCES_DIST) $(rsyslogd_SOURCES) \ $(am__zpipe_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -241,23 +182,6 @@ man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man1_MANS) $(man_MANS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -494,8 +418,8 @@ rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) # potentially incomplete build, a problem we had several times...) rsyslogd_LDADD = ../grammar/libgrammar.la ../runtime/librsyslog.la $(ZLIB_LIBS) $(PTHREADS_LIBS) $(RSRT_LIBS) $(SOL_LIBS) $(LIBUUID_LIBS) $(LIBLOGGING_STDLOG_LIBS) rsyslogd_LDFLAGS = -export-dynamic -EXTRA_DIST = $(man_MANS) rsgtutil.rst rsgtutil.1 rscryutil.rst \ - rscryutil.1 recover_qi.pl $(am__append_6) $(am__append_10) +EXTRA_DIST = $(man_MANS) rsgtutil.rst rscryutil.rst recover_qi.pl \ + $(am__append_6) $(am__append_10) @ENABLE_DIAGTOOLS_TRUE@rsyslog_diag_hostname_SOURCES = gethostn.c @ENABLE_DIAGTOOLS_TRUE@zpipe_SOURCES = zpipe.c @ENABLE_DIAGTOOLS_TRUE@zpipe_LDADD = -lz @@ -545,19 +469,14 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -578,8 +497,7 @@ uninstall-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ + -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files @@ -594,19 +512,14 @@ clean-binPROGRAMS: rm -f $$list install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ - fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -627,8 +540,7 @@ uninstall-sbinPROGRAMS: @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ + -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files @@ -641,31 +553,24 @@ clean-sbinPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list - logctl$(EXEEXT): $(logctl_OBJECTS) $(logctl_DEPENDENCIES) $(EXTRA_logctl_DEPENDENCIES) @rm -f logctl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(logctl_OBJECTS) $(logctl_LDADD) $(LIBS) - msggen$(EXEEXT): $(msggen_OBJECTS) $(msggen_DEPENDENCIES) $(EXTRA_msggen_DEPENDENCIES) @rm -f msggen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(msggen_OBJECTS) $(msggen_LDADD) $(LIBS) - rscryutil$(EXEEXT): $(rscryutil_OBJECTS) $(rscryutil_DEPENDENCIES) $(EXTRA_rscryutil_DEPENDENCIES) @rm -f rscryutil$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rscryutil_OBJECTS) $(rscryutil_LDADD) $(LIBS) - rsgtutil$(EXEEXT): $(rsgtutil_OBJECTS) $(rsgtutil_DEPENDENCIES) $(EXTRA_rsgtutil_DEPENDENCIES) @rm -f rsgtutil$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rsgtutil_OBJECTS) $(rsgtutil_LDADD) $(LIBS) - rsyslog_diag_hostname$(EXEEXT): $(rsyslog_diag_hostname_OBJECTS) $(rsyslog_diag_hostname_DEPENDENCIES) $(EXTRA_rsyslog_diag_hostname_DEPENDENCIES) @rm -f rsyslog_diag_hostname$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rsyslog_diag_hostname_OBJECTS) $(rsyslog_diag_hostname_LDADD) $(LIBS) - rsyslogd$(EXEEXT): $(rsyslogd_OBJECTS) $(rsyslogd_DEPENDENCIES) $(EXTRA_rsyslogd_DEPENDENCIES) @rm -f rsyslogd$(EXEEXT) $(AM_V_CCLD)$(rsyslogd_LINK) $(rsyslogd_OBJECTS) $(rsyslogd_LDADD) $(LIBS) - zpipe$(EXEEXT): $(zpipe_OBJECTS) $(zpipe_DEPENDENCIES) $(EXTRA_zpipe_DEPENDENCIES) @rm -f zpipe$(EXEEXT) $(AM_V_CCLD)$(LINK) $(zpipe_OBJECTS) $(zpipe_LDADD) $(LIBS) @@ -996,18 +901,11 @@ clean-libtool: -rm -rf .libs _libs install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) - @list1='$(man1_MANS)'; \ - list2='$(man_MANS)'; \ - test -n "$(man1dir)" \ - && test -n "`echo $$list1$$list2`" \ - || exit 0; \ - echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ - { for i in $$list1; do echo "$$i"; done; \ - if test -n "$$list2"; then \ - for i in $$list2; do echo "$$i"; done \ - | sed -n '/\.1[a-z]*$$/p'; \ - fi; \ + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -1039,18 +937,11 @@ uninstall-man1: dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man5: $(man_MANS) @$(NORMAL_INSTALL) - @list1=''; \ - list2='$(man_MANS)'; \ - test -n "$(man5dir)" \ - && test -n "`echo $$list1$$list2`" \ - || exit 0; \ - echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ - { for i in $$list1; do echo "$$i"; done; \ - if test -n "$$list2"; then \ - for i in $$list2; do echo "$$i"; done \ - | sed -n '/\.5[a-z]*$$/p'; \ - fi; \ + test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)" + @list=''; test -n "$(man5dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.5[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -1082,18 +973,11 @@ uninstall-man5: dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) install-man8: $(man_MANS) @$(NORMAL_INSTALL) - @list1=''; \ - list2='$(man_MANS)'; \ - test -n "$(man8dir)" \ - && test -n "`echo $$list1$$list2`" \ - || exit 0; \ - echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ - { for i in $$list1; do echo "$$i"; done; \ - if test -n "$$list2"; then \ - for i in $$list2; do echo "$$i"; done \ - | sed -n '/\.8[a-z]*$$/p'; \ - fi; \ + test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" + @list=''; test -n "$(man8dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ @@ -1124,15 +1008,26 @@ uninstall-man8: -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -1144,11 +1039,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -1157,26 +1056,24 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -1320,9 +1217,8 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ - clean-binPROGRAMS clean-generic clean-libtool \ - clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-sbinPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ @@ -1334,7 +1230,7 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-man uninstall-man1 uninstall-man5 uninstall-man8 \ uninstall-sbinPROGRAMS diff --git a/tools/omfile.c b/tools/omfile.c index ab17afa..39c0173 100644 --- a/tools/omfile.c +++ b/tools/omfile.c @@ -17,7 +17,7 @@ * pipes. These have been moved to ompipe, to reduced the entanglement * between the two different functionalities. -- rgerhards * - * Copyright 2007-2013 Adiscon GmbH. + * Copyright 2007-2014 Adiscon GmbH. * * This file is part of rsyslog. * @@ -71,6 +71,7 @@ #include "statsobj.h" #include "sigprov.h" #include "cryprov.h" +#include "janitor.h" MODULE_TYPE_OUTPUT MODULE_TYPE_NOKEEP @@ -95,7 +96,7 @@ DEFobjCurrIf(statsobj) * That should be sufficient (and even than, there would no really bad effect ;)). * The variable below is the global counter/clock. */ -#if HAVE_ATOMIC_BUILTINS_64BIT +#if HAVE_ATOMIC_BUILTINS64 static uint64 clockFileAccess = 0; #else static unsigned clockFileAccess = 0; @@ -107,7 +108,7 @@ static pthread_mutex_t mutClock; static inline uint64 getClockFileAccess(void) { -#if HAVE_ATOMIC_BUILTINS_64BIT +#if HAVE_ATOMIC_BUILTINS64 return ATOMIC_INC_AND_FETCH_uint64(&clockFileAccess, &mutClock); #else return ATOMIC_INC_AND_FETCH_unsigned(&clockFileAccess, &mutClock); @@ -122,6 +123,7 @@ struct s_dynaFileCacheEntry { strm_t *pStrm; /* our output stream */ void *sigprovFileData; /* opaque data ptr for provider use */ uint64 clkTickAccessed;/* for LRU - based on clockFileAccess */ + short nInactive; /* number of minutes not writen - for close timeout */ }; typedef struct s_dynaFileCacheEntry dynaFileCacheEntry; @@ -137,6 +139,7 @@ typedef struct _instanceData { uchar *fname; /* file or template name (display only) */ uchar *tplName; /* name of assigned template */ strm_t *pStrm; /* our output stream */ + short nInactive; /* number of minutes not writen (STATIC files only) */ char bDynamicName; /* 0 - static name, 1 - dynamic name (with properties) */ int fCreateMode; /* file creation mode for open() */ int fDirCreateMode; /* creation mode for mkdir() */ @@ -172,6 +175,7 @@ typedef struct _instanceData { int iZipLevel; /* zip mode to use for this selector */ int iIOBufSize; /* size of associated io buffer */ int iFlushInterval; /* how fast flush buffer on inactivity? */ + short iCloseTimeout; /* after how many *minutes* shall the file be closed if inactive? */ sbool bFlushOnTXEnd; /* flush write buffers when transaction has ended? */ sbool bUseAsyncWriter; /* use async stream writer? */ sbool bVeryRobustZip; @@ -181,6 +185,8 @@ typedef struct _instanceData { STATSCOUNTER_DEF(ctrEvict, mutCtrEvict); STATSCOUNTER_DEF(ctrMiss, mutCtrMiss); STATSCOUNTER_DEF(ctrMax, mutCtrMax); + STATSCOUNTER_DEF(ctrCloseTimeouts, mutCtrCloseTimeouts); + char janitorID[128]; /* holds ID for janitor calls */ } instanceData; @@ -271,6 +277,7 @@ static struct cnfparamdescr actpdescr[] = { { "dynafile", eCmdHdlrString, 0 }, /* "dynafile" MUST be present */ { "sig.provider", eCmdHdlrGetWord, 0 }, { "cry.provider", eCmdHdlrGetWord, 0 }, + { "closetimeout", eCmdHdlrPositiveInt, 0 }, { "template", eCmdHdlrGetWord, 0 } }; static struct cnfparamblk actpblk = @@ -772,6 +779,7 @@ prepareDynFile(instanceData *__restrict__ const pData, const uchar *__restrict__ DBGPRINTF("Added new entry %d for file cache, file '%s'.\n", iFirstFree, newFileName); finalize_it: + pCache[pData->iCurrElt]->nInactive = 0; RETiRet; } @@ -826,6 +834,7 @@ writeFile(instanceData *__restrict__ const pData, "Could not open output file '%s'", pData->fname); } } + pData->nInactive = 0; } CHKiRet(doWrite(pData, @@ -908,6 +917,54 @@ finalize_it: cnfparamvalsDestruct(pvals, &modpblk); ENDsetModCnf +/* This function checks dynafile cache for janitor action */ +static inline void +janitorChkDynaFiles(instanceData *__restrict__ const pData) +{ + int i; + dynaFileCacheEntry **pCache = pData->dynCache; + + for(i = 0 ; i < pData->iCurrCacheSize ; ++i) { + if(pCache[i] == NULL) + continue; + DBGPRINTF("omfile janitor: checking dynafile %d:%s, inactive since %d\n", i, + pCache[i]->pName == NULL ? UCHAR_CONSTANT("[OPEN FAILED]") : pCache[i]->pName, + (int) pCache[i]->nInactive); + if(pCache[i]->nInactive >= pData->iCloseTimeout) { + STATSCOUNTER_INC(pData->ctrCloseTimeouts, pData->mutCtrCloseTimeouts); + dynaFileDelCacheEntry(pData, i, 1); + if(pData->iCurrElt == i) + pData->iCurrElt = -1; /* no longer available! */ + } else { + pCache[i]->nInactive += janitorInterval; + } + } +} + +/* callback for the janitor. This cleans out files (if so configured) */ +void +janitorCB(void *pUsr) +{ + instanceData *__restrict__ const pData = (instanceData *) pUsr; + pthread_mutex_lock(&pData->mutWrite); + if(pData->bDynamicName) { + janitorChkDynaFiles(pData); + } else { + if(pData->pStrm != NULL) { + DBGPRINTF("omfile janitor: checking file %s, inactive since %d\n", + pData->fname, pData->nInactive); + if(pData->nInactive >= pData->iCloseTimeout) { + STATSCOUNTER_INC(pData->ctrCloseTimeouts, pData->mutCtrCloseTimeouts); + closeFile(pData); + } else { + pData->nInactive += janitorInterval; + } + } + } + pthread_mutex_unlock(&pData->mutWrite); +} + + BEGINendCnfLoad CODESTARTendCnfLoad loadModConf = NULL; /* done loading */ @@ -947,6 +1004,8 @@ BEGINfreeInstance CODESTARTfreeInstance free(pData->tplName); free(pData->fname); + if(pData->iCloseTimeout > 0) + janitorDelEtry(pData->janitorID); if(pData->bDynamicName) { dynaFileFreeCache(pData); } else if(pData->pStrm != NULL) @@ -1032,6 +1091,7 @@ setInstParamDefaults(instanceData *__restrict__ const pData) pData->cryprovName = NULL; pData->useSigprov = 0; pData->useCryprov = 0; + pData->iCloseTimeout = -1; } @@ -1065,6 +1125,9 @@ setupInstStatsCtrs(instanceData *__restrict__ const pData) STATSCOUNTER_INIT(pData->ctrMax, pData->mutCtrMax); CHKiRet(statsobj.AddCounter(pData->stats, UCHAR_CONSTANT("maxused"), ctrType_IntCtr, CTR_FLAG_RESETTABLE, &(pData->ctrMax))); + STATSCOUNTER_INIT(pData->ctrCloseTimeouts, pData->mutCtrCloseTimeouts); + CHKiRet(statsobj.AddCounter(pData->stats, UCHAR_CONSTANT("closetimeouts"), + ctrType_IntCtr, CTR_FLAG_RESETTABLE, &(pData->ctrCloseTimeouts))); CHKiRet(statsobj.ConstructFinalize(pData->stats)); finalize_it: @@ -1236,6 +1299,8 @@ CODESTARTnewActInst pData->sigprovName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "cry.provider")) { pData->cryprovName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); + } else if(!strcmp(actpblk.descr[i].name, "closetimeout")) { + pData->iCloseTimeout = (int) pvals[i].val.d.n; } else { dbgprintf("omfile: program error, non-handled " "param '%s'\n", actpblk.descr[i].name); @@ -1275,6 +1340,17 @@ CODESTARTnewActInst // TODO: add pData->iSizeLimit = 0; /* default value, use outchannels to configure! */ setupInstStatsCtrs(pData); + if(pData->iCloseTimeout == -1) { /* unset? */ + pData->iCloseTimeout = (pData->bDynamicName) ? 10 : 0; + } + + snprintf(pData->janitorID, sizeof(pData->janitorID), "omfile:%sfile:%s:%p", + (pData->bDynamicName) ? "dyna" : "", pData->fname, pData); + pData->janitorID[sizeof(pData->janitorID)-1] = '\0'; /* just in case... */ + + if(pData->iCloseTimeout > 0) + janitorAddEtry(janitorCB, pData->janitorID, pData); + CODE_STD_FINALIZERnewActInst cnfparamvalsDestruct(pvals, &actpblk); ENDnewActInst @@ -1366,6 +1442,7 @@ CODESTARTparseSelectorAct pData->iFlushInterval = cs.iFlushInterval; pData->bUseAsyncWriter = cs.bUseAsyncWriter; pData->bVeryRobustZip = 0; /* cannot be specified via legacy conf */ + pData->iCloseTimeout = 0; /* cannot be specified via legacy conf */ setupInstStatsCtrs(pData); CODE_STD_FINALIZERparseSelectorAct ENDparseSelectorAct diff --git a/tools/pmrfc3164.c b/tools/pmrfc3164.c index 9bae2b3..7ffae43 100644 --- a/tools/pmrfc3164.c +++ b/tools/pmrfc3164.c @@ -93,14 +93,14 @@ CODESTARTparse */ if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse, &lenMsg) == RS_RET_OK) { /* we are done - parse pointer is moved by ParseTIMESTAMP3339 */; - } else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse, &lenMsg) == RS_RET_OK) { + } else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse, &lenMsg, NO_PARSE3164_TZSTRING) == RS_RET_OK) { if(pMsg->dfltTZ[0] != '\0') applyDfltTZ(&pMsg->tTIMESTAMP, pMsg->dfltTZ); /* we are done - parse pointer is moved by ParseTIMESTAMP3164 */; } else if(*p2parse == ' ' && lenMsg > 1) { /* try to see if it is slighly malformed - HP procurve seems to do that sometimes */ ++p2parse; /* move over space */ --lenMsg; - if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse, &lenMsg) == RS_RET_OK) { + if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse, &lenMsg, NO_PARSE3164_TZSTRING) == RS_RET_OK) { /* indeed, we got it! */ /* we are done - parse pointer is moved by ParseTIMESTAMP3164 */; } else {/* parse pointer needs to be restored, as we moved it off-by-one diff --git a/tools/rscryutil.1 b/tools/rscryutil.1 index c1d8d04..cd6dc9d 100644 --- a/tools/rscryutil.1 +++ b/tools/rscryutil.1 @@ -1,4 +1,4 @@ -.\" Man page generated from reStructuredText. +.\" Man page generated from reStructeredText. . .TH RSCRYUTIL 1 "2013-04-15" "" "" .SH NAME @@ -31,16 +31,12 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS -.INDENT 0.0 -.INDENT 3.5 .sp .nf .ft C rscryutil [OPTIONS] [FILE] ... .ft P .fi -.UNINDENT -.UNINDENT .SH DESCRIPTION .sp This tool performs various operations on encrypted log files. @@ -48,46 +44,46 @@ Most importantly, it provides the ability to decrypt them. .SH OPTIONS .INDENT 0.0 .TP -.B \-d\fP,\fB \-\-decrypt +.B \-d, \-\-decrypt Select decryption mode. This is the default mode. .TP -.BI \-W\fP,\fB \-\-write\-keyfile \ +.BI \-W, \-\-write\-keyfile \ Utility function to write a key to a keyfile. The key can be obtained via any method. .TP -.B \-v\fP,\fB \-\-verbose +.B \-v, \-\-verbose Select verbose mode. .TP -.B \-f\fP,\fB \-\-force +.B \-f, \-\-force Forces operations that otherwise would fail. .TP -.BI \-k\fP,\fB \-\-keyfile \ +.BI \-k, \-\-keyfile \ Reads the key from . File _must_ contain the key, only, no headers or other meta information. Keyfiles can be generated via the \fI\-\-write\-keyfile\fP option. .TP -.BI \-p\fP,\fB \-\-key\-program \ +.BI \-p, \-\-key\-program \ In this mode, the key is provided by a so\-called "key program". This program is executed and must return the key to (as well as some meta information) via stdout. The core idea of key programs is that using this interface the user can implement as complex (and secure) method to obtain keys as desired, all without the need to make modifications to rsyslog. .TP -.BI \-K\fP,\fB \-\-key \ +.BI \-K, \-\-key \ TESTING AID, NOT FOR PRODUCTION USE. This uses the KEY specified on the command line. This is the actual key, and as such this mode is highly insecure. However, it can be useful for intial testing steps. This option may be removed in the future. .TP -.BI \-a\fP,\fB \-\-algo \ +.BI \-a, \-\-algo \ Sets the encryption algorightm (cipher) to be used. See below for supported algorithms. The default is "AES128". .TP -.BI \-m\fP,\fB \-\-mode \ +.BI \-m, \-\-mode \ Sets the ciphermode to be used. See below for supported modes. The default is "CBC". .TP -.BI \-r\fP,\fB \-\-generate\-random\-key \ +.BI \-r, \-\-generate\-random\-key \ Generates a random key of length . This option is meant to be used together with \fI\-\-write\-keyfile\fP (and it is hard to envision any other valid use for it). @@ -101,7 +97,7 @@ multiple operations mode are set on the command line, results are unpredictable. .SS decrypt .sp -The provided log files are decrypted. Note that the \fI\&.encinfo\fP side files +The provided log files are decrypted. Note that the \fI.encinfo\fP side files must exist and be accessible in order for decryption to to work. .SS write\-keyfile .sp @@ -202,4 +198,5 @@ LGPLv2. .SH AUTHOR Rainer Gerhards .\" Generated by docutils manpage writer. +.\" . diff --git a/tools/rscryutil.c b/tools/rscryutil.c index 2591b2c..701bd1a 100644 --- a/tools/rscryutil.c +++ b/tools/rscryutil.c @@ -120,8 +120,8 @@ eiGetIV(FILE *eifp, char *iv, size_t leniv) } valueLen = strlen(value); if(valueLen/2 != leniv) { - fprintf(stderr, "length of IV is %d, expected %d\n", - valueLen/2, leniv); + fprintf(stderr, "length of IV is %lld, expected %lld\n", + (long long) valueLen/2, (long long) leniv); r = 1; goto done; } @@ -170,8 +170,8 @@ initCrypt(FILE *eifp) blkLength = gcry_cipher_get_algo_blklen(cry_algo); if(blkLength > sizeof(iv)) { - fprintf(stderr, "internal error[%s:%d]: block length %d too large for " - "iv buffer\n", __FILE__, __LINE__, blkLength); + fprintf(stderr, "internal error[%s:%d]: block length %lld too large for " + "iv buffer\n", __FILE__, __LINE__, (long long) blkLength); r = 1; goto done; } if((r = eiGetIV(eifp, iv, blkLength)) != 0) goto done; @@ -179,8 +179,8 @@ initCrypt(FILE *eifp) size_t keyLength = gcry_cipher_get_algo_keylen(cry_algo); if(strlen(cry_key) != keyLength) { fprintf(stderr, "invalid key length; key is %u characters, but " - "exactly %u characters are required\n", cry_keylen, - keyLength); + "exactly %llu characters are required\n", cry_keylen, + (long long unsigned) keyLength); r = 1; goto done; } diff --git a/tools/rsgtutil.1 b/tools/rsgtutil.1 index f08a951..5543a11 100644 --- a/tools/rsgtutil.1 +++ b/tools/rsgtutil.1 @@ -1,4 +1,4 @@ -.\" Man page generated from reStructuredText. +.\" Man page generated from reStructeredText. . .TH RSGTUTIL 1 "2013-03-25" "" "" .SH NAME @@ -31,16 +31,12 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS -.INDENT 0.0 -.INDENT 3.5 .sp .nf .ft C rsgtutil [OPTIONS] [FILE] ... .ft P .fi -.UNINDENT -.UNINDENT .SH DESCRIPTION .sp This tool performs various maintenance operations on signed log files. @@ -62,32 +58,32 @@ that not all operation modes support stdin. .SH OPTIONS .INDENT 0.0 .TP -.B \-D\fP,\fB \-\-dump +.B \-D, \-\-dump Select "dump" operations mode. .TP -.B \-t\fP,\fB \-\-verify +.B \-t, \-\-verify Select "verify" operations mode. .TP -.B \-T\fP,\fB \-\-detect\-file\-type +.B \-T, \-\-detect\-file\-type Select "detect\-file\-type" operations mode. .TP -.B \-B\fP,\fB \-\-show\-sigblock\-params +.B \-B, \-\-show\-sigblock\-params Select "show\-sigblock\-params" operations mode. .TP -.B \-s\fP,\fB \-\-show\-verified +.B \-s, \-\-show\-verified Prints out information about correctly verified blocks (by default, only errors are printed). .TP -.B \-v\fP,\fB \-\-verbose +.B \-v, \-\-verbose Select verbose mode. Most importantly, hashes and signatures are printed in full length (can be \fBvery\fP lengthy) rather than the usual abbreviation. .TP -.B \-e\fP,\fB \-\-extend +.B \-e, \-\-extend Select extend mode. This extends the RFC3161 signatures. Note that this mode also implies a full verification. If there are verify errors, extending will also fail. .TP -.BI \-P \ \fP,\fB \ \-\-publications\-server \ +.BI \-P \ , \ \-\-publications\-server \ Sets the publications server. If not set but required by the operation a default server is used. The default server is not necessarily optimal in regard to performance and reliability. @@ -179,4 +175,5 @@ LGPLv2. .SH AUTHOR Rainer Gerhards .\" Generated by docutils manpage writer. +.\" . diff --git a/tools/rsgtutil.c b/tools/rsgtutil.c index 62c33ed..9808268 100644 --- a/tools/rsgtutil.c +++ b/tools/rsgtutil.c @@ -103,7 +103,7 @@ showSigblkParams(char *name) ++blkCnt; rsgt_printBLOCK_SIG(stdout, bs, verbose); printf("\t***META INFORMATION:\n"); - printf("\tBlock Nbr in File...: %llu\n", blkCnt); + printf("\tBlock Nbr in File...: %llu\n", (long long unsigned) blkCnt); printf("\tHas Record Hashes...: %d\n", bHasRecHashes); printf("\tHas Tree Hashes.....: %d\n", bHasIntermedHashes); } @@ -266,7 +266,7 @@ verify(char *name) } else { if(verbose) fprintf(stderr, "EOF after signature block %lld\n", - ectx.blkNum); + (long long unsigned) ectx.blkNum); } goto done; } diff --git a/tools/rsyslogd.8 b/tools/rsyslogd.8 index ac732b8..6d295a5 100644 --- a/tools/rsyslogd.8 +++ b/tools/rsyslogd.8 @@ -1,7 +1,7 @@ .\" Copyright 2004-2008 Rainer Gerhards and Adiscon for the rsyslog modifications .\" May be distributed under the GNU General Public License .\" -.TH RSYSLOGD 8 "16 October 2012" "Version 6.4.3" "Linux System Administration" +.TH RSYSLOGD 8 "27 May 2014" "Version 8.3.3" "Linux System Administration" .SH NAME rsyslogd \- reliable and extended syslogd .SH SYNOPSIS @@ -239,16 +239,6 @@ kill -HUP $(cat /var/run/rsyslogd.pid) This lets .B rsyslogd perform close all open files. -Also, in v3 a full restart will be done in order to read changed configuration files. -Note that this means a full rsyslogd restart is done. This has, among others, -the consequence that TCP and other connections are torn down. Also, if any -queues are not running in disk assisted mode or are not set to persist data -on shutdown, queue data is lost. HUPing rsyslogd is an extremely expensive -operation and should only be done when actually necessary. Actually, it is -a rsyslgod stop immediately followed by a restart. Future versions will remove -this restart functionality of HUP (it will go away in v5). So it is advised to use -HUP only for closing files, and a "real restart" (e.g. /etc/rc.d/rsyslogd restart) -to activate configuration changes. .TP .B TERM ", " INT ", " QUIT .B Rsyslogd diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c index 3b12b09..abff2c6 100644 --- a/tools/rsyslogd.c +++ b/tools/rsyslogd.c @@ -54,6 +54,7 @@ #include "cfsysline.h" #include "datetime.h" #include "dirty.h" +#include "janitor.h" DEFobjCurrIf(obj) DEFobjCurrIf(prop) @@ -82,7 +83,6 @@ void syslogd_die(void); void syslogd_releaseClassPointers(void); void syslogd_sighup_handler(); char **syslogd_crunch_list(char *list); -void syslogd_printVersion(void); rsRetVal syslogd_doGlblProcessInit(void); rsRetVal syslogd_obtainClassPointers(void); /* end syslogd.c imports */ @@ -124,24 +124,63 @@ rsyslogd_usage(void) exit(1); /* "good" exit - done to terminate usage() */ } -/* This is a support function for imdiag. It returns back the approximate - * current number of messages in the main message queue - * This number includes the messages that reside in an associated DA queue (if - * it exists) -- rgerhards, 2009-10-14 - * Note that this is imprecise, but needed for the testbench. It should not be used - * for any other purpose -- impstats is the right tool for all other cases. - */ -rsRetVal -diagGetMainMsgQSize(int *piSize) + +/* print version and compile-time setting information */ +static void +printVersion(void) { - DEFiRet; - assert(piSize != NULL); - *piSize = (pMsgQueue->pqDA != NULL) ? pMsgQueue->pqDA->iQueueSize : 0; - *piSize += pMsgQueue->iQueueSize; - RETiRet; + printf("rsyslogd %s, ", VERSION); + printf("compiled with:\n"); +#ifdef FEATURE_REGEXP + printf("\tFEATURE_REGEXP:\t\t\t\tYes\n"); +#else + printf("\tFEATURE_REGEXP:\t\t\t\tNo\n"); +#endif +#if defined(SYSLOG_INET) && defined(USE_GSSAPI) + printf("\tGSSAPI Kerberos 5 support:\t\tYes\n"); +#else + printf("\tGSSAPI Kerberos 5 support:\t\tNo\n"); +#endif +#ifndef NDEBUG + printf("\tFEATURE_DEBUG (debug build, slow code):\tYes\n"); +#else + printf("\tFEATURE_DEBUG (debug build, slow code):\tNo\n"); +#endif +#ifdef HAVE_ATOMIC_BUILTINS + printf("\t32bit Atomic operations supported:\tYes\n"); +#else + printf("\t32bit Atomic operations supported:\tNo\n"); +#endif +#ifdef HAVE_ATOMIC_BUILTINS64 + printf("\t64bit Atomic operations supported:\tYes\n"); +#else + printf("\t64bit Atomic operations supported:\tNo\n"); +#endif +#ifdef HAVE_JEMALLOC + printf("\tmemory allocator:\t\t\tjemalloc\n"); +#else + printf("\tmemory allocator:\t\t\tsystem default\n"); +#endif +#ifdef RTINST + printf("\tRuntime Instrumentation (slow code):\tYes\n"); +#else + printf("\tRuntime Instrumentation (slow code):\tNo\n"); +#endif +#ifdef USE_LIBUUID + printf("\tuuid support:\t\t\t\tYes\n"); +#else + printf("\tuuid support:\t\t\t\tNo\n"); +#endif +#ifdef HAVE_JSON_OBJECT_NEW_INT64 + printf("\tNumber of Bits in RainerScript integers: 64\n"); +#else + printf("\tNumber of Bits in RainerScript integers: 32 (due to too-old json-c lib)\n"); +#endif + printf("\nSee http://www.rsyslog.com for more information.\n"); } + void rsyslogd_sigttin_handler() { @@ -735,16 +774,11 @@ initAll(int argc, char **argv) case '4': case '6': case 'A': - case 'a': case 'f': /* configuration file */ - case 'h': case 'i': /* pid file name */ case 'l': - case 'm': /* mark interval */ case 'n': /* don't fork */ case 'N': /* enable config verify mode */ - case 'o': - case 'p': case 'q': /* add hostname if DNS resolving has failed */ case 'Q': /* dont resolve hostnames in ACL to IPs */ case 's': @@ -753,14 +787,8 @@ initAll(int argc, char **argv) case 'u': /* misc user settings */ case 'w': /* disable disallowed host warnings */ case 'x': /* disable dns for remote messages */ - case 'g': /* enable tcp gssapi logging */ - case 'r': /* accept remote messages */ - case 't': /* enable tcp logging */ CHKiRet(bufOptAdd(ch, optarg)); break; - case 'c': /* compatibility mode */ - fprintf(stderr, "rsyslogd: error: option -c is no longer supported - ignored\n"); - break; case 'd': /* debug - must be handled now, so that debug is active during init! */ debugging_on = 1; Debug = 1; @@ -776,7 +804,7 @@ initAll(int argc, char **argv) glblModPath = (uchar*) optarg; break; case 'v': /* MUST be carried out immediately! */ - syslogd_printVersion(); + printVersion(); exit(0); /* exit for -v option - so this is a "good one" */ case '?': default: @@ -827,9 +855,6 @@ initAll(int argc, char **argv) case 'A': send_to_all++; break; - case 'a': - fprintf(stderr, "rsyslogd: error -a is no longer supported, use module imuxsock instead"); - break; case 'S': /* Source IP for local client to be used on multihomed host */ if(glbl.GetSourceIPofLocalClient() != NULL) { fprintf (stderr, "rsyslogd: Only one -S argument allowed, the first one is taken.\n"); @@ -840,11 +865,6 @@ initAll(int argc, char **argv) case 'f': /* configuration file */ ConfFile = (uchar*) arg; break; - case 'g': /* enable tcp gssapi logging */ - fprintf(stderr, "rsyslogd: -g option no longer supported - ignored\n"); - case 'h': - fprintf(stderr, "rsyslogd: error -h is no longer supported - ignored"); - break; case 'i': /* pid file name */ PidFile = arg; break; @@ -855,30 +875,18 @@ initAll(int argc, char **argv) glbl.SetLocalHosts(syslogd_crunch_list(arg)); } break; - case 'm': /* mark interval */ - fprintf(stderr, "rsyslogd: error -m is no longer supported - use immark instead"); - break; case 'n': /* don't fork */ doFork = 0; break; case 'N': /* enable config verify mode */ iConfigVerify = atoi(arg); break; - case 'o': - fprintf(stderr, "error -o is no longer supported, use module imuxsock instead"); - break; - case 'p': - fprintf(stderr, "error -p is no longer supported, use module imuxsock instead"); - break; case 'q': /* add hostname if DNS resolving has failed */ *(net.pACLAddHostnameOnFail) = 1; break; case 'Q': /* dont resolve hostnames in ACL to IPs */ *(net.pACLDontResolve) = 1; break; - case 'r': /* accept remote messages */ - fprintf(stderr, "rsyslogd: error option -r is no longer supported - ignored"); - break; case 's': if(glbl.GetStripDomains() != NULL) { fprintf (stderr, "rsyslogd: Only one -s argument allowed, the first one is taken.\n"); @@ -886,9 +894,6 @@ initAll(int argc, char **argv) glbl.SetStripDomains(syslogd_crunch_list(arg)); } break; - case 't': /* enable tcp logging */ - fprintf(stderr, "rsyslogd: error option -t is no longer supported - ignored"); - break; case 'T':/* chroot() immediately at program startup, but only for testing, NOT security yet */ if(chroot(arg) != 0) { perror("chroot"); @@ -1044,7 +1049,7 @@ static inline void processImInternal(void) msg_t *pMsg; while(iminternalRemoveMsg(&pMsg) == RS_RET_OK) { - ratelimitAddMsg(dflt_ratelimiter, NULL, pMsg); + submitMsgWithDfltRatelimiter(pMsg); } } @@ -1182,26 +1187,18 @@ mainloop(void) struct timeval tvSelectTimeout; BEGINfunc - /* first check if we have any internal messages queued and spit them out. We used - * to do that on any loop iteration, but that is no longer necessry. The reason - * is that once we reach this point here, we always run on multiple threads and - * thus the main queue is properly initialized. -- rgerhards, 2008-06-09 - */ + /* first check if we have any internal messages queued and spit them out. */ processImInternal(); while(!bFinished){ - /* this is now just a wait - please note that we do use a near-"eternal" - * timeout of 1 day. This enables us to help safe the environment - * by not unnecessarily awaking rsyslog on a regular tick (just think - * powertop, for example). In that case, we primarily wait for a signal, - * but a once-a-day wakeup should be quite acceptable. -- rgerhards, 2008-06-09 - */ - tvSelectTimeout.tv_sec = 86400 /*1 day*/; + tvSelectTimeout.tv_sec = janitorInterval * 60; /* interval is in minutes! */ tvSelectTimeout.tv_usec = 0; select(1, NULL, NULL, NULL, &tvSelectTimeout); if(bFinished) break; /* exit as quickly as possible */ + janitorRun(); + if(bHadHUP) { doHUP(); bHadHUP = 0; @@ -1211,7 +1208,6 @@ mainloop(void) ENDfunc } - /* Finalize and destruct all actions. */ void diff --git a/tools/syslogd.c b/tools/syslogd.c index ec0beb7..ac45775 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -134,13 +134,8 @@ void rsyslogdDebugSwitch(); void rsyslogdDoDie(int sig); -#if defined(SYSLOGD_PIDNAME) -# undef _PATH_LOGPID -# define _PATH_LOGPID "/etc/" SYSLOGD_PIDNAME -#else -# ifndef _PATH_LOGPID -# define _PATH_LOGPID "/etc/rsyslogd.pid" -# endif +#ifndef _PATH_LOGPID +# define _PATH_LOGPID "/var/run/rsyslogd.pid" #endif #ifndef _PATH_TTY @@ -325,70 +320,6 @@ void syslogd_sighup_handler() sigaction(SIGHUP, &sigAct, NULL); } -/* print version and compile-time setting information. - */ -void syslogd_printVersion(void) -{ - printf("rsyslogd %s, ", VERSION); - printf("compiled with:\n"); -#ifdef FEATURE_REGEXP - printf("\tFEATURE_REGEXP:\t\t\t\tYes\n"); -#else - printf("\tFEATURE_REGEXP:\t\t\t\tNo\n"); -#endif -/* Yann Droneaud contribution */ -#if defined(_LARGE_FILES) || (defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS >= 64) -/* end Yann Droneaud contribution */ - printf("\tFEATURE_LARGEFILE:\t\t\tYes\n"); -#else - printf("\tFEATURE_LARGEFILE:\t\t\tNo\n"); -#endif -#if defined(SYSLOG_INET) && defined(USE_GSSAPI) - printf("\tGSSAPI Kerberos 5 support:\t\tYes\n"); -#else - printf("\tGSSAPI Kerberos 5 support:\t\tNo\n"); -#endif -#ifndef NDEBUG - printf("\tFEATURE_DEBUG (debug build, slow code):\tYes\n"); -#else - printf("\tFEATURE_DEBUG (debug build, slow code):\tNo\n"); -#endif -#ifdef HAVE_ATOMIC_BUILTINS - printf("\t32bit Atomic operations supported:\tYes\n"); -#else - printf("\t32bit Atomic operations supported:\tNo\n"); -#endif -/* mono_matsuko contribution */ -#ifdef HAVE_ATOMIC_BUILTINS_64BIT -/* end mono_matsuko contribution */ - printf("\t64bit Atomic operations supported:\tYes\n"); -#else - printf("\t64bit Atomic operations supported:\tNo\n"); -#endif -#ifdef HAVE_JEMALLOC - printf("\tmemory allocator:\t\t\tjemalloc\n"); -#else - printf("\tmemory allocator:\t\t\tsystem default\n"); -#endif -#ifdef RTINST - printf("\tRuntime Instrumentation (slow code):\tYes\n"); -#else - printf("\tRuntime Instrumentation (slow code):\tNo\n"); -#endif -#ifdef USE_LIBUUID - printf("\tuuid support:\t\t\t\tYes\n"); -#else - printf("\tuuid support:\t\t\t\tNo\n"); -#endif -#ifdef HAVE_JSON_OBJECT_NEW_INT64 - printf("\tNumber of Bits in RainerScript integers: 64\n"); -#else - printf("\tNumber of Bits in RainerScript integers: 32 (due to too-old json-c lib)\n"); -#endif - printf("\nSee http://www.rsyslog.com for more information.\n"); -} - - /* obtain ptrs to all clases we need. */ rsRetVal syslogd_obtainClassPointers(void) -- cgit v1.2.3