diff --git a/SOURCES/rsyslog-7.4.7-rhbz1146237-mmutf8fix.patch b/SOURCES/rsyslog-7.4.7-rhbz1146237-mmutf8fix.patch
new file mode 100644
index 0000000..a6a4a32
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1146237-mmutf8fix.patch
@@ -0,0 +1,1380 @@
+Backport of the mmutf8fix module from upstream
+
+8929d2f mmutf8fix: new module to fix invalid UTF-8 sequences
+554fc84 mmutf8fix: now supports native UTF-8 multibyte sequence handling
+666d301 mmutf8fix: stricter UTF-8 checking
+97bda43 bugfix: mmutf8fix did not properly handle invalid UTF-8 at END of message
+2517719 mmutf8fix: compile problem & potential misadressing at end of message
+d322a9d bugfix: mmutf8fix did not detect two invalid sequences
+b03d66c silence may be uninitialized warnings where there is already a guard test.
+41e2001 re-enable some compiler warnings that should be dealt with
+fcdbdb1 fix some clang static analyzer violations
+
+diff --git a/Makefile.in b/Makefile.in
+index 840fe49..6da9e19 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -86,8 +86,9 @@ sbin_PROGRAMS =
+ @ENABLE_MMAUDIT_TRUE@am__append_43 = plugins/mmaudit
+ @ENABLE_MMANON_TRUE@am__append_44 = plugins/mmanon
+ @ENABLE_MMCOUNT_TRUE@am__append_45 = plugins/mmcount
+-@ENABLE_ORACLE_TRUE@am__append_46 = plugins/omoracle
+-@ENABLE_GUI_TRUE@am__append_47 = java
++@ENABLE_MMUTF8FIX_TRUE@am__append_46 = plugins/mmutf8fix
++@ENABLE_ORACLE_TRUE@am__append_47 = plugins/omoracle
++@ENABLE_GUI_TRUE@am__append_48 = java
+ subdir = .
+ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+@@ -232,7 +233,8 @@ DIST_SUBDIRS = doc compat runtime grammar . plugins/immark \
+ plugins/imptcp plugins/imttcp plugins/imdiag plugins/ommail \
+ plugins/omprog plugins/im3195 plugins/mmnormalize \
+ plugins/mmjsonparse plugins/mmaudit plugins/mmanon \
+- plugins/mmcount plugins/omoracle java tests
++ plugins/mmcount plugins/omoracle java tests \
++ plugins/mmutf8fix
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ distdir = $(PACKAGE)-$(VERSION)
+ top_distdir = $(distdir)
+@@ -533,7 +535,8 @@ SUBDIRS = doc compat runtime grammar . plugins/immark plugins/imuxsock \
+ $(am__append_37) $(am__append_38) $(am__append_39) \
+ $(am__append_40) $(am__append_41) $(am__append_42) \
+ $(am__append_43) $(am__append_44) $(am__append_45) \
+- $(am__append_46) $(am__append_47) tests
++ $(am__append_46) $(am__append_47) $(am__append_48) \
++ tests
+
+ # make sure "make distcheck" tries to build all modules. This means that
+ # a developer must always have an environment where every supporting library
+# diff --git a/Makefile.am b/Makefile.am
+# index 567b876..5714d1f 100644
+# --- a/Makefile.am
+# +++ b/Makefile.am
+# @@ -241,6 +241,10 @@ if ENABLE_MMANON
+# SUBDIRS += plugins/mmanon
+# endif
+#
+# +if ENABLE_MMUTF8FIX
+# +SUBDIRS += plugins/mmutf8fix
+# +endif
+# +
+# if ENABLE_ORACLE
+# SUBDIRS += plugins/omoracle
+# endif
+diff --git a/configure b/configure
+index c346e52..59fcb1a 100755
+--- a/configure
++++ b/configure
+@@ -692,6 +692,8 @@ ENABLE_RELP_FALSE
+ RELP_CFLAGS
+ ENABLE_MMCOUNT_FALSE
+ ENABLE_MMCOUNT_TRUE
++ENABLE_MMUTF8FIX_FALSE
++ENABLE_MMUTF8FIX_TRUE
+ ENABLE_MMANON_FALSE
+ ENABLE_MMANON_TRUE
+ ENABLE_MMAUDIT_FALSE
+@@ -980,6 +982,7 @@ enable_mmnormalize
+ enable_mmaudit
+ enable_mmanon
+ enable_mmcount
++enable_mmutf8fix
+ enable_relp
+ enable_guardtime
+ enable_cached_man_pages
+@@ -1726,6 +1729,7 @@ Optional Features:
+ --enable-mmaudit Enable building mmaudit support [default=no]
+ --enable-mmanon Enable building mmanon support [default=no]
+ --enable-mmcount Enable message counting [default=no]
++ --enable-mmutf8fix Enable building mmutf8fix support [default=no]
+ --enable-relp Enable RELP support [default=no]
+ --enable-guardtime Enable log file signing support (via GuardTime)
+ [default=no]
+@@ -18338,6 +18342,29 @@ fi
+
+
+
++# mmutf8fix
++# Check whether --enable-mmutf8fix was given.
++if test "${enable_mmutf8fix+set}" = set; then :
++ enableval=$enable_mmutf8fix; case "${enableval}" in
++ yes) enable_mmutf8fix="yes" ;;
++ no) enable_mmutf8fix="no" ;;
++ *) as_fn_error $? "bad value ${enableval} for --enable-mmutf8fix" "$LINENO" 5 ;;
++ esac
++else
++ enable_mmutf8fix=no
++
++fi
++
++ if test x$enable_mmutf8fix = xyes; then
++ ENABLE_MMUTF8FIX_TRUE=
++ ENABLE_MMUTF8FIX_FALSE='#'
++else
++ ENABLE_MMUTF8FIX_TRUE='#'
++ ENABLE_MMUTF8FIX_FALSE=
++fi
++
++
++
+ # RELP support
+ # Check whether --enable-relp was given.
+ if test "${enable_relp+set}" = set; then :
+@@ -20001,7 +20028,7 @@ fi
+
+ # END HIREDIS SUPPORT
+
+-ac_config_files="$ac_config_files Makefile runtime/Makefile compat/Makefile grammar/Makefile tools/Makefile doc/Makefile plugins/imudp/Makefile plugins/imtcp/Makefile plugins/im3195/Makefile plugins/imgssapi/Makefile plugins/imuxsock/Makefile plugins/imjournal/Makefile plugins/immark/Makefile plugins/imklog/Makefile plugins/imkmsg/Makefile plugins/omhdfs/Makefile plugins/omprog/Makefile plugins/omstdout/Makefile plugins/omjournal/Makefile plugins/pmrfc3164sd/Makefile plugins/pmlastmsg/Makefile plugins/pmcisconames/Makefile plugins/pmsnare/Makefile plugins/pmaixforwardedfrom/Makefile plugins/omruleset/Makefile plugins/omuxsock/Makefile plugins/imfile/Makefile plugins/imsolaris/Makefile plugins/imptcp/Makefile plugins/imttcp/Makefile plugins/impstats/Makefile plugins/imrelp/Makefile plugins/imdiag/Makefile plugins/imzmq3/Makefile plugins/omtesting/Makefile plugins/omgssapi/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile plugins/omrelp/Makefile plugins/omlibdbi/Makefile plugins/ommail/Makefile plugins/omsnmp/Makefile plugins/omoracle/Makefile plugins/omudpspoof/Makefile plugins/ommongodb/Makefile plugins/omhiredis/Makefile plugins/omzmq3/Makefile plugins/omrabbitmq/Makefile plugins/mmnormalize/Makefile plugins/mmjsonparse/Makefile plugins/mmaudit/Makefile plugins/mmanon/Makefile plugins/omelasticsearch/Makefile plugins/sm_cust_bindcdr/Makefile plugins/mmsnmptrapd/Makefile plugins/mmcount/Makefile java/Makefile tests/Makefile"
++ac_config_files="$ac_config_files Makefile runtime/Makefile compat/Makefile grammar/Makefile tools/Makefile doc/Makefile plugins/imudp/Makefile plugins/imtcp/Makefile plugins/im3195/Makefile plugins/imgssapi/Makefile plugins/imuxsock/Makefile plugins/imjournal/Makefile plugins/immark/Makefile plugins/imklog/Makefile plugins/imkmsg/Makefile plugins/omhdfs/Makefile plugins/omprog/Makefile plugins/omstdout/Makefile plugins/omjournal/Makefile plugins/pmrfc3164sd/Makefile plugins/pmlastmsg/Makefile plugins/pmcisconames/Makefile plugins/pmsnare/Makefile plugins/pmaixforwardedfrom/Makefile plugins/omruleset/Makefile plugins/omuxsock/Makefile plugins/imfile/Makefile plugins/imsolaris/Makefile plugins/imptcp/Makefile plugins/imttcp/Makefile plugins/impstats/Makefile plugins/imrelp/Makefile plugins/imdiag/Makefile plugins/imzmq3/Makefile plugins/omtesting/Makefile plugins/omgssapi/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile plugins/omrelp/Makefile plugins/omlibdbi/Makefile plugins/ommail/Makefile plugins/omsnmp/Makefile plugins/omoracle/Makefile plugins/omudpspoof/Makefile plugins/ommongodb/Makefile plugins/omhiredis/Makefile plugins/omzmq3/Makefile plugins/omrabbitmq/Makefile plugins/mmnormalize/Makefile plugins/mmjsonparse/Makefile plugins/mmaudit/Makefile plugins/mmanon/Makefile plugins/mmutf8fix/Makefile plugins/omelasticsearch/Makefile plugins/sm_cust_bindcdr/Makefile plugins/mmsnmptrapd/Makefile plugins/mmcount/Makefile java/Makefile tests/Makefile"
+
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
+@@ -20272,6 +20229,10 @@ if test -z "${ENABLE_MMANON_TRUE}" && test -z "${ENABLE_MMANON_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_MMCOUNT\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${ENABLE_MMUTF8FIX_TRUE}" && test -z "${ENABLE_MMUTF8FIX_FALSE}"; then
++ as_fn_error $? "conditional \"ENABLE_MMUTF8FIX\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+ if test -z "${ENABLE_RELP_TRUE}" && test -z "${ENABLE_RELP_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_RELP\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+@@ -21324,6 +21355,7 @@ do
+ "plugins/mmjsonparse/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/mmjsonparse/Makefile" ;;
+ "plugins/mmaudit/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/mmaudit/Makefile" ;;
+ "plugins/mmanon/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/mmanon/Makefile" ;;
++ "plugins/mmutf8fix/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/mmutf8fix/Makefile" ;;
+ "plugins/omelasticsearch/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/omelasticsearch/Makefile" ;;
+ "plugins/sm_cust_bindcdr/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/sm_cust_bindcdr/Makefile" ;;
+ "plugins/mmsnmptrapd/Makefile") CONFIG_FILES="$CONFIG_FILES plugins/mmsnmptrapd/Makefile" ;;
+@@ -22744,6 +22776,7 @@ echo " mmnormalize module will be compiled: $enable_mmnormalize"
+ echo " mmjsonparse module will be compiled: $enable_mmjsonparse"
+ echo " mmjaduit module will be compiled: $enable_mmaudit"
+ echo " mmsnmptrapd module will be compiled: $enable_mmsnmptrapd"
++echo " mmutf8fix enabled: $enable_mmutf8fix"
+ echo
+ echo "---{ strgen modules }---"
+ echo " sm_cust_bindcdr module will be compiled: $enable_sm_cust_bindcdr"
+# diff --git a/configure.ac b/configure.ac
+# index 123ed7e..5425897 100644
+# --- a/configure.ac
+# +++ b/configure.ac
+# @@ -964,6 +964,19 @@ AC_ARG_ENABLE(mmanon,
+# AM_CONDITIONAL(ENABLE_MMANON, test x$enable_mmanon = xyes)
+#
+#
+# +# mmutf8fix
+# +AC_ARG_ENABLE(mmutf8fix,
+# + [AS_HELP_STRING([--enable-mmutf8fix],[Enable building mmutf8fix support @<:@default=no@:>@])],
+# + [case "${enableval}" in
+# + yes) enable_mmutf8fix="yes" ;;
+# + no) enable_mmutf8fix="no" ;;
+# + *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmutf8fix) ;;
+# + esac],
+# + [enable_mmutf8fix=no]
+# +)
+# +AM_CONDITIONAL(ENABLE_MMUTF8FIX, test x$enable_mmutf8fix = xyes)
+# +
+# +
+# # RELP support
+# AC_ARG_ENABLE(relp,
+# [AS_HELP_STRING([--enable-relp],[Enable RELP support @<:@default=no@:>@])],
+# @@ -1480,6 +1493,7 @@ AC_CONFIG_FILES([Makefile \
+# plugins/mmjsonparse/Makefile \
+# plugins/mmaudit/Makefile \
+# plugins/mmanon/Makefile \
+# + plugins/mmutf8fix/Makefile \
+# plugins/omelasticsearch/Makefile \
+# plugins/sm_cust_bindcdr/Makefile \
+# plugins/mmsnmptrapd/Makefile \
+# @@ -1541,6 +1555,7 @@ echo " mmnormalize module will be compiled: $enable_mmnormalize"
+# echo " mmjsonparse module will be compiled: $enable_mmjsonparse"
+# echo " mmjaduit module will be compiled: $enable_mmaudit"
+# echo " mmsnmptrapd module will be compiled: $enable_mmsnmptrapd"
+# +echo " mmutf8fix enabled: $enable_mmutf8fix"
+# echo
+# echo "---{ strgen modules }---"
+# echo " sm_cust_bindcdr module will be compiled: $enable_sm_cust_bindcdr"
+diff --git a/doc/mmutf8fix.html b/doc/mmutf8fix.html
+new file mode 100644
+index 0000000..f7be26d
+--- /dev/null
++++ b/doc/mmutf8fix.html
+@@ -0,0 +1,96 @@
++
++
++
++Fix invalid UTF-8 Sequences (mmutf8fix)
++
++
++back
++
++Fix invalid UTF-8 Sequences (mmutf8fix)
++Module Name: mmutf8fix
++Author: Rainer Gerhards <rgerhards@adiscon.com>
++Available since: 7.5.4
++Description:
++The mmutf8fix module permits to fix invalid UTF-8 sequences.
++Most often, such invalid sequences result from syslog sources sending
++in non-UTF character sets, e.g. ISO 8859. As syslog does not have a way
++to convey the character set information, these sequences are not properly
++handled. While they are typically uncritical with plain text files, they can
++cause big headache with database sources as well as systems like ElasticSearch.
++
The module supports different "fixing" modes and fixes. The current
++implementation will always replace invalid bytes with a single US ASCII
++character. Additional replacement modes will probably be added in the future,
++depending on user demand. In the longer term
++it could also be evolved into an any-charset-to-UTF8 converter. But
++first let's see if it really gets into widespread enough use.
++
++
Proper Usage:
++Some notes are due for proper use of this module. This is a message modification
++module utilizing the action interface, which means you call it like an action.
++This gives great flexibility on the question on when and how to call this module.
++Note that once it has been called, it actually modifies the message. The original
++messsage is then no longer available. However, this does not change any
++properties set, used or extracted before the modification is done.
++
One potential use case is to normalize all messages. This is done by simply calling
++mmutf8fix right in front of all other actions.
++
If only a specific source (or set of sources) is known to cause problems,
++mmutf8fix can be conditionally called only on messages from them. This also offers
++performance benefits. If such multiple sources exists, it probably is a good idea
++to define different listeners for their incoming traffic, bind them to specific
++ruleset and call mmutf8fix as first action in this
++ruleset.
++
++
Module Configuration Parameters:
++Currently none.
++
++Action Confguration Parameters:
++
++- mode - utf-8/controlcharacters
++This sets the basic detection mode.
++
In utf-8 mode (the default), proper
++UTF-8 encoding is checked and bytes which are not proper UTF-8 sequences
++are acted on. If a proper multi-byte start sequence byte is detected but
++any of the following bytes is invalid, the whole sequence is replaced by
++the replacement method. This mode is most useful with non-US-ASCII character
++sets, which validly includes multibyte sequences. Note that in this mode
++control characters are NOT being replaced, because they are valid UTF-8.
++
In controlcharacters mode, all bytes which do not represent a
++printable US-ASCII character (codes 32 to 126) are replaced. Note that this
++also mangles valid UTF-8 multi-byte sequences, as these are (deliberately) outside
++of that character range.
++ - replacementChar - default " " (space), a single character
++This is the character that invalid sequences are replaced by. Currently, it
++MUST be a printable US-ASCII character.
++
++
++Caveats/Known Bugs:
++
++- overlong UTF-8 encodings are currently not detected in utf-8 mode.
++
++
++Samples:
++In this snippet, we write one file without fixing UTF-8 and another one
++with the message fixed. Note that once mmutf8fix has run, access to the
++original message is no longer possible.
++
++
++
In this sample, we fix only message originating from host 10.0.0.1.
++
++
++
[rsyslog.conf overview] [manual
++index] [rsyslog site]
++This documentation is part of the
++rsyslog project.
++Copyright © 2013 by Rainer Gerhards and
++Adiscon. Released under the GNU GPL
++version 3 or higher.
++
++
+diff --git a/doc/rsyslog_conf_modules.html b/doc/rsyslog_conf_modules.html
+index 18d6b8a..aacd44b 100644
+--- a/doc/rsyslog_conf_modules.html
++++ b/doc/rsyslog_conf_modules.html
+@@ -118,6 +118,7 @@ enabled structured log messages.
+ mmsnmptrapd - uses information provided by snmptrapd inside
+ the tag to correct the original sender system and priority of messages. Implemented via
+ the output module interface.
++mmutf8fix - used to fix invalid UTF-8 character sequences
+
+
+ String Generator Modules
+diff --git a/plugins/mmutf8fix/Makefile.am b/plugins/mmutf8fix/Makefile.am
+new file mode 100644
+index 0000000..2c0f283
+--- /dev/null
++++ b/plugins/mmutf8fix/Makefile.am
+@@ -0,0 +1,8 @@
++pkglib_LTLIBRARIES = mmutf8fix.la
++
++mmutf8fix_la_SOURCES = mmutf8fix.c
++mmutf8fix_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS)
++mmutf8fix_la_LDFLAGS = -module -avoid-version
++mmutf8fix_la_LIBADD =
++
++EXTRA_DIST =
+diff --git a/plugins/mmutf8fix/Makefile.in b/plugins/mmutf8fix/Makefile.in
+new file mode 100644
+index 0000000..deadbee
+--- /dev/null
++++ b/plugins/mmutf8fix/Makefile.in
+@@ -0,0 +1,714 @@
++# Makefile.in generated by automake 1.13.4 from Makefile.am.
++# @configure_input@
++
++# Copyright (C) 1994-2013 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.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
++# PARTICULAR PURPOSE.
++
++@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@
++pkglibexecdir = $(libexecdir)/@PACKAGE@
++am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
++install_sh_DATA = $(install_sh) -c -m 644
++install_sh_PROGRAM = $(install_sh) -c
++install_sh_SCRIPT = $(install_sh) -c
++INSTALL_HEADER = $(INSTALL_DATA)
++transform = $(program_transform_name)
++NORMAL_INSTALL = :
++PRE_INSTALL = :
++POST_INSTALL = :
++NORMAL_UNINSTALL = :
++PRE_UNINSTALL = :
++POST_UNINSTALL = :
++build_triplet = @build@
++host_triplet = @host@
++subdir = plugins/mmutf8fix
++DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
++ $(top_srcdir)/depcomp
++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
++am__aclocal_m4_deps = $(top_srcdir)/m4/atomic_operations.m4 \
++ $(top_srcdir)/m4/atomic_operations_64bit.m4 \
++ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
++ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
++ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
++ $(ACLOCAL_M4)
++mkinstalldirs = $(install_sh) -d
++CONFIG_HEADER = $(top_builddir)/config.h
++CONFIG_CLEAN_FILES =
++CONFIG_CLEAN_VPATH_FILES =
++am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
++am__vpath_adj = case $$p in \
++ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
++ *) f=$$p;; \
++ esac;
++am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
++am__install_max = 40
++am__nobase_strip_setup = \
++ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
++am__nobase_strip = \
++ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
++am__nobase_list = $(am__nobase_strip_setup); \
++ for p in $$list; do echo "$$p $$p"; done | \
++ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
++ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
++ if (++n[$$2] == $(am__install_max)) \
++ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
++ END { for (dir in files) print dir, files[dir] }'
++am__base_list = \
++ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
++ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
++am__uninstall_files_from_dir = { \
++ test -z "$$files" \
++ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
++ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
++ $(am__cd) "$$dir" && rm -f $$files; }; \
++ }
++am__installdirs = "$(DESTDIR)$(pkglibdir)"
++LTLIBRARIES = $(pkglib_LTLIBRARIES)
++mmutf8fix_la_DEPENDENCIES =
++am_mmutf8fix_la_OBJECTS = mmutf8fix_la-mmutf8fix.lo
++mmutf8fix_la_OBJECTS = $(am_mmutf8fix_la_OBJECTS)
++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 =
++mmutf8fix_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
++ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
++ $(mmutf8fix_la_LDFLAGS) $(LDFLAGS) -o $@
++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
++am__mv = mv -f
++COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
++ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
++LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
++ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
++ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
++ $(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 =
++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 =
++SOURCES = $(mmutf8fix_la_SOURCES)
++DIST_SOURCES = $(mmutf8fix_la_SOURCES)
++am__can_run_installinfo = \
++ case $$AM_UPDATE_INFO_DIR in \
++ n|no|NO) false;; \
++ *) (install-info --version) >/dev/null 2>&1;; \
++ esac
++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)
++ACLOCAL = @ACLOCAL@
++AMTAR = @AMTAR@
++AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
++AR = @AR@
++AUTOCONF = @AUTOCONF@
++AUTOHEADER = @AUTOHEADER@
++AUTOMAKE = @AUTOMAKE@
++AWK = @AWK@
++CC = @CC@
++CCDEPMODE = @CCDEPMODE@
++CFLAGS = @CFLAGS@
++CPP = @CPP@
++CPPFLAGS = @CPPFLAGS@
++CURL_CFLAGS = @CURL_CFLAGS@
++CURL_LIBS = @CURL_LIBS@
++CYGPATH_W = @CYGPATH_W@
++CZMQ_CFLAGS = @CZMQ_CFLAGS@
++CZMQ_LIBS = @CZMQ_LIBS@
++DEFS = @DEFS@
++DEPDIR = @DEPDIR@
++DLLTOOL = @DLLTOOL@
++DL_LIBS = @DL_LIBS@
++DSYMUTIL = @DSYMUTIL@
++DUMPBIN = @DUMPBIN@
++ECHO_C = @ECHO_C@
++ECHO_N = @ECHO_N@
++ECHO_T = @ECHO_T@
++EGREP = @EGREP@
++EXEEXT = @EXEEXT@
++FGREP = @FGREP@
++GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
++GNUTLS_LIBS = @GNUTLS_LIBS@
++GREP = @GREP@
++GSS_LIBS = @GSS_LIBS@
++GUARDTIME_CFLAGS = @GUARDTIME_CFLAGS@
++GUARDTIME_LIBS = @GUARDTIME_LIBS@
++HAVE_LIBGCRYPT_CONFIG = @HAVE_LIBGCRYPT_CONFIG@
++HAVE_MYSQL_CONFIG = @HAVE_MYSQL_CONFIG@
++HAVE_ORACLE_CONFIG = @HAVE_ORACLE_CONFIG@
++HAVE_PGSQL_CONFIG = @HAVE_PGSQL_CONFIG@
++HIREDIS_CFLAGS = @HIREDIS_CFLAGS@
++HIREDIS_LIBS = @HIREDIS_LIBS@
++IMUDP_LIBS = @IMUDP_LIBS@
++INSTALL = @INSTALL@
++INSTALL_DATA = @INSTALL_DATA@
++INSTALL_PROGRAM = @INSTALL_PROGRAM@
++INSTALL_SCRIPT = @INSTALL_SCRIPT@
++INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
++JSON_C_CFLAGS = @JSON_C_CFLAGS@
++JSON_C_LIBS = @JSON_C_LIBS@
++LD = @LD@
++LDFLAGS = @LDFLAGS@
++LEX = @LEX@
++LEXLIB = @LEXLIB@
++LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
++LIBDBI_CFLAGS = @LIBDBI_CFLAGS@
++LIBDBI_LIBS = @LIBDBI_LIBS@
++LIBEE_CFLAGS = @LIBEE_CFLAGS@
++LIBEE_LIBS = @LIBEE_LIBS@
++LIBESTR_CFLAGS = @LIBESTR_CFLAGS@
++LIBESTR_LIBS = @LIBESTR_LIBS@
++LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
++LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
++LIBLOGGING_CFLAGS = @LIBLOGGING_CFLAGS@
++LIBLOGGING_LIBS = @LIBLOGGING_LIBS@
++LIBLOGNORM_CFLAGS = @LIBLOGNORM_CFLAGS@
++LIBLOGNORM_LIBS = @LIBLOGNORM_LIBS@
++LIBM = @LIBM@
++LIBMONGO_CLIENT_CFLAGS = @LIBMONGO_CLIENT_CFLAGS@
++LIBMONGO_CLIENT_LIBS = @LIBMONGO_CLIENT_LIBS@
++LIBOBJS = @LIBOBJS@
++LIBS = @LIBS@
++LIBSYSTEMD_JOURNAL_CFLAGS = @LIBSYSTEMD_JOURNAL_CFLAGS@
++LIBSYSTEMD_JOURNAL_LIBS = @LIBSYSTEMD_JOURNAL_LIBS@
++LIBTOOL = @LIBTOOL@
++LIBUUID_CFLAGS = @LIBUUID_CFLAGS@
++LIBUUID_LIBS = @LIBUUID_LIBS@
++LIPO = @LIPO@
++LN_S = @LN_S@
++LTLIBOBJS = @LTLIBOBJS@
++MAKEINFO = @MAKEINFO@
++MANIFEST_TOOL = @MANIFEST_TOOL@
++MKDIR_P = @MKDIR_P@
++MYSQL_CFLAGS = @MYSQL_CFLAGS@
++MYSQL_LIBS = @MYSQL_LIBS@
++NM = @NM@
++NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
++OBJEXT = @OBJEXT@
++ORACLE_CFLAGS = @ORACLE_CFLAGS@
++ORACLE_LIBS = @ORACLE_LIBS@
++OTOOL = @OTOOL@
++OTOOL64 = @OTOOL64@
++PACKAGE = @PACKAGE@
++PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
++PACKAGE_NAME = @PACKAGE_NAME@
++PACKAGE_STRING = @PACKAGE_STRING@
++PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
++PACKAGE_VERSION = @PACKAGE_VERSION@
++PATH_SEPARATOR = @PATH_SEPARATOR@
++PGSQL_CFLAGS = @PGSQL_CFLAGS@
++PGSQL_LIBS = @PGSQL_LIBS@
++PKG_CONFIG = @PKG_CONFIG@
++PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
++PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
++PTHREADS_CFLAGS = @PTHREADS_CFLAGS@
++PTHREADS_LIBS = @PTHREADS_LIBS@
++RABBITMQ_CFLAGS = @RABBITMQ_CFLAGS@
++RABBITMQ_LIBS = @RABBITMQ_LIBS@
++RANLIB = @RANLIB@
++RELP_CFLAGS = @RELP_CFLAGS@
++RELP_LIBS = @RELP_LIBS@
++RSRT_CFLAGS = @RSRT_CFLAGS@
++RSRT_CFLAGS1 = @RSRT_CFLAGS1@
++RSRT_LIBS = @RSRT_LIBS@
++RSRT_LIBS1 = @RSRT_LIBS1@
++RST2MAN = @RST2MAN@
++RT_LIBS = @RT_LIBS@
++SED = @SED@
++SET_MAKE = @SET_MAKE@
++SHELL = @SHELL@
++SNMP_CFLAGS = @SNMP_CFLAGS@
++SNMP_LIBS = @SNMP_LIBS@
++SOL_LIBS = @SOL_LIBS@
++STRIP = @STRIP@
++UDPSPOOF_CFLAGS = @UDPSPOOF_CFLAGS@
++UDPSPOOF_LIBS = @UDPSPOOF_LIBS@
++VERSION = @VERSION@
++YACC = @YACC@
++YFLAGS = @YFLAGS@
++ZLIB_LIBS = @ZLIB_LIBS@
++abs_builddir = @abs_builddir@
++abs_srcdir = @abs_srcdir@
++abs_top_builddir = @abs_top_builddir@
++abs_top_srcdir = @abs_top_srcdir@
++ac_ct_AR = @ac_ct_AR@
++ac_ct_CC = @ac_ct_CC@
++ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
++am__include = @am__include@
++am__leading_dot = @am__leading_dot@
++am__quote = @am__quote@
++am__tar = @am__tar@
++am__untar = @am__untar@
++bindir = @bindir@
++build = @build@
++build_alias = @build_alias@
++build_cpu = @build_cpu@
++build_os = @build_os@
++build_vendor = @build_vendor@
++builddir = @builddir@
++datadir = @datadir@
++datarootdir = @datarootdir@
++docdir = @docdir@
++dvidir = @dvidir@
++exec_prefix = @exec_prefix@
++have_valgrind = @have_valgrind@
++host = @host@
++host_alias = @host_alias@
++host_cpu = @host_cpu@
++host_os = @host_os@
++host_vendor = @host_vendor@
++htmldir = @htmldir@
++includedir = @includedir@
++infodir = @infodir@
++install_sh = @install_sh@
++libdir = @libdir@
++libexecdir = @libexecdir@
++localedir = @localedir@
++localstatedir = @localstatedir@
++mandir = @mandir@
++mkdir_p = @mkdir_p@
++moddirs = @moddirs@
++oldincludedir = @oldincludedir@
++pdfdir = @pdfdir@
++prefix = @prefix@
++program_transform_name = @program_transform_name@
++psdir = @psdir@
++sbindir = @sbindir@
++sharedstatedir = @sharedstatedir@
++srcdir = @srcdir@
++sysconfdir = @sysconfdir@
++systemdsystemunitdir = @systemdsystemunitdir@
++target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
++top_builddir = @top_builddir@
++top_srcdir = @top_srcdir@
++pkglib_LTLIBRARIES = mmutf8fix.la
++mmutf8fix_la_SOURCES = mmutf8fix.c
++mmutf8fix_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS)
++mmutf8fix_la_LDFLAGS = -module -avoid-version
++mmutf8fix_la_LIBADD =
++EXTRA_DIST =
++all: all-am
++
++.SUFFIXES:
++.SUFFIXES: .c .lo .o .obj
++$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
++ @for dep in $?; do \
++ case '$(am__configure_deps)' in \
++ *$$dep*) \
++ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++ && { if test -f $@; then exit 0; else break; fi; }; \
++ exit 1;; \
++ esac; \
++ done; \
++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/mmutf8fix/Makefile'; \
++ $(am__cd) $(top_srcdir) && \
++ $(AUTOMAKE) --gnu plugins/mmutf8fix/Makefile
++.PRECIOUS: Makefile
++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
++ @case '$?' in \
++ *config.status*) \
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
++ *) \
++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
++ esac;
++
++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++
++$(top_srcdir)/configure: $(am__configure_deps)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(ACLOCAL_M4): $(am__aclocal_m4_deps)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(am__aclocal_m4_deps):
++
++install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
++ @$(NORMAL_INSTALL)
++ @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
++ list2=; for p in $$list; do \
++ if test -f $$p; then \
++ list2="$$list2 $$p"; \
++ else :; fi; \
++ done; \
++ test -z "$$list2" || { \
++ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \
++ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \
++ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
++ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
++ }
++
++uninstall-pkglibLTLIBRARIES:
++ @$(NORMAL_UNINSTALL)
++ @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
++ for p in $$list; do \
++ $(am__strip_dir) \
++ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
++ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
++ done
++
++clean-pkglibLTLIBRARIES:
++ -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
++ @list='$(pkglib_LTLIBRARIES)'; \
++ locs=`for p in $$list; do echo $$p; done | \
++ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
++ sort -u`; \
++ test -z "$$locs" || { \
++ echo rm -f $${locs}; \
++ rm -f $${locs}; \
++ }
++
++mmutf8fix.la: $(mmutf8fix_la_OBJECTS) $(mmutf8fix_la_DEPENDENCIES) $(EXTRA_mmutf8fix_la_DEPENDENCIES)
++ $(AM_V_CCLD)$(mmutf8fix_la_LINK) -rpath $(pkglibdir) $(mmutf8fix_la_OBJECTS) $(mmutf8fix_la_LIBADD) $(LIBS)
++
++mostlyclean-compile:
++ -rm -f *.$(OBJEXT)
++
++distclean-compile:
++ -rm -f *.tab.c
++
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmutf8fix_la-mmutf8fix.Plo@am__quote@
++
++.c.o:
++@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
++@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
++
++.c.obj:
++@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
++@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
++
++.c.lo:
++@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
++@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
++
++mmutf8fix_la-mmutf8fix.lo: mmutf8fix.c
++@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mmutf8fix_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmutf8fix_la-mmutf8fix.lo -MD -MP -MF $(DEPDIR)/mmutf8fix_la-mmutf8fix.Tpo -c -o mmutf8fix_la-mmutf8fix.lo `test -f 'mmutf8fix.c' || echo '$(srcdir)/'`mmutf8fix.c
++@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mmutf8fix_la-mmutf8fix.Tpo $(DEPDIR)/mmutf8fix_la-mmutf8fix.Plo
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mmutf8fix.c' object='mmutf8fix_la-mmutf8fix.lo' libtool=yes @AMDEPBACKSLASH@
++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
++@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mmutf8fix_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmutf8fix_la-mmutf8fix.lo `test -f 'mmutf8fix.c' || echo '$(srcdir)/'`mmutf8fix.c
++
++mostlyclean-libtool:
++ -rm -f *.lo
++
++clean-libtool:
++ -rm -rf .libs _libs
++
++ID: $(am__tagged_files)
++ $(am__define_uniq_tagged_files); mkid -fID $$unique
++tags: tags-am
++TAGS: tags
++
++tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
++ set x; \
++ here=`pwd`; \
++ $(am__define_uniq_tagged_files); \
++ shift; \
++ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
++ test -n "$$unique" || unique=$$empty_fix; \
++ if test $$# -gt 0; then \
++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
++ "$$@" $$unique; \
++ else \
++ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
++ $$unique; \
++ fi; \
++ fi
++ctags: ctags-am
++
++CTAGS: ctags
++ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
++ $(am__define_uniq_tagged_files); \
++ test -z "$(CTAGS_ARGS)$$unique" \
++ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
++ $$unique
++
++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)
++ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++ list='$(DISTFILES)'; \
++ dist_files=`for file in $$list; do echo $$file; done | \
++ sed -e "s|^$$srcdirstrip/||;t" \
++ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
++ case $$dist_files in \
++ */*) $(MKDIR_P) `echo "$$dist_files" | \
++ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
++ sort -u` ;; \
++ esac; \
++ for file in $$dist_files; do \
++ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
++ if test -d $$d/$$file; then \
++ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
++ if test -d "$(distdir)/$$file"; then \
++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
++ fi; \
++ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
++ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
++ fi; \
++ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
++ else \
++ test -f "$(distdir)/$$file" \
++ || cp -p $$d/$$file "$(distdir)/$$file" \
++ || exit 1; \
++ fi; \
++ done
++check-am: all-am
++check: check-am
++all-am: Makefile $(LTLIBRARIES)
++installdirs:
++ for dir in "$(DESTDIR)$(pkglibdir)"; do \
++ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
++ done
++install: install-am
++install-exec: install-exec-am
++install-data: install-data-am
++uninstall: uninstall-am
++
++install-am: all-am
++ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
++
++installcheck: installcheck-am
++install-strip:
++ if test -z '$(STRIP)'; then \
++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
++ install; \
++ else \
++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
++ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
++ fi
++mostlyclean-generic:
++
++clean-generic:
++
++distclean-generic:
++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
++ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
++
++maintainer-clean-generic:
++ @echo "This command is intended for maintainers to use"
++ @echo "it deletes files that may require special tools to rebuild."
++clean: clean-am
++
++clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
++ mostlyclean-am
++
++distclean: distclean-am
++ -rm -rf ./$(DEPDIR)
++ -rm -f Makefile
++distclean-am: clean-am distclean-compile distclean-generic \
++ distclean-tags
++
++dvi: dvi-am
++
++dvi-am:
++
++html: html-am
++
++html-am:
++
++info: info-am
++
++info-am:
++
++install-data-am:
++
++install-dvi: install-dvi-am
++
++install-dvi-am:
++
++install-exec-am: install-pkglibLTLIBRARIES
++
++install-html: install-html-am
++
++install-html-am:
++
++install-info: install-info-am
++
++install-info-am:
++
++install-man:
++
++install-pdf: install-pdf-am
++
++install-pdf-am:
++
++install-ps: install-ps-am
++
++install-ps-am:
++
++installcheck-am:
++
++maintainer-clean: maintainer-clean-am
++ -rm -rf ./$(DEPDIR)
++ -rm -f Makefile
++maintainer-clean-am: distclean-am maintainer-clean-generic
++
++mostlyclean: mostlyclean-am
++
++mostlyclean-am: mostlyclean-compile mostlyclean-generic \
++ mostlyclean-libtool
++
++pdf: pdf-am
++
++pdf-am:
++
++ps: ps-am
++
++ps-am:
++
++uninstall-am: uninstall-pkglibLTLIBRARIES
++
++.MAKE: install-am install-strip
++
++.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
++ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \
++ ctags-am distclean distclean-compile distclean-generic \
++ distclean-libtool distclean-tags distdir dvi dvi-am html \
++ html-am info info-am install install-am install-data \
++ install-data-am install-dvi install-dvi-am install-exec \
++ install-exec-am install-html install-html-am install-info \
++ install-info-am install-man install-pdf install-pdf-am \
++ install-pkglibLTLIBRARIES install-ps install-ps-am \
++ install-strip installcheck 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-pkglibLTLIBRARIES
++
++
++# Tell versions [3.59,3.63) of GNU make to not export all variables.
++# Otherwise a system limit (for SysV at least) may be exceeded.
++.NOEXPORT:
+diff --git a/plugins/mmutf8fix/mmutf8fix.c b/plugins/mmutf8fix/mmutf8fix.c
+new file mode 100644
+index 0000000..8e647f2
+--- /dev/null
++++ b/plugins/mmutf8fix/mmutf8fix.c
+@@ -0,0 +1,328 @@
++/* mmutf8fix.c
++ * fix invalid UTF8 sequences. This is begun as a very simple replacer
++ * of non-control characters, and actually breaks some UTF-8 encoding
++ * right now. If the module turns out to be useful, it should be enhanced
++ * to support modes that really detect invalid UTF8. In the longer term
++ * it could also be evolved into an any-charset-to-UTF8 converter. But
++ * first let's see if it really gets into widespread enough use.
++ *
++ * Copyright 2013 Adiscon GmbH.
++ *
++ * This file is part of rsyslog.
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ * -or-
++ * see COPYING.ASL20 in the source distribution
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++#include "config.h"
++#include "rsyslog.h"
++#include
++#include
++#include
++#include
++#include
++#include
++#include
++#include
++#include
++#include "conf.h"
++#include "syslogd-types.h"
++#include "srUtils.h"
++#include "template.h"
++#include "module-template.h"
++#include "errmsg.h"
++
++MODULE_TYPE_OUTPUT
++MODULE_TYPE_NOKEEP
++MODULE_CNFNAME("mmutf8fix")
++
++
++DEFobjCurrIf(errmsg);
++DEF_OMOD_STATIC_DATA
++
++/* define operation modes we have */
++#define MODE_CC 0 /* just fix control characters */
++#define MODE_UTF8 1 /* do real UTF-8 fixing */
++
++/* config variables */
++typedef struct _instanceData {
++ uchar replChar;
++ uint8_t mode; /* operations mode */
++} instanceData;
++
++struct modConfData_s {
++ rsconf_t *pConf; /* our overall config object */
++};
++static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */
++static modConfData_t *runModConf = NULL;/* modConf ptr to use for the current exec process */
++
++
++/* tables for interfacing with the v6 config system */
++/* action (instance) parameters */
++static struct cnfparamdescr actpdescr[] = {
++ { "mode", eCmdHdlrGetWord, 0 },
++ { "replacementchar", eCmdHdlrGetChar, 0 }
++};
++static struct cnfparamblk actpblk =
++ { CNFPARAMBLK_VERSION,
++ sizeof(actpdescr)/sizeof(struct cnfparamdescr),
++ actpdescr
++ };
++
++BEGINbeginCnfLoad
++CODESTARTbeginCnfLoad
++ loadModConf = pModConf;
++ pModConf->pConf = pConf;
++ENDbeginCnfLoad
++
++BEGINendCnfLoad
++CODESTARTendCnfLoad
++ENDendCnfLoad
++
++BEGINcheckCnf
++CODESTARTcheckCnf
++ENDcheckCnf
++
++BEGINactivateCnf
++CODESTARTactivateCnf
++ runModConf = pModConf;
++ENDactivateCnf
++
++BEGINfreeCnf
++CODESTARTfreeCnf
++ENDfreeCnf
++
++
++BEGINcreateInstance
++CODESTARTcreateInstance
++ENDcreateInstance
++
++
++BEGINisCompatibleWithFeature
++CODESTARTisCompatibleWithFeature
++ENDisCompatibleWithFeature
++
++
++BEGINfreeInstance
++CODESTARTfreeInstance
++ENDfreeInstance
++
++
++static inline void
++setInstParamDefaults(instanceData *pData)
++{
++ pData->mode = MODE_UTF8;
++ pData->replChar = ' ';
++}
++
++BEGINnewActInst
++ struct cnfparamvals *pvals;
++ int i;
++CODESTARTnewActInst
++ DBGPRINTF("newActInst (mmutf8fix)\n");
++ if((pvals = nvlstGetParams(lst, &actpblk, NULL)) == NULL) {
++ ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
++ }
++
++ CODE_STD_STRING_REQUESTnewActInst(1)
++ CHKiRet(OMSRsetEntry(*ppOMSR, 0, NULL, OMSR_TPL_AS_MSG));
++ CHKiRet(createInstance(&pData));
++ setInstParamDefaults(pData);
++
++ for(i = 0 ; i < actpblk.nParams ; ++i) {
++ if(!pvals[i].bUsed)
++ continue;
++ if(!strcmp(actpblk.descr[i].name, "mode")) {
++ if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"utf-8",
++ sizeof("utf-8")-1)) {
++ pData->mode = MODE_UTF8;
++ } else if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"controlcharacters",
++ sizeof("controlcharacters")-1)) {
++ pData->mode = MODE_CC;
++ } else {
++ char *cstr = es_str2cstr(pvals[i].val.d.estr, NULL);
++ errmsg.LogError(0, RS_RET_INVLD_MODE,
++ "mmutf8fix: invalid mode '%s' - ignored",
++ cstr);
++ free(cstr);
++ }
++ } else if(!strcmp(actpblk.descr[i].name, "replacementchar")) {
++ pData->replChar = es_getBufAddr(pvals[i].val.d.estr)[0];
++ } else {
++ dbgprintf("mmutf8fix: program error, non-handled "
++ "param '%s'\n", actpblk.descr[i].name);
++ }
++ }
++
++CODE_STD_FINALIZERnewActInst
++ cnfparamvalsDestruct(pvals, &actpblk);
++ENDnewActInst
++
++
++BEGINdbgPrintInstInfo
++CODESTARTdbgPrintInstInfo
++ENDdbgPrintInstInfo
++
++
++BEGINtryResume
++CODESTARTtryResume
++ENDtryResume
++
++
++static inline void
++doCC(instanceData *pData, uchar *msg, int lenMsg)
++{
++ int i;
++
++ for(i = 0 ; i < lenMsg ; ++i) {
++ if(msg[i] < 32 || msg[i] > 126) {
++ msg[i] = pData->replChar;
++ }
++ }
++}
++
++/* fix an invalid multibyte sequence */
++static inline void
++fixInvldMBSeq(instanceData *pData, uchar *msg, int lenMsg, int strtIdx, int *endIdx, int8_t seqLen)
++{
++ int i;
++
++ /* startIdx and seqLen always set if bytesLeft is set,
++ which is required before this function is called */
++ *endIdx = strtIdx + seqLen;
++ if(*endIdx > lenMsg)
++ *endIdx = lenMsg;
++ for(i = strtIdx ; i < *endIdx ; ++i)
++ msg[i] = pData->replChar;
++}
++
++static inline void
++doUTF8(instanceData *pData, uchar *msg, int lenMsg)
++{
++ uchar c;
++ int8_t seqLen = 0, bytesLeft = 0;
++ uint32_t codepoint;
++ int strtIdx = 0, endIdx = 0;
++ int i;
++
++ for(i = 0 ; i < lenMsg ; ++i) {
++ c = msg[i];
++ if(bytesLeft) {
++ if((c & 0xc0) != 0x80) {
++ /* sequence invalid, invalidate all bytes
++ startIdx is always set if bytesLeft is set */
++ fixInvldMBSeq(pData, msg, lenMsg, strtIdx, &endIdx,
++ seqLen);
++ i = endIdx - 1;
++ bytesLeft = 0;
++ } else {
++ codepoint = (codepoint << 6) | (c & 0x3f);
++ --bytesLeft;
++ if(bytesLeft == 0) {
++ /* too-large codepoint? */
++ if(codepoint > 0x10FFFF) {
++ /* sequence invalid, invalidate all bytes
++ startIdx is always set if bytesLeft is set */
++ fixInvldMBSeq(pData, msg, lenMsg,
++ strtIdx, &endIdx,
++ seqLen);
++ }
++ }
++ }
++ } else {
++ if((c & 0x80) == 0) {
++ /* 1-byte sequence, US-ASCII */
++ ; /* nothing to do, all well */
++ } else if((c & 0xe0) == 0xc0) {
++ /* 2-byte sequence */
++ /* 0xc0 and 0xc1 are illegal */
++ if(c == 0xc0 || c == 0xc1) {
++ msg[i] = pData->replChar;
++ } else {
++ strtIdx = i;
++ seqLen = bytesLeft = 1;
++ codepoint = c & 0x1f;
++ }
++ } else if((c & 0xf0) == 0xe0) {
++ /* 3-byte sequence */
++ strtIdx = i;
++ seqLen = bytesLeft = 2;
++ codepoint = c & 0x0f;
++ } else if((c & 0xf8) == 0xf0) {
++ /* 4-byte sequence */
++ strtIdx = i;
++ seqLen = bytesLeft = 3;
++ codepoint = c & 0x07;
++ } else { /* invalid (5&6 byte forbidden by RFC3629) */
++ msg[i] = pData->replChar;
++ }
++ if(i+bytesLeft >= lenMsg) {
++ int dummy = lenMsg;
++ /* invalid, as rest of message cannot contain full char */
++ fixInvldMBSeq(pData, msg, lenMsg, strtIdx, &dummy, seqLen);
++ i = lenMsg - 1;
++ }
++ }
++ }
++}
++
++BEGINdoAction
++ msg_t *pMsg;
++ uchar *msg;
++ int lenMsg;
++CODESTARTdoAction
++ pMsg = (msg_t*) ppString[0];
++ lenMsg = getMSGLen(pMsg);
++ msg = getMSG(pMsg);
++ if(pData->mode == MODE_CC) {
++ doCC(pData, msg, lenMsg);
++ } else {
++ doUTF8(pData, msg, lenMsg);
++ }
++ENDdoAction
++
++
++BEGINparseSelectorAct
++CODESTARTparseSelectorAct
++CODE_STD_STRING_REQUESTparseSelectorAct(1)
++ if(strncmp((char*) p, ":mmutf8fix:", sizeof(":mmutf8fix:") - 1)) {
++ errmsg.LogError(0, RS_RET_LEGA_ACT_NOT_SUPPORTED,
++ "mmutf8fix supports only v6+ config format, use: "
++ "action(type=\"mmutf8fix\" ...)");
++ }
++ ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED);
++CODE_STD_FINALIZERparseSelectorAct
++ENDparseSelectorAct
++
++
++BEGINmodExit
++CODESTARTmodExit
++ objRelease(errmsg, CORE_COMPONENT);
++ENDmodExit
++
++
++BEGINqueryEtryPt
++CODESTARTqueryEtryPt
++CODEqueryEtryPt_STD_OMOD_QUERIES
++CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES
++CODEqueryEtryPt_STD_CONF2_QUERIES
++ENDqueryEtryPt
++
++
++BEGINmodInit()
++CODESTARTmodInit
++ *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
++CODEmodInit_QueryRegCFSLineHdlr
++ DBGPRINTF("mmutf8fix: module compiled with rsyslog version %s.\n", VERSION);
++ CHKiRet(objUse(errmsg, CORE_COMPONENT));
++ENDmodInit
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1214257-maxMessageSize.patch b/SOURCES/rsyslog-7.4.7-rhbz1214257-maxMessageSize.patch
new file mode 100644
index 0000000..88fa1c6
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1214257-maxMessageSize.patch
@@ -0,0 +1,166 @@
+From bbd8c8c7176148702a737b8df62132cd1e078627 Mon Sep 17 00:00:00 2001
+From: Rainer Gerhards
+Date: Tue, 13 Jan 2015 09:54:41 +0100
+Subject: [PATCH] bugfixes for maxMessageSize global parameter
+
+closely related, thus done in a single commit:
+
+- bugfix: invalid data size for iMaxLine global property
+ It was defined as int, but inside the config system it was declared as
+ size type, which uses int64_t. With legacy config statements, this could
+ lead to misadressing, which usually meant the another config variable was
+ overwritten (depending on memory layout).
+ closes https://github.com/rsyslog/rsyslog/issues/205
+
+- bugfix: negative values for maxMessageSize global parameter were permitted
+---
+ runtime/glbl.c | 43 ++++++++++++++++++++++++++++++++++++-------
+ runtime/glbl.h | 7 ++++---
+ 2 files changed, 40 insertions(+), 10 deletions(-)
+
+diff --git a/runtime/glbl.c b/runtime/glbl.c
+index c57cedf..bfe0b0e 100644
+--- a/runtime/glbl.c
++++ b/runtime/glbl.c
+@@ -7,7 +7,7 @@
+ *
+ * Module begun 2008-04-16 by Rainer Gerhards
+ *
+- * Copyright 2008-2013 Rainer Gerhards and Adiscon GmbH.
++ * Copyright 2008-2015 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of the rsyslog runtime library.
+ *
+@@ -116,6 +116,12 @@ static struct cnfparamvals *cnfparamvals = NULL;
+ * each time a new config load begins (TODO: create interface?)
+ */
+
++static int
++GetMaxLine(void)
++{
++ return(iMaxLine);
++}
++
+ /* define a macro for the simple properties' set and get functions
+ * (which are always the same). This is only suitable for pretty
+ * simple cases which require neither checks nor memory allocation.
+@@ -138,7 +144,6 @@ static dataType Get##nameFunc(void) \
+ SIMP_PROP(ParseHOSTNAMEandTAG, bParseHOSTNAMEandTAG, int)
+ SIMP_PROP(OptimizeUniProc, bOptimizeUniProc, int)
+ SIMP_PROP(PreserveFQDN, bPreserveFQDN, int)
+-SIMP_PROP(MaxLine, iMaxLine, int)
+ SIMP_PROP(DefPFFamily, iDefPFFamily, int) /* note that in the future we may check the family argument */
+ SIMP_PROP(DropMalPTRMsgs, bDropMalPTRMsgs, int)
+ SIMP_PROP(Option_DisallowWarning, option_DisallowWarning, int)
+@@ -282,6 +287,32 @@ finalize_it:
+ }
+
+
++/* This function is used both by legacy and RainerScript conf. It is a real setter. */
++static rsRetVal
++setMaxLine(const int64_t iNew)
++{
++ if(iNew < 128) {
++ errmsg.LogError(0, RS_RET_INVALID_VALUE, "maxMessageSize tried to set "
++ "to %lld, but cannot be less than 128 - set to 128 "
++ "instead", (long long) iNew);
++ iMaxLine = 128;
++ } else if(iNew > (int64_t) INT_MAX) {
++ errmsg.LogError(0, RS_RET_INVALID_VALUE, "maxMessageSize larger than "
++ "INT_MAX (%d) - reduced to INT_MAX", INT_MAX);
++ iMaxLine = INT_MAX;
++ } else {
++ iMaxLine = (int) iNew;
++ }
++}
++
++static rsRetVal
++legacySetMaxMessageSize(void __attribute__((unused)) *pVal, int64_t iNew)
++{
++ DEFiRet;
++ iRet = setMaxLine(iNew);
++ RETiRet;
++}
++
+ static rsRetVal
+ setDebugFile(void __attribute__((unused)) *pVal, uchar *pNewVal)
+ {
+@@ -534,10 +565,10 @@ CODESTARTobjQueryInterface(glbl)
+ pIf->GetLocalHostIP = GetLocalHostIP;
+ pIf->SetGlobalInputTermination = SetGlobalInputTermination;
+ pIf->GetGlobalInputTermState = GetGlobalInputTermState;
++ pIf->GetMaxLine = GetMaxLine;
+ #define SIMP_PROP(name) \
+ pIf->Get##name = Get##name; \
+ pIf->Set##name = Set##name;
+- SIMP_PROP(MaxLine);
+ SIMP_PROP(OptimizeUniProc);
+ SIMP_PROP(ParseHOSTNAMEandTAG);
+ SIMP_PROP(PreserveFQDN);
+@@ -561,7 +592,6 @@ CODESTARTobjQueryInterface(glbl)
+ finalize_it:
+ ENDobjQueryInterface(glbl)
+
+-
+ /* Reset config variables to default values.
+ * rgerhards, 2008-04-17
+ */
+@@ -649,7 +679,7 @@ glblDoneLoadCnf(void)
+ "dropmsgswithmaliciousdnsptrrecords")) {
+ bDropMalPTRMsgs = (int) cnfparamvals[i].val.d.n;
+ } else if(!strcmp(paramblk.descr[i].name, "maxmessagesize")) {
+- iMaxLine = (int) cnfparamvals[i].val.d.n;
++ setMaxLine(cnfparamvals[i].val.d.n);
+ } else {
+ dbgprintf("glblDoneLoadCnf: program error, non-handled "
+ "param '%s'\n", paramblk.descr[i].name);
+@@ -681,8 +711,7 @@ BEGINAbstractObjClassInit(glbl, 1, OBJ_IS_CORE_MODULE) /* class, version */
+ CHKiRet(regCfSysLineHdlr((uchar *)"localhostipif", 0, eCmdHdlrGetWord, setLocalHostIPIF, NULL, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"optimizeforuniprocessor", 0, eCmdHdlrBinary, NULL, &bOptimizeUniProc, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"preservefqdn", 0, eCmdHdlrBinary, NULL, &bPreserveFQDN, NULL));
+- CHKiRet(regCfSysLineHdlr((uchar *)"maxmessagesize", 0, eCmdHdlrSize,
+- NULL, &iMaxLine, NULL));
++ CHKiRet(regCfSysLineHdlr((uchar *)"maxmessagesize", 0, eCmdHdlrSize, legacySetMaxMessageSize, NULL, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, NULL));
+
+ INIT_ATOMIC_HELPER_MUT(mutTerminateInputs);
+diff --git a/runtime/glbl.h b/runtime/glbl.h
+index 44171f2..b89e202 100644
+--- a/runtime/glbl.h
++++ b/runtime/glbl.h
+@@ -8,7 +8,7 @@
+ * Please note that there currently is no glbl.c file as we do not yet
+ * have any implementations.
+ *
+- * Copyright 2008-2012 Rainer Gerhards and Adiscon GmbH.
++ * Copyright 2008-2015 Rainer Gerhards and Adiscon GmbH.
+ *
+ * This file is part of the rsyslog runtime library.
+ *
+@@ -41,10 +41,10 @@ extern pid_t glbl_ourpid;
+ /* interfaces */
+ BEGINinterface(glbl) /* name must also be changed in ENDinterface macro! */
+ uchar* (*GetWorkDir)(void);
++ int (*GetMaxLine)(void);
+ #define SIMP_PROP(name, dataType) \
+ dataType (*Get##name)(void); \
+ rsRetVal (*Set##name)(dataType);
+- SIMP_PROP(MaxLine, int)
+ SIMP_PROP(OptimizeUniProc, int)
+ SIMP_PROP(PreserveFQDN, int)
+ SIMP_PROP(DefPFFamily, int)
+@@ -81,9 +81,10 @@ BEGINinterface(glbl) /* name must also be changed in ENDinterface macro! */
+ /* next change is v9! */
+ /* v8 - 2012-03-21 */
+ prop_t* (*GetLocalHostIP)(void);
++ /* v9 - 2015-01-12 SetMaxLine method removed */
+ #undef SIMP_PROP
+ ENDinterface(glbl)
+-#define glblCURR_IF_VERSION 7 /* increment whenever you change the interface structure! */
++#define glblCURR_IF_VERSION 9 /* increment whenever you change the interface structure! */
+ /* version 2 had PreserveFQDN added - rgerhards, 2008-12-08 */
+
+ /* the remaining prototypes */
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1216957-imjournal-ste-file.patch b/SOURCES/rsyslog-7.4.7-rhbz1216957-imjournal-ste-file.patch
new file mode 100644
index 0000000..6c28db5
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1216957-imjournal-ste-file.patch
@@ -0,0 +1,92 @@
+From 882f404873ab8410455b17c3e7940e5c645bd143 Mon Sep 17 00:00:00 2001
+From: Max Prokhorov
+Date: Sun, 22 Nov 2015 23:15:27 +0300
+Subject: [PATCH] Fix imjournal state file issues
+
+Derived from upstream:
+
+* commit 64af99a:
+ imjournal: Initialize counter outside of while loop
+
+* commit 8a10940:
+ bugfix: afterRun entry point not correctly called
+
+ The entry point was called at the wrong spot, only when the thread
+ had not already terminated by itself. This could cause various
+ cleanup to not be done.
+
+ closes https://github.com/rsyslog/rsyslog/issues/882
+
+* fix a segfault in imuxsock triggered by 8a10940
+---
+ plugins/imjournal/imjournal.c | 3 ++-
+ plugins/imuxsock/imuxsock.c | 4 ++++
+ threads.c | 9 +++++----
+ 3 files changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
+index 36c7e04..65017c6 100755
+--- a/plugins/imjournal/imjournal.c
++++ b/plugins/imjournal/imjournal.c
+@@ -588,6 +588,7 @@ finalize_it:
+ }
+
+ BEGINrunInput
++ int count = 0;
+ CODESTARTrunInput
+ CHKiRet(ratelimitNew(&ratelimiter, "imjournal", NULL));
+ dbgprintf("imjournal: ratelimiting burst %d, interval %d\n", cs.ratelimitBurst,
+@@ -603,7 +604,7 @@ CODESTARTrunInput
+ * signalled to do so. This, however, is handled by the framework.
+ */
+ while (glbl.GetGlobalInputTermState() == 0) {
+- int count = 0, r;
++ int r;
+
+ r = sd_journal_next(j);
+ if (r < 0) {
+diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
+index df504dd..f50b912 100644
+--- a/plugins/imuxsock/imuxsock.c
++++ b/plugins/imuxsock/imuxsock.c
+@@ -1419,6 +1419,10 @@ BEGINafterRun
+ int i;
+ CODESTARTafterRun
+ /* do cleanup here */
++ if(startIndexUxLocalSockets == 1 && nfd == 1) {
++ /* No sockets were configured, no cleanup needed. */
++ return RS_RET_OK;
++ }
+ /* Close the UNIX sockets. */
+ for (i = 0; i < nfd; i++)
+ if (listeners[i].fd != -1)
+diff --git a/threads.c b/threads.c
+index 990733a..a38b18f 100644
+--- a/threads.c
++++ b/threads.c
+@@ -79,6 +79,11 @@ static rsRetVal thrdDestruct(thrdInfo_t *pThis)
+ if(pThis->bIsActive == 1) {
+ thrdTerminate(pThis);
+ }
++
++ /* call cleanup function, if any */
++ if(pThis->pAfterRun != NULL)
++ pThis->pAfterRun(pThis);
++
+ pthread_mutex_destroy(&pThis->mutThrd);
+ pthread_cond_destroy(&pThis->condThrdTerm);
+ free(pThis->name);
+@@ -148,10 +153,6 @@ rsRetVal thrdTerminate(thrdInfo_t *pThis)
+ }
+ pthread_join(pThis->thrdID, NULL); /* wait for input thread to complete */
+
+- /* call cleanup function, if any */
+- if(pThis->pAfterRun != NULL)
+- pThis->pAfterRun(pThis);
+-
+ RETiRet;
+ }
+
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1222746-json-race.patch b/SOURCES/rsyslog-7.4.7-rhbz1222746-json-race.patch
new file mode 100644
index 0000000..3482839
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1222746-json-race.patch
@@ -0,0 +1,85 @@
+From f15dc13cab2814bdf40e909b8325e436ee1f3940 Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich
+Date: Thu, 14 Jul 2016 03:41:27 +0200
+Subject: [PATCH] Prevent races in calls to json_object_get_string()
+
+---
+ runtime/msg.c | 10 ++++++++++
+ runtime/msg.h | 1 +
+ 2 files changed, 11 insertions(+)
+
+diff --git a/runtime/msg.c b/runtime/msg.c
+index 10ecf48..4c82182 100644
+--- a/runtime/msg.c
++++ b/runtime/msg.c
+@@ -716,6 +716,7 @@ static inline rsRetVal msgBaseConstruct(msg_t **ppThis)
+ pM->rcvFrom.pRcvFrom = NULL;
+ pM->pRuleset = NULL;
+ pM->json = NULL;
++ pthread_mutex_init(&pM->json_mut, NULL);
+ memset(&pM->tRcvdAt, 0, sizeof(pM->tRcvdAt));
+ memset(&pM->tTIMESTAMP, 0, sizeof(pM->tTIMESTAMP));
+ pM->TAG.pszTAG = NULL;
+@@ -861,6 +862,7 @@ CODESTARTobjDestruct(msg)
+ rsCStrDestruct(&pThis->pCSMSGID);
+ if(pThis->json != NULL)
+ json_object_put(pThis->json);
++ pthread_mutex_destroy(&pThis->json_mut);
+ if(pThis->pszUUID != NULL)
+ free(pThis->pszUUID);
+ # ifndef HAVE_ATOMIC_BUILTINS
+@@ -1065,7 +1067,9 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm)
+ psz = getRcvFromIP(pThis);
+ CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRcvFromIP"), PROPTYPE_PSZ, (void*) psz));
+ if(pThis->json != NULL) {
++ pthread_mutex_lock(&pThis->json_mut);
+ psz = (uchar*) json_object_get_string(pThis->json);
++ pthread_mutex_unlock(&pThis->json_mut);
+ CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("json"), PROPTYPE_PSZ, (void*) psz));
+ }
+
+@@ -2546,7 +2550,9 @@ getCEEPropVal(msg_t *pM, es_str_t *propName, uchar **pRes, rs_size_t *buflen, un
+ field = json_object_object_get(parent, (char*)leaf);
+ }
+ if(field != NULL) {
++ pthread_mutex_lock(&pM->json_mut);
+ *pRes = (uchar*) strdup(json_object_get_string(field));
++ pthread_mutex_unlock(&pM->json_mut);
+ *buflen = (int) ustrlen(*pRes);
+ *pbMustBeFreed = 1;
+ }
+@@ -2985,7 +2991,9 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
+ bufLen = 2;
+ *pbMustBeFreed = 0;
+ } else {
++ pthread_mutex_lock(&pMsg->json_mut);
+ pRes = (uchar*)strdup(json_object_get_string(pMsg->json));
++ pthread_mutex_unlock(&pMsg->json_mut);
+ *pbMustBeFreed = 1;
+ }
+ break;
+@@ -3686,7 +3694,9 @@ msgGetCEEVarNew(msg_t *pMsg, char *name)
+ goto done;
+ }
+ json = json_object_object_get(parent, (char*)leaf);
++ pthread_mutex_lock(&pMsg->json_mut);
+ val = (char*)json_object_get_string(json);
++ pthread_mutex_unlock(&pMsg->json_mut);
+ estr = es_newStrFromCStr(val, strlen(val));
+ done:
+ return estr;
+diff --git a/runtime/msg.h b/runtime/msg.h
+index e7babdb..814468d 100644
+--- a/runtime/msg.h
++++ b/runtime/msg.h
+@@ -107,6 +107,7 @@ struct msg {
+ struct syslogTime tRcvdAt;/* time the message entered this program */
+ struct syslogTime tTIMESTAMP;/* (parsed) value of the timestamp */
+ struct json_object *json;
++ pthread_mutex_t json_mut; /* prevent concurent mutability of the json_object in the msg */
+ /* some fixed-size buffers to save malloc()/free() for frequently used fields (from the default templates) */
+ uchar szRawMsg[CONF_RAWMSG_BUFSIZE]; /* most messages are small, and these are stored here (without malloc/free!) */
+ uchar szHOSTNAME[CONF_HOSTNAME_BUFSIZE];
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1223566-imrelp-multi-ruleset.patch b/SOURCES/rsyslog-7.4.7-rhbz1223566-imrelp-multi-ruleset.patch
new file mode 100644
index 0000000..c4ab077
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1223566-imrelp-multi-ruleset.patch
@@ -0,0 +1,299 @@
+From c661a2917d065339e00d7588320a653ba29792ea Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich
+Date: Mon, 27 Jun 2016 20:10:31 +0200
+Subject: [PATCH] Allow multiple rulesets in imrelp
+
+Disable legacy module config directives if new style was used
+---
+ plugins/imrelp/imrelp.c | 140 ++++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 113 insertions(+), 27 deletions(-)
+
+diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c
+index 5e0ae55..203e7cb 100644
+--- a/plugins/imrelp/imrelp.c
++++ b/plugins/imrelp/imrelp.c
+@@ -75,6 +75,8 @@ static struct configSettings_s {
+ struct instanceConf_s {
+ uchar *pszBindPort; /* port to bind to */
+ struct instanceConf_s *next;
++ uchar *pszBindRuleset; /* name of ruleset to bind to */
++ ruleset_t *pBindRuleset; /* ruleset to bind listener to */
+ };
+
+
+@@ -88,9 +90,20 @@ struct modConfData_s {
+ static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */
+ static modConfData_t *runModConf = NULL;/* modConf ptr to use for the current load process */
+
++/* module-global parameters */
++static struct cnfparamdescr modpdescr[] = {
++ { "ruleset", eCmdHdlrGetWord, 0 },
++};
++static struct cnfparamblk modpblk =
++ { CNFPARAMBLK_VERSION,
++ sizeof(modpdescr)/sizeof(struct cnfparamdescr),
++ modpdescr
++ };
++
+ /* input instance parameters */
+ static struct cnfparamdescr inppdescr[] = {
+- { "port", eCmdHdlrString, CNFPARAM_REQUIRED }
++ { "port", eCmdHdlrString, CNFPARAM_REQUIRED },
++ { "ruleset", eCmdHdlrGetWord, 0 }
+ };
+ static struct cnfparamblk inppblk =
+ { CNFPARAMBLK_VERSION,
+@@ -99,6 +112,9 @@ static struct cnfparamblk inppblk =
+ };
+
+
++#include "im-helper.h" /* must be included AFTER the type definitions! */
++static int bLegacyCnfModGlobalsPermitted;/* are legacy module-global config parameters permitted? */
++
+
+ /* ------------------------------ callbacks ------------------------------ */
+
+@@ -113,17 +129,18 @@ static struct cnfparamblk inppblk =
+ * we will only see the hostname (twice). -- rgerhards, 2009-10-14
+ */
+ static relpRetVal
+-onSyslogRcv(uchar *pHostname, uchar *pIP, uchar *msg, size_t lenMsg)
++onSyslogRcv(void *pUsr, uchar *pHostname, uchar *pIP, uchar *msg, size_t lenMsg)
+ {
+ prop_t *pProp = NULL;
+ msg_t *pMsg;
++ instanceConf_t *inst = (instanceConf_t*) pUsr;
+ DEFiRet;
+
+ CHKiRet(msgConstruct(&pMsg));
+ MsgSetInputName(pMsg, pInputName);
+ MsgSetRawMsg(pMsg, (char*)msg, lenMsg);
+ MsgSetFlowControlType(pMsg, eFLOWCTL_LIGHT_DELAY);
+- MsgSetRuleset(pMsg, runModConf->pBindRuleset);
++ MsgSetRuleset(pMsg, inst->pBindRuleset);
+ pMsg->msgFlags = PARSE_HOSTNAME | NEEDS_PARSING;
+
+ /* TODO: optimize this, we can store it inside the session, requires
+@@ -155,6 +172,8 @@ createInstance(instanceConf_t **pinst)
+ inst->next = NULL;
+
+ inst->pszBindPort = NULL;
++ inst->pszBindRuleset = NULL;
++ inst->pBindRuleset = NULL;
+
+ /* node created, let's add to config */
+ if(loadModConf->tail == NULL) {
+@@ -174,8 +193,10 @@ finalize_it:
+ static inline void
+ std_checkRuleset_genErrMsg(modConfData_t *modConf, __attribute__((unused)) instanceConf_t *inst)
+ {
+- errmsg.LogError(0, NO_ERRCODE, "imrelp: ruleset '%s' not found - "
+- "using default ruleset instead", modConf->pszBindRuleset);
++ errmsg.LogError(0, NO_ERRCODE, "imrelp[%s]: ruleset '%s' not found - "
++ "using default ruleset instead",
++ inst->pszBindPort, inst->pszBindRuleset);
++
+ }
+
+
+@@ -196,6 +217,14 @@ static rsRetVal addInstance(void __attribute__((unused)) *pVal, uchar *pNewVal)
+ }
+ inst->pszBindPort = pNewVal;
+
++ if((cs.pszBindRuleset == NULL) || (cs.pszBindRuleset[0] == '\0')) {
++ inst->pszBindRuleset = NULL;
++ } else {
++ CHKmalloc(inst->pszBindRuleset = ustrdup(cs.pszBindRuleset));
++ }
++ inst->pBindRuleset = NULL;
++
++
+ finalize_it:
+ RETiRet;
+ }
+@@ -205,18 +234,33 @@ static rsRetVal
+ addListner(modConfData_t __attribute__((unused)) *modConf, instanceConf_t *inst)
+ {
+ DEFiRet;
++ relpSrv_t *pSrv;
++ int relpRet;
++
+ if(pRelpEngine == NULL) {
+ CHKiRet(relpEngineConstruct(&pRelpEngine));
+ CHKiRet(relpEngineSetDbgprint(pRelpEngine, dbgprintf));
+ CHKiRet(relpEngineSetFamily(pRelpEngine, glbl.GetDefPFFamily()));
+ CHKiRet(relpEngineSetEnableCmd(pRelpEngine, (uchar*) "syslog", eRelpCmdState_Required));
+- CHKiRet(relpEngineSetSyslogRcv(pRelpEngine, onSyslogRcv));
++ CHKiRet(relpEngineSetSyslogRcv2(pRelpEngine, onSyslogRcv));
+ if (!glbl.GetDisableDNS()) {
+ CHKiRet(relpEngineSetDnsLookupMode(pRelpEngine, 1));
+ }
+ }
+
+- CHKiRet(relpEngineAddListner(pRelpEngine, inst->pszBindPort));
++ CHKiRet(relpEngineListnerConstruct(pRelpEngine, &pSrv));
++ CHKiRet(relpSrvSetLstnPort(pSrv, inst->pszBindPort));
++
++ relpSrvSetUsrPtr(pSrv, inst);
++
++ relpRet = relpEngineListnerConstructFinalize(pRelpEngine, pSrv);
++ if(relpRet != RELP_RET_OK) {
++ errmsg.LogError(0, RS_RET_RELP_ERR,
++ "imrelp: could not activate relp listner, code %d", relpRet);
++ ABORT_FINALIZE(RS_RET_RELP_ERR);
++ }
++
++ resetConfigVariables(NULL,NULL);
+
+ finalize_it:
+ RETiRet;
+@@ -249,6 +293,8 @@ CODESTARTnewInpInst
+ continue;
+ if(!strcmp(inppblk.descr[i].name, "port")) {
+ inst->pszBindPort = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
++ } else if(!strcmp(inppblk.descr[i].name, "ruleset")) {
++ inst->pszBindRuleset = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
+ } else {
+ dbgprintf("imrelp: program error, non-handled "
+ "param '%s'\n", inppblk.descr[i].name);
+@@ -264,41 +310,76 @@ BEGINbeginCnfLoad
+ CODESTARTbeginCnfLoad
+ loadModConf = pModConf;
+ pModConf->pConf = pConf;
++ pModConf->pszBindRuleset = NULL;
+ /* init legacy config variables */
+ cs.pszBindRuleset = NULL;
++ bLegacyCnfModGlobalsPermitted = 1;
+ ENDbeginCnfLoad
+
++BEGINsetModCnf
++ struct cnfparamvals *pvals = NULL;
++ int i;
++CODESTARTsetModCnf
++ pvals = nvlstGetParams(lst, &modpblk, NULL);
++ if(pvals == NULL) {
++ errmsg.LogError(0, RS_RET_MISSING_CNFPARAMS, "error processing module "
++ "config parameters [module(...)]");
++ ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
++ }
++
++ if(Debug) {
++ dbgprintf("module (global) param blk for imrelp:\n");
++ cnfparamsPrint(&modpblk, pvals);
++ }
++
++ for(i = 0 ; i < modpblk.nParams ; ++i) {
++ if(!pvals[i].bUsed)
++ continue;
++ if(!strcmp(modpblk.descr[i].name, "ruleset")) {
++ loadModConf->pszBindRuleset = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
++ } else {
++ dbgprintf("imrelp: program error, non-handled "
++ "param '%s' in beginCnfLoad\n", modpblk.descr[i].name);
++ }
++ }
++ /* remove all of our legacy module handlers, as they can not used in addition
++ * the the new-style config method.
++ */
++ bLegacyCnfModGlobalsPermitted = 0;
++finalize_it:
++ if(pvals != NULL)
++ cnfparamvalsDestruct(pvals, &modpblk);
++ENDsetModCnf
+
+ BEGINendCnfLoad
+ CODESTARTendCnfLoad
+- if((cs.pszBindRuleset == NULL) || (cs.pszBindRuleset[0] == '\0')) {
+- loadModConf->pszBindRuleset = NULL;
++ if(loadModConf->pszBindRuleset == NULL) {
++ if((cs.pszBindRuleset == NULL) || (cs.pszBindRuleset[0] == '\0')) {
++ loadModConf->pszBindRuleset = NULL;
++ } else {
++ CHKmalloc(loadModConf->pszBindRuleset = ustrdup(cs.pszBindRuleset));
++ }
+ } else {
+- CHKmalloc(loadModConf->pszBindRuleset = ustrdup(cs.pszBindRuleset));
++ if((cs.pszBindRuleset != NULL) && (cs.pszBindRuleset[0] != '\0')) {
++ errmsg.LogError(0, RS_RET_DUP_PARAM, "imrelp: warning: ruleset "
++ "set via legacy directive ignored");
++ }
+ }
+- loadModConf->pBindRuleset = NULL;
+ finalize_it:
+ free(cs.pszBindRuleset);
++ cs.pszBindRuleset = NULL;
+ loadModConf = NULL; /* done loading */
+ ENDendCnfLoad
+
+
+ BEGINcheckCnf
+- rsRetVal localRet;
+- ruleset_t *pRuleset;
++ instanceConf_t *inst;
+ CODESTARTcheckCnf
+- /* we emulate the standard "ruleset query" code provided by the framework
+- * for *instances* (which we can currently not support due to librelp).
+- */
+- if(pModConf->pszBindRuleset == NULL) {
+- pModConf->pBindRuleset = NULL;
+- } else {
+- localRet = ruleset.GetRuleset(pModConf->pConf, &pRuleset, pModConf->pszBindRuleset);
+- if(localRet == RS_RET_NOT_FOUND) {
+- std_checkRuleset_genErrMsg(pModConf, NULL);
++ for(inst = pModConf->root ; inst != NULL ; inst = inst->next) {
++ if(inst->pszBindRuleset == NULL && pModConf->pszBindRuleset != NULL) {
++ CHKmalloc(inst->pszBindRuleset = ustrdup(pModConf->pszBindRuleset));
+ }
+- CHKiRet(localRet);
+- pModConf->pBindRuleset = pRuleset;
++ std_checkRuleset(pModConf, inst);
+ }
+ finalize_it:
+ ENDcheckCnf
+@@ -311,8 +392,10 @@ CODESTARTactivateCnfPrePrivDrop
+ for(inst = runModConf->root ; inst != NULL ; inst = inst->next) {
+ addListner(pModConf, inst);
+ }
+- if(pRelpEngine == NULL)
++ if(pRelpEngine == NULL) {
++ errmsg.LogError(0, RS_RET_NO_LSTN_DEFINED, "imrelp: no RELP listener defined, module ca n not run.");
+ ABORT_FINALIZE(RS_RET_NO_RUN);
++ }
+ finalize_it:
+ ENDactivateCnfPrePrivDrop
+
+@@ -326,10 +409,12 @@ BEGINfreeCnf
+ CODESTARTfreeCnf
+ for(inst = pModConf->root ; inst != NULL ; ) {
+ free(inst->pszBindPort);
++ free(inst->pszBindRuleset);
+ del = inst;
+ inst = inst->next;
+ free(del);
+ }
++ free(pModConf->pszBindRuleset);
+ ENDfreeCnf
+
+ /* This is used to terminate the plugin. Note that the signal handler blocks
+@@ -420,6 +505,7 @@ CODEqueryEtryPt_STD_IMOD_QUERIES
+ CODEqueryEtryPt_STD_CONF2_QUERIES
+ CODEqueryEtryPt_STD_CONF2_PREPRIVDROP_QUERIES
+ CODEqueryEtryPt_STD_CONF2_IMOD_QUERIES
++CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES
+ CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES
+ ENDqueryEtryPt
+
+@@ -437,8 +523,8 @@ CODEmodInit_QueryRegCFSLineHdlr
+ CHKiRet(objUse(ruleset, CORE_COMPONENT));
+
+ /* register config file handlers */
+- CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputrelpserverbindruleset", 0, eCmdHdlrGetWord,
+- NULL, &cs.pszBindRuleset, STD_LOADABLE_MODULE_ID));
++ CHKiRet(regCfSysLineHdlr2((uchar*)"inputrelpserverbindruleset", 0, eCmdHdlrGetWord,
++ NULL, &cs.pszBindRuleset, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputrelpserverrun", 0, eCmdHdlrGetWord,
+ addInstance, NULL, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1224336-ruleset-crash.patch b/SOURCES/rsyslog-7.4.7-rhbz1224336-ruleset-crash.patch
new file mode 100644
index 0000000..000d51c
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1224336-ruleset-crash.patch
@@ -0,0 +1,61 @@
+From 72e7eac21c492fb8a63f486315936dfbd66f9b05 Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich
+Date: Fri, 3 Apr 2015 16:41:03 +0200
+Subject: [PATCH] Make llDestroy safe
+
+Keep the destructed list in a consistent state as the provided
+destructor may access the very same list again before llDestroy
+finishes.
+
+The previous approach could actually trigger a segmentation violation
+error for specific scenarios and configurations.
+In one particular case, destructing the list of rulesets lead to
+shutdown of an action DA queue and spooling its messages to disk which
+in turn triggered a search for the ruleset name of the message trought
+the destructed list.
+
+The change probably slightly degrades performace, but that shouldn't
+have an observable effect in the current code base.
+---
+ runtime/linkedlist.c | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/runtime/linkedlist.c b/runtime/linkedlist.c
+index 53aace4..df8b19f 100644
+--- a/runtime/linkedlist.c
++++ b/runtime/linkedlist.c
+@@ -90,22 +90,24 @@ rsRetVal llDestroy(linkedList_t *pThis)
+ {
+ DEFiRet;
+ llElt_t *pElt;
+- llElt_t *pEltPrev;
+
+ assert(pThis != NULL);
+
+ pElt = pThis->pRoot;
+ while(pElt != NULL) {
+- pEltPrev = pElt;
+- pElt = pElt->pNext;
++ /* keep the list structure in a consistent state as
++ * the destructor bellow may reference it again
++ */
++ pThis->pRoot = pElt->pNext;
++ if(pElt->pNext == NULL)
++ pThis->pLast = NULL;
++
+ /* we ignore errors during destruction, as we need to try
+ * finish the linked list in any case.
+ */
+- llDestroyElt(pThis, pEltPrev);
++ llDestroyElt(pThis, pElt);
++ pElt = pThis->pRoot;
+ }
+- /* now clean up the pointers */
+- pThis->pRoot = NULL;
+- pThis->pLast = NULL;
+
+ RETiRet;
+ }
+--
+1.9.3
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1245194-imjournal-ste-file.patch b/SOURCES/rsyslog-7.4.7-rhbz1245194-imjournal-ste-file.patch
new file mode 100644
index 0000000..b8271cb
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1245194-imjournal-ste-file.patch
@@ -0,0 +1,203 @@
+From fed69cc7ac1bccb7012a68d954b58c6de9ad75e7 Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich
+Date: Sun, 10 Jul 2016 23:46:42 +0200
+Subject: [PATCH] Make state file handling in imjournal more robust
+
+---
+ plugins/imjournal/imjournal.c | 98 ++++++++++++++++++++++++++++++-------------
+ 1 file changed, 70 insertions(+), 28 deletions(-)
+
+diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c
+index f97b745..1ebbd1c 100755
+--- a/plugins/imjournal/imjournal.c
++++ b/plugins/imjournal/imjournal.c
+@@ -70,6 +70,7 @@ static struct configSettings_s {
+ int ratelimitInterval;
+ int ratelimitBurst;
+ int bIgnorePrevious;
++ int bIgnoreNonValidStatefile;
+ int iDfltSeverity;
+ int iDfltFacility;
+ char *dfltTag;
+@@ -84,6 +85,7 @@ static struct cnfparamdescr modpdescr[] = {
+ { "ratelimit.burst", eCmdHdlrInt, 0 },
+ { "persiststateinterval", eCmdHdlrInt, 0 },
+ { "ignorepreviousmessages", eCmdHdlrBinary, 0 },
++ { "ignorenonvalidstatefile", eCmdHdlrBinary, 0 },
+ { "defaultseverity", eCmdHdlrSeverity, 0 },
+ { "defaultfacility", eCmdHdlrString, 0 },
+ { "defaulttag", eCmdHdlrGetWord, 0 },
+@@ -441,23 +443,36 @@ static rsRetVal
+ persistJournalState () {
+ DEFiRet;
+ FILE *sf; /* state file */
++ char tmp_sf[MAXFNAME];
+ char *cursor;
+ int ret = 0;
+
+ /* On success, sd_journal_get_cursor() returns 1 in systemd
+ 197 or older and 0 in systemd 198 or newer */
+ if ((ret = sd_journal_get_cursor(j, &cursor)) >= 0) {
+- if ((sf = fopen(cs.stateFile, "wb")) != NULL) {
++ /* we create a temporary name by adding a ".tmp"
++ * suffix to the end of our state file's name
++ */
++ snprintf(tmp_sf, sizeof(tmp_sf), "%s.tmp", cs.stateFile);
++ if ((sf = fopen(tmp_sf, "wb")) != NULL) {
+ if (fprintf(sf, "%s", cursor) < 0) {
+ iRet = RS_RET_IO_ERROR;
+ }
+ fclose(sf);
+ free(cursor);
++ /* change the name of the file to the configured one */
++ if (iRet == RS_RET_OK && rename(tmp_sf, cs.stateFile) == -1) {
++ char errStr[256];
++ rs_strerror_r(errno, errStr, sizeof(errStr));
++ iRet = RS_RET_IO_ERROR;
++ errmsg.LogError(0, iRet, "rename() failed: "
++ "'%s', new path: '%s'\n", errStr, cs.stateFile);
++ }
+ } else {
+ char errStr[256];
+ rs_strerror_r(errno, errStr, sizeof(errStr));
+ errmsg.LogError(0, RS_RET_FOPEN_FAILURE, "fopen() failed: "
+- "'%s', path: '%s'\n", errStr, cs.stateFile);
++ "'%s', path: '%s'\n", errStr, tmp_sf);
+ iRet = RS_RET_FOPEN_FAILURE;
+ }
+ } else {
+@@ -515,6 +530,35 @@ finalize_it:
+ RETiRet;
+ }
+
++/* Seek to the very end of the journal and ignore all older
++ * messages.
++ */
++static rsRetVal
++skipOldMessages(void)
++{
++ DEFiRet;
++
++ if (sd_journal_seek_tail(j) < 0) {
++ char errStr[256];
++
++ rs_strerror_r(errno, errStr, sizeof(errStr));
++ errmsg.LogError(0, RS_RET_ERR,
++ "sd_journal_seek_tail() failed: '%s'", errStr);
++ ABORT_FINALIZE(RS_RET_ERR);
++ }
++ if (sd_journal_previous(j) < 0) {
++ char errStr[256];
++
++ rs_strerror_r(errno, errStr, sizeof(errStr));
++ errmsg.LogError(0, RS_RET_ERR,
++ "sd_journal_previous() failed: '%s'", errStr);
++ ABORT_FINALIZE(RS_RET_ERR);
++ }
++
++finalize_it:
++ RETiRet;
++
++}
+
+ /* This function loads a journal cursor from the state file.
+ */
+@@ -546,41 +590,32 @@ loadJournalState()
+ errmsg.LogError(0, RS_RET_ERR, "imjournal: "
+ "couldn't seek to cursor `%s'\n", readCursor);
+ iRet = RS_RET_ERR;
+- goto finalize_it;
++ } else {
++ sd_journal_next(j);
+ }
+- sd_journal_next(j);
+ } else {
+ errmsg.LogError(0, RS_RET_IO_ERROR, "imjournal: "
+ "fscanf on state file `%s' failed\n", cs.stateFile);
+ iRet = RS_RET_IO_ERROR;
+- goto finalize_it;
+ }
++
+ fclose(r_sf);
++
++ if (iRet != RS_RET_OK && cs.bIgnoreNonValidStatefile) {
++ /* ignore state file errors */
++ iRet = RS_RET_OK;
++ errmsg.LogError(0, NO_ERRCODE,
++ "imjournal: ignoring invalid state file");
++ if (cs.bIgnorePrevious) {
++ skipOldMessages();
++ }
++ }
+ } else {
+ errmsg.LogError(0, RS_RET_FOPEN_FAILURE, "imjournal: "
+ "open on state file `%s' failed\n", cs.stateFile);
+ }
+- } else {
+- /* when IgnorePrevious, seek to the end of journal */
+- if (cs.bIgnorePrevious) {
+- if (sd_journal_seek_tail(j) < 0) {
+- char errStr[256];
+-
+- rs_strerror_r(errno, errStr, sizeof(errStr));
+- errmsg.LogError(0, RS_RET_ERR,
+- "sd_journal_seek_tail() failed: '%s'", errStr);
+- ABORT_FINALIZE(RS_RET_ERR);
+- }
+-
+- if (sd_journal_previous(j) < 0) {
+- char errStr[256];
+-
+- rs_strerror_r(errno, errStr, sizeof(errStr));
+- errmsg.LogError(0, RS_RET_ERR,
+- "sd_journal_previous() failed: '%s'", errStr);
+- ABORT_FINALIZE(RS_RET_ERR);
+- }
+- }
++ } else if (cs.bIgnorePrevious) {
++ skipOldMessages();
+ }
+
+ finalize_it:
+@@ -598,6 +633,8 @@ CODESTARTrunInput
+
+ if (cs.stateFile) {
+ CHKiRet(loadJournalState());
++ } else if (cs.bIgnorePrevious) {
++ skipOldMessages();
+ }
+
+ /* this is an endless loop - it is terminated when the thread is
+@@ -641,6 +678,7 @@ BEGINbeginCnfLoad
+ CODESTARTbeginCnfLoad
+ bLegacyCnfModGlobalsPermitted = 1;
+
++ cs.bIgnoreNonValidStatefile = 1;
+ cs.iPersistStateInterval = DFLT_persiststateinterval;
+ cs.stateFile = NULL;
+ cs.ratelimitBurst = 20000;
+@@ -739,7 +777,9 @@ CODESTARTsetModCnf
+ } else if(!strcmp(modpblk.descr[i].name, "ratelimit.interval")) {
+ cs.ratelimitInterval = (int) pvals[i].val.d.n;
+ } else if (!strcmp(modpblk.descr[i].name, "ignorepreviousmessages")) {
+- cs.bIgnorePrevious = (int) pvals[i].val.d.n;
++ cs.bIgnorePrevious = (int) pvals[i].val.d.n;
++ } else if (!strcmp(modpblk.descr[i].name, "ignorenonvalidstatefile")) {
++ cs.bIgnoreNonValidStatefile = (int) pvals[i].val.d.n;
+ } else if (!strcmp(modpblk.descr[i].name, "defaultseverity")) {
+ cs.iDfltSeverity = (int) pvals[i].val.d.n;
+ } else if (!strcmp(modpblk.descr[i].name, "defaultfacility")) {
+@@ -806,7 +846,9 @@ CODEmodInit_QueryRegCFSLineHdlr
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournalstatefile", 0, eCmdHdlrGetWord,
+ NULL, &cs.stateFile, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournalignorepreviousmessages", 0, eCmdHdlrBinary,
+- NULL, &cs.bIgnorePrevious, STD_LOADABLE_MODULE_ID));
++ NULL, &cs.bIgnorePrevious, STD_LOADABLE_MODULE_ID));
++ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournalignorenonvalidstatefile", 0, eCmdHdlrBinary,
++ NULL, &cs.bIgnoreNonValidStatefile, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournaldefaultseverity", 0, eCmdHdlrSeverity,
+ NULL, &cs.iDfltSeverity, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournaldefaultfacility", 0, eCmdHdlrCustomHandler,
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1263853-startup-order.patch b/SOURCES/rsyslog-7.4.7-rhbz1263853-startup-order.patch
new file mode 100644
index 0000000..65e2551
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1263853-startup-order.patch
@@ -0,0 +1,24 @@
+From d0e0108bde62119a0b759fe5b88262fa375fc108 Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich
+Date: Thu, 7 Jul 2016 01:33:45 +0200
+Subject: [PATCH] Order service start after the network
+
+---
+ rsyslog.service.in | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/rsyslog.service.in b/rsyslog.service.in
+index 8e2d64c..2c44f3b 100644
+--- a/rsyslog.service.in
++++ b/rsyslog.service.in
+@@ -1,6 +1,7 @@
+ [Unit]
+ Description=System Logging Service
+ Requires=syslog.socket
++After=network.target
+
+ [Service]
+ Type=notify
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1282687-ruleset-parser-crash.patch b/SOURCES/rsyslog-7.4.7-rhbz1282687-ruleset-parser-crash.patch
new file mode 100644
index 0000000..ba5ca5b
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1282687-ruleset-parser-crash.patch
@@ -0,0 +1,28 @@
+From c7f33b1edeffc8b7a2da2f7665e45c42f4b4e5db Mon Sep 17 00:00:00 2001
+From: Rainer Gerhards
+Date: Wed, 9 Jul 2014 11:56:18 +0200
+Subject: [PATCH] bugfix: double-free when ruleset() parser parameters were
+ used
+
+While unlikely, this could cause stability issues even after the
+config phase.
+---
+ runtime/ruleset.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/runtime/ruleset.c b/runtime/ruleset.c
+index 1afb403..8e8f63b 100644
+--- a/runtime/ruleset.c
++++ b/runtime/ruleset.c
+@@ -993,7 +993,7 @@ rulesetProcessCnf(struct cnfobj *o)
+ for(i = 0 ; i < ar->nmemb ; ++i) {
+ parserName = (uchar*)es_str2cstr(ar->arr[i], NULL);
+ doRulesetAddParser(pRuleset, parserName);
+- free(parserName);
++ /* note parserName is freed in doRulesetAddParser()! */
+ }
+ }
+
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1295798-shutdown-delay.patch b/SOURCES/rsyslog-7.4.7-rhbz1295798-shutdown-delay.patch
new file mode 100644
index 0000000..42ebc13
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1295798-shutdown-delay.patch
@@ -0,0 +1,77 @@
+From fde188d9bdd5845f3b1928c2cd61ddf5a541e657 Mon Sep 17 00:00:00 2001
+From: Tomas Heinrich
+Date: Mon, 4 Jul 2016 16:04:51 +0200
+Subject: [PATCH] Fix a race condition in wtp
+
+The shutdown sequence in wtp relies for its operation on signals and
+cancelation cleanup handlers. Previously, trying to shutdown a thread
+that has not yet been properly initialized could lead to a deadlock.
+This change makes wtpStartWrkr() synchronous in regard to the
+initialization of the newly created thread.
+
+Thanks to Rado Sroka for the analysis and an initial patch.
+---
+ runtime/wtp.c | 13 +++++++++++++
+ runtime/wtp.h | 1 +
+ 2 files changed, 14 insertions(+)
+
+diff --git a/runtime/wtp.c b/runtime/wtp.c
+index 19151e7..d48a2d7 100644
+--- a/runtime/wtp.c
++++ b/runtime/wtp.c
+@@ -88,6 +88,7 @@ static rsRetVal NotImplementedDummy() { return RS_RET_NOT_IMPLEMENTED; }
+ */
+ BEGINobjConstruct(wtp) /* be sure to specify the object type also in END macro! */
+ pthread_mutex_init(&pThis->mutWtp, NULL);
++ pthread_cond_init(&pThis->condThrdInitDone, NULL);
+ pthread_cond_init(&pThis->condThrdTrm, NULL);
+ pthread_attr_init(&pThis->attrThrd);
+ /* Set thread scheduling policy to default */
+@@ -155,6 +156,7 @@ CODESTARTobjDestruct(wtp)
+
+ /* actual destruction */
+ pthread_cond_destroy(&pThis->condThrdTrm);
++ pthread_cond_destroy(&pThis->condThrdInitDone);
+ pthread_mutex_destroy(&pThis->mutWtp);
+ pthread_attr_destroy(&pThis->attrThrd);
+ DESTROY_ATOMIC_HELPER_MUT(pThis->mutCurNumWrkThrd);
+@@ -385,6 +387,12 @@ wtpWorker(void *arg) /* the arg is actually a wti object, even though we are in
+ # endif
+
+ pthread_cleanup_push(wtpWrkrExecCancelCleanup, pWti);
++
++ /* let the parent know we're done with initialization */
++ d_pthread_mutex_lock(&pThis->mutWtp);
++ pthread_cond_broadcast(&pThis->condThrdInitDone);
++ d_pthread_mutex_unlock(&pThis->mutWtp);
++
+ wtiWorker(pWti);
+ pthread_cleanup_pop(0);
+ wtpWrkrExecCleanup(pWti);
+@@ -436,6 +444,11 @@ wtpStartWrkr(wtp_t *pThis)
+ wtpGetDbgHdr(pThis), iState,
+ ATOMIC_FETCH_32BIT(&pThis->iCurNumWrkThrd, &pThis->mutCurNumWrkThrd));
+
++ /* wait for the new thread to initialize its signal mask and
++ * cancelation cleanup handler before proceeding
++ */
++ d_pthread_cond_wait(&pThis->condThrdInitDone, &pThis->mutWtp);
++
+ finalize_it:
+ d_pthread_mutex_unlock(&pThis->mutWtp);
+ RETiRet;
+diff --git a/runtime/wtp.h b/runtime/wtp.h
+index 25992f7..63912e6 100644
+--- a/runtime/wtp.h
++++ b/runtime/wtp.h
+@@ -50,6 +50,7 @@ struct wtp_s {
+ rsRetVal (*pConsumer)(void *); /* user-supplied consumer function for dewtpd messages */
+ /* synchronization variables */
+ pthread_mutex_t mutWtp; /* mutex for the wtp's thread management */
++ pthread_cond_t condThrdInitDone; /* signalled when a new thread is ready for work */
+ pthread_cond_t condThrdTrm;/* signalled when threads terminate */
+ /* end sync variables */
+ /* user objects */
+--
+2.5.5
+
diff --git a/SOURCES/rsyslog-7.4.7-rhbz1303617-imfile-wildcards.patch b/SOURCES/rsyslog-7.4.7-rhbz1303617-imfile-wildcards.patch
new file mode 100644
index 0000000..7efabbe
--- /dev/null
+++ b/SOURCES/rsyslog-7.4.7-rhbz1303617-imfile-wildcards.patch
@@ -0,0 +1,2211 @@
+--- ./config.h.in.fix
++++ ./config.h.in
+@@ -97,6 +97,9 @@
+ /* set define */
+ #undef HAVE_GLOB_NOMAGIC
+
++/* Define to 1 if you have the `inotify_init` function. */
++#undef HAVE_INOTIFY_INIT
++
+ /* Define to 1 if you have the header file. */
+ #undef HAVE_INTTYPES_H
+
+@@ -265,6 +268,9 @@
+ /* Define to 1 if you have the header file. */
+ #undef HAVE_SYS_IOCTL_H
+
++/* Define to 1 if you have the header file. */
++#undef HAVE_SYS_INOTIFY_H
++
+ /* Define to 1 if you have the header file. */
+ #undef HAVE_SYS_PARAM_H
+
+--- ./configure.fix
++++ ./configure
+@@ -13958,7 +13958,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>c
+
+ fi
+
+-for ac_header in arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h syslog.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h
++for ac_header in arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/inotify.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h syslog.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h
+ do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+@@ -15153,7 +15153,7 @@ fi
+ done
+
+
+-for ac_func in flock basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setsid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r getline malloc_trim prctl epoll_create epoll_create1 fdatasync syscall lseek64
++for ac_func in flock inotify_init basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setsid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r getline malloc_trim prctl epoll_create epoll_create1 fdatasync syscall lseek64
+ do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+
+#diff --git a/configure.ac b/configure.ac
+#index 123ed7e..be5d7f1 100644
+#--- a/configure.ac
+#+++ b/configure.ac
+#@@ -85,7 +85,7 @@ AC_SUBST(DL_LIBS)
+# AC_HEADER_RESOLV
+# AC_HEADER_STDC
+# AC_HEADER_SYS_WAIT
+#-AC_CHECK_HEADERS([arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h syslog.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h])
+#+AC_CHECK_HEADERS([arpa/inet.h libgen.h malloc.h fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h sys/inotify.h syslog.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h])
+#
+# # Checks for typedefs, structures, and compiler characteristics.
+# AC_C_CONST
+#@@ -121,7 +121,7 @@ AC_TYPE_SIGNAL
+# AC_FUNC_STAT
+# AC_FUNC_STRERROR_R
+# AC_FUNC_VPRINTF
+#-AC_CHECK_FUNCS([flock basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setsid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r getline malloc_trim prctl epoll_create epoll_create1 fdatasync syscall lseek64])
+#+AC_CHECK_FUNCS([flock inotify_init basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setsid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r getline malloc_trim prctl epoll_create epoll_create1 fdatasync syscall lseek64])
+#
+# # getifaddrs is in libc (mostly) or in libsocket (eg Solaris 11) or not defined (eg Solaris 10)
+# AC_SEARCH_LIBS([getifaddrs], [socket], [AC_DEFINE(HAVE_GETIFADDRS, [1], [set define])])
+
+diff --git a/doc/imfile.html b/doc/imfile.html
+index a69f62e..4592cde 100644
+--- a/doc/imfile.html
++++ b/doc/imfile.html
+@@ -30,26 +30,74 @@ lines from the previous file can no longer be obtained.
+ records the last processed location and continues to work from there
+ upon restart. So no data is lost during a restart (except, as noted
+ above, if the file is rotated just in this very moment).
+-Currently, the file must have a fixed name and location
+-(directory). It is planned to add support for dynamically generating
+-file names in the future.
+-Multiple files may be monitored by specifying
+-$InputRunFileMonitor multiple times.
+-
++
++State Files
++Rsyslog must keep track of which parts of the monitored file
++are already processed. This is done in so-called “state files”.
++These files are always created in the rsyslog working directory
++(configurable via $WorkDirectory).
++To avoid problems with duplicate state files, rsyslog automatically
++generates state file names according to the following scheme:
++
++- the string “imfile-state:” is added before the actual file name,
++which includes the full path
++- the full name is prepended after that string, but all occurrences
++of “/” are replaced by “-” to facilitate handling of these files
++
++As a concrete example, consider file /var/log/applog
is
++being monitored. The corresponding state file will be named
++imfile-state:-var-log-applog
.
++Note that it is possible to set a fixed state file name via the
++deprecated “stateFile” parameter. It is suggested to avoid this, as
++the user must take care of name clashes. Most importantly, if
++“stateFile” is set for file monitors with wildcards, the same
++state file is used for all occurrences of these files. In short,
++this will usually not work and cause confusion. Upon startup,
++rsyslog tries to detect these cases and emit warning messages.
++However, the detection simply checks for the presence of “*”
++and as such it will not cover more complex cases.
++Note that when $WorkDirectory is not set or
++set to a non-writable location, the state file will not be generated.
++In those cases, the file content will always be completely re-sent by
++imfile, because the module does not know that it already processed
++parts of that file.
++
++Metadata
++The imfile module supports message metadata. It supports the following
++data items
++
++Metadata is only present if enabled. By default it is enabled for
++input() statements that contain wildcards. For all others, it is
++disabled by default. It can explicitly be turned on or off via the
++addMetadata input() parameter, which always overrides the default.
++
++
+
+ Configuration Directives:
+ Module Directives
+
+-- PollingInterval
+-seconds
+-This is a global setting. It specifies how often files are to be polled
+-for new data. The time specified is in seconds. The default value is 10
+-seconds. Please note that future
+-releases of imfile may support per-file polling intervals, but
+-currently this is not the case. If multiple PollingInterval
+-statements are present in rsyslog.conf, only the last one is used.
++ - mode (requires v8.1.5+)
++This specifies if imfile is shall run in inotify ("inotify", default)
++or polling ("polling") mode. Traditionally, imfile used polling mode, which is much more
++resource-intense (and slower) than inotify mode. It is suggested that users
++turn on "polling" mode only if they experience strange problems in inotify mode.
++In theory, there never should be a reason to enable "polling" mode and later versions
++will most probably remove that mode.
++
++ - PollingInterval
++This setting specifies how often files are to be polled for new data.
++For obvious reasons, it has effect only if imfile is runnin in polling mode.
++The time specified is in seconds. The default value
++is 10 seconds.
+ A short poll interval provides more rapid message forwarding, but
+-requires more system resources. While it is possible, we stongly
++requires more system resources. While it is possible, we strongly
+ recommend not to set the polling interval to 0 seconds. That will make
+ rsyslogd become a CPU hog, taking up considerable resources. It is
+ supported, however, for the few very unusual situations where this
+@@ -61,37 +109,31 @@ nothing is left to be processed.
+
+ Action Directives
+
+-- (required) File /path/to/file
+-The file being monitored. So far, this must be an absolute name (no
+-macros or templates)
+-- (required) Tag
+-tag:
++ - File (mandatory)
++The file to be monitored. This must be an absolute name.
++
++- StateFile
++This is the name of this file’s state file. This parameter should
++usually not be used. Check the section on “State Files” above
++for more details.
++
++- Tag (mandatory)
+ The tag to be used for messages that originate from this file. If you
+ would like to see the colon after the tag, you need to specify it here
+-(as shown above).
+-- (required) StateFile
+-<name-of-state-file>
+-Rsyslog must keep track of which parts of the to be monitored file it
+-already processed. This is done in the state file. This file always is
+-created in the rsyslog working directory (configurable via
+-$WorkDirectory). Be careful to use unique names for different files
+-being monitored. If there are duplicates, all sorts of "interesting"
+-things may happen. Rsyslog currently does not check if a name is
+-specified multiple times.
+-Note that when $WorkDirectory is not set or set to a non-writable
+-location, the state file will not be generated.
+-- Facility
+-facility
++(like 'tag="tag:"').
++
++- Facility
+ The syslog facility to be assigned to lines read. Can be specified in
+ textual form (e.g. "local0", "local1", ...) or as numbers (e.g. 128 for
+-"local0"). Textual form is suggested. Default is
+-"local0".
+-- Severity
+-The
+-syslog severity to be assigned to lines read. Can be specified in
++"local0"). Textual form is suggested. Default is
++"local0".
++
++- Severity
++The syslog severity to be assigned to lines read. Can be specified in
+ textual form (e.g. "info", "warning", ...) or as numbers (e.g. 4 for
+-"info"). Textual form is suggested. Default
++"info"). Textual form is suggested. Default
+ is "notice".
++
+ - PersistStateInterval [lines]
+ Specifies how often the state file shall be written when processing the input
+ file. The default value is 0, which means a new state file is only written when
+@@ -101,20 +143,29 @@ been processed. This setting can be used to guard against message duplication du
+ to fatal errors (like power fail). Note that this setting affects imfile
+ performance, especially when set to a low value. Frequently writing the state
+ file is very time consuming.
++
+ - ReadMode [mode]
+ This mode should defined when having multiline messages. The value can range from 0-2 and determines the multiline detection method.
+
0 (default) - line based (Each line is a new message)
+
1 - paragraph (There is a blank line between log messages)
+
2 - indented (New log messages start at the beginning of a line. If a line starts with a space it is part of the log message before it)
++
+ - MaxLinesAtOnce [number]
+-
+-This is useful if multiple files need to be monitored. If set to 0, each file
+-will be fully processed and then processing switches to the next file
+-(this was the default in previous versions). If it is set, a maximum of
+-[number] lines is processed in sequence for each file, and then the file is
+-switched. This provides a kind of mutiplexing the load of multiple files and
+-probably leads to a more natural distribution of events when multiple busy files
+-are monitored. The default is 1024.
++This is a legacy setting that only is supported in polling mode.
++In inotify mode, it is fixed at 0 and all attempts to configure
++a different value will be ignored, but will generate an error
++message.
++Please note that future versions of imfile may not support this
++parameter at all. So it is suggested to not use it.
++In polling mode, if set to 0, each file will be fully processed and
++then processing switches to the next file. If it is set to any other
++value, a maximum of [number] lines is processed in sequence for each file,
++and then the file is switched. This provides a kind of mutiplexing
++the load of multiple files and probably leads to a more natural
++distribution of events when multiple busy files are monitored. For
++polling mode, the default is 10240.
++
++
+ - MaxSubmitAtOnce [number]
+
+ This is an expert option. It can be used to set the maximum input batch size that
+@@ -124,17 +175,38 @@ modify this option. If you do not know what this doc here talks about, this is a
+ good indication that you should NOT modify the default.
+ - Ruleset <ruleset>
+ Binds the listener to a specific ruleset.
++
++- deleteStateOnFileDelete [on/off]
++
Default: on
++This parameter controls if state files are deleted if their associated
++main file is deleted. Usually, this is a good idea, because otherwise
++problems would occur if a new file with the same name is created. In
++that case, imfile would pick up reading from the last position in
++the deleted file, which usually is not what you want.
++However, there is one situation where not deleting associated state
++file makes sense: this is the case if a monitored file is modified
++with an editor (like vi or gedit). Most editors write out modifications
++by deleting the old file and creating a new now. If the state file
++would be deleted in that case, all of the file would be reprocessed,
++something that’s probably not intended in most case. As a side-note,
++it is strongly suggested not to modify monitored files with
++editors. In any case, in such a situation, it makes sense to
++disable state file deletion. That also applies to similar use
++cases.
++In general, this parameter should only by set if the users
++knows exactly why this is required.
++
++
++- addMetadata [on/off]
++
Default: see intro section on Metadata
++This is used to turn on or off the addition of metadata to the
++message object.
++
++
+
++
+ Caveats/Known Bugs:
+-So far, only 100 files can be monitored. If more are needed,
+-the source needs to be patched. See define MAX_INPUT_FILES in imfile.c
Powertop
+-users may want to notice that imfile utilizes polling. Thus, it is no
+-good citizen when it comes to conserving system power consumption. We
+-are currently evaluating to move to inotify(). However, there are a
+-number of subtle issues, which needs to be worked out first. We will
+-make the change as soon as we can. If you can afford it, we recommend
+-using a long polling interval in the mean time.
+-
++Currently none.
+
Sample:
+ The following sample monitors two files. If you need just one,
+ remove the second one. If you need more, add them according to the
+@@ -160,6 +232,11 @@ input(type="imfile" File="/path/to/file2"
+
+
+
Legacy Configuration Directives:
++Note: in order to preserve compatibility with previous versions, the
++LF escaping in multi-line messages is turned off for legacy-configured
++file monitors (the "escapeLF" input parameter). This can cause serious problems.
++So it is highly suggested that new deployments use the new input() statement
++and keep LF escaping turned on.
+
+ - $InputFileName /path/to/file
+ equivalent to: File
+@@ -194,16 +271,6 @@ equivalent to: MaxLinesAtOnce
+ Available in 5.7.5+, 6.1.5+
+ equivalent to: Ruleset
+
+-Caveats/Known Bugs:
+-So far, only 100 files can be monitored. If more are needed,
+-the source needs to be patched. See define MAX_INPUT_FILES in imfile.c
Powertop
+-users may want to notice that imfile utilizes polling. Thus, it is no
+-good citizen when it comes to conserving system power consumption. We
+-are currently evaluating to move to inotify(). However, there are a
+-number of subtle issues, which needs to be worked out first. We will
+-make the change as soon as we can. If you can afford it, we recommend
+-using a long polling interval in the mean time.
+-
+ Sample:
+ The following sample monitors two files. If you need just one,
+ remove the second one. If you need more, add them according to the
+@@ -234,7 +301,7 @@ $InputFilePollInterval 10
+ [manual index] [rsyslog site]
+ This documentation is part of the
+ rsyslog project.
+-Copyright © 2008 by Rainer
++Copyright © 2008-2014 by Rainer
+ Gerhards and Adiscon.
+ Released under the GNU GPL version 3 or higher.
+