diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | debian/changelog | 36 | ||||
-rw-r--r-- | debian/control | 16 | ||||
-rw-r--r-- | debian/patches/ignore_non_conf_files.patch | 23 | ||||
-rw-r--r-- | debian/patches/no_create_db.patch | 21 | ||||
-rw-r--r-- | debian/patches/series | 2 | ||||
-rw-r--r-- | debian/rsyslog-mysql.config | 16 | ||||
-rw-r--r-- | debian/rsyslog-mysql.dirs | 1 | ||||
-rw-r--r-- | debian/rsyslog-mysql.install | 1 | ||||
-rw-r--r-- | debian/rsyslog-mysql.postinst | 66 | ||||
-rw-r--r-- | debian/rsyslog-mysql.postrm | 55 | ||||
-rw-r--r-- | debian/rsyslog-mysql.prerm | 12 | ||||
-rw-r--r-- | debian/rsyslog.install | 2 | ||||
-rwxr-xr-x | debian/rules | 16 | ||||
-rw-r--r-- | doc/rsyslog_packages.html | 7 | ||||
-rw-r--r-- | doc/status.html | 8 | ||||
-rw-r--r-- | msg.c | 4 | ||||
-rw-r--r-- | omfile.c | 93 | ||||
-rw-r--r-- | syslogd.c | 2 |
21 files changed, 345 insertions, 68 deletions
@@ -1,4 +1,12 @@ --------------------------------------------------------------------------- +Version 1.19.2 (rgerhards), 2007-08-28 +- a specifically formed message caused a segfault - Many thanks varmojfekoj + for providing a patch +- a typo and a weird condition are fixed in msg.c - Thanks again + varmojfekoj +- on file creation the file was always owned by root:root. This is fixed + now - Thanks ypsa for solving this issue +--------------------------------------------------------------------------- Version 1.19.1 (rgerhards), 2007-08-22 - a bug that caused a high load when a TCP/UDP connection was closed is fixed now - Thanks mildew for solving this issue @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for rsyslog 1.19.1. +# Generated by GNU Autoconf 2.61 for rsyslog 1.19.2. # # Report bugs to <rsyslog@lists.adiscon.com.>. # @@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='rsyslog' PACKAGE_TARNAME='rsyslog' -PACKAGE_VERSION='1.19.1' -PACKAGE_STRING='rsyslog 1.19.1' +PACKAGE_VERSION='1.19.2' +PACKAGE_STRING='rsyslog 1.19.2' PACKAGE_BUGREPORT='rsyslog@lists.adiscon.com.' ac_unique_file="syslogd.c" @@ -1397,7 +1397,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rsyslog 1.19.1 to adapt to many kinds of systems. +\`configure' configures rsyslog 1.19.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1467,7 +1467,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rsyslog 1.19.1:";; + short | recursive ) echo "Configuration of rsyslog 1.19.2:";; esac cat <<\_ACEOF @@ -1579,7 +1579,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rsyslog configure 1.19.1 +rsyslog configure 1.19.2 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1593,7 +1593,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by rsyslog $as_me 1.19.1, which was +It was created by rsyslog $as_me 1.19.2, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2283,7 +2283,7 @@ fi # Define the identity of the package. PACKAGE=rsyslog - VERSION=1.19.1 + VERSION=1.19.2 cat >>confdefs.h <<_ACEOF @@ -24006,7 +24006,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by rsyslog $as_me 1.19.1, which was +This file was extended by rsyslog $as_me 1.19.2, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24059,7 +24059,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -rsyslog config.status 1.19.1 +rsyslog config.status 1.19.2 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index cdcd28d..d9103d1 100644 --- a/configure.ac +++ b/configure.ac @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[1.19.1],[rsyslog@lists.adiscon.com.]) -AM_INIT_AUTOMAKE(rsyslog, 1.19.1) +AC_INIT([rsyslog],[1.19.2],[rsyslog@lists.adiscon.com.]) +AM_INIT_AUTOMAKE(rsyslog, 1.19.2) AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADER([config.h]) diff --git a/debian/changelog b/debian/changelog index fb40fc9..f5aaf47 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,39 @@ +rsyslog (1.19.2-1) unstable; urgency=low + + * New upstream release. + + * Enable the mysql output plugin and split it into a separate binary package + named rsyslog-mysql. Use the dbconfig-common framework to handle the + database administration. Generate a configuration file + /etc/rsyslog.d/mysql.conf with the values provided by dbconfig-common and + use ucf to manage this file. + * debian/control + - Add a build dependency on quilt and libmysqlclient15-dev. + - Add the binary package rsyslog-mysql. + - Add Suggests: rsyslog-mysql to the rsyslog package. + * debian/rules + - Include the quilt makefile and add calls to the patch/unpatch targets. + - Pass --enable-mysql to ./configure. + - Install the SQL schema file for dbconfig-common. + * debian/rsyslog-mysql.config + - Setup the default values for dbconfig-common. + * debian/rsyslog-mysql.{postinst,prerm,postrm} + - Include the dbconfig-common scripts and call the dbc_go function. + - Use ucf and ucfr to manage the generated configuration file mysql.conf. + * debian/patches/ignore_non_conf_files.patch + - Let rsyslog ignore all configuration files not ending with *.conf. + * debian/patches/no_create_db.patch + - The database creation is handled by dbconfig-common so we only need the + createDB.sql SQL schema file for setting up the tables. + * debian/patches/series + - Added, needed by quilt. Include the two patches above. + * debian/rsyslog-mysql.dirs + - Create the install directory for the SQL schema file. + * debian/rsyslog-mysql.install + - Install the mysql output plugin ommysql.so. + + -- Michael Biebl <biebl@debian.org> Sun, 02 Sep 2007 18:39:47 +0200 + rsyslog (1.19.1-1) unstable; urgency=low * New upstream release. diff --git a/debian/control b/debian/control index 51e3c9d..601f7e0 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: rsyslog Section: admin Priority: extra Maintainer: Michael Biebl <biebl@debian.org> -Build-Depends: debhelper (>= 5), autotools-dev, zlib1g-dev +Build-Depends: debhelper (>= 5), quilt, autotools-dev, zlib1g-dev, libmysqlclient15-dev Standards-Version: 3.7.2 Package: rsyslog @@ -12,10 +12,11 @@ Replaces: linux-kernel-log-daemon, system-log-daemon Provides: linux-kernel-log-daemon, system-log-daemon Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: logrotate +Suggests: rsyslog-mysql Description: enhanced multi-threaded syslogd - Rsyslog is an enhanced multi-threaded syslogd supporting, amongst others: + Rsyslog is an enhanced syslogd supporting, amongst others: * reliable syslog over TCP and RFC 3195 - * writing to MySQL databases + * writing to MySQL databases (via a separate output plugin) * permitted sender lists * filtering on any part of the syslog message * on-the-wire message compression @@ -28,3 +29,12 @@ Description: enhanced multi-threaded syslogd easy to setup for the novice user. . Homepage: http://www.rsyslog.com/ + +Package: rsyslog-mysql +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, rsyslog (= ${binary:Version}), dbconfig-common, ucf +Recommends: mysql-server +Description: MySQL output plugin for rsyslog + This plugin allows rsyslog to write the syslog messages into a MySQL database. + . + Homepage: http://www.rsyslog.com/ diff --git a/debian/patches/ignore_non_conf_files.patch b/debian/patches/ignore_non_conf_files.patch new file mode 100644 index 0000000..b335221 --- /dev/null +++ b/debian/patches/ignore_non_conf_files.patch @@ -0,0 +1,23 @@ +Index: syslogd.c +=================================================================== +--- syslogd.c (Revision 864) ++++ syslogd.c (Arbeitskopie) +@@ -3675,6 +3675,7 @@ + size_t iDirNameLen; + size_t iFileNameLen; + uchar szFullFileName[MAXFNAME]; ++ uchar *ext = NULL; + + assert(pDirName != NULL); + +@@ -3696,6 +3697,10 @@ + continue; /* we are not interested in special files */ + if(res->d_name[0] == '.') + continue; /* these files we are also not interested in */ ++ ext = strstr(res->d_name, ".conf"); ++ if(ext == NULL || strlen(ext) != 5) ++ continue; /* Ignore files not ending in *.conf */ ++ + ++iEntriesDone; + /* construct filename */ + iFileNameLen = strnlen(res->d_name, NAME_MAX); diff --git a/debian/patches/no_create_db.patch b/debian/patches/no_create_db.patch new file mode 100644 index 0000000..1576706 --- /dev/null +++ b/debian/patches/no_create_db.patch @@ -0,0 +1,21 @@ +Index: rsyslog/createDB.sql +=================================================================== +--- rsyslog.orig/createDB.sql 2007-08-30 01:05:00.000000000 +0200 ++++ rsyslog/createDB.sql 2007-08-30 01:07:50.000000000 +0200 +@@ -1,6 +1,4 @@ +-CREATE DATABASE Syslog; +-USE Syslog; +-CREATE TABLE SystemEvents ++CREATE TABLE IF NOT EXISTS SystemEvents + ( + ID int unsigned not null auto_increment primary key, + CustomerID bigint, +@@ -28,7 +26,7 @@ + SystemID int NULL + ); + +-CREATE TABLE SystemEventsProperties ++CREATE TABLE IF NOT EXISTS SystemEventsProperties + ( + ID int unsigned not null auto_increment primary key, + SystemEventID int NULL , diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..a73faf0 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +ignore_non_conf_files.patch -p0 +no_create_db.patch diff --git a/debian/rsyslog-mysql.config b/debian/rsyslog-mysql.config new file mode 100644 index 0000000..b9ce31f --- /dev/null +++ b/debian/rsyslog-mysql.config @@ -0,0 +1,16 @@ +#!/bin/sh +# config maintainer script for rsyslog-mysql + +# source debconf stuff +. /usr/share/debconf/confmodule + +# source dbconfig-common shell library, and call the hook function +if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then + . /usr/share/dbconfig-common/dpkg/config.mysql + + dbc_dbname="Syslog" + dbc_dbuser="rsyslog" + + dbc_go rsyslog-mysql $@ +fi + diff --git a/debian/rsyslog-mysql.dirs b/debian/rsyslog-mysql.dirs new file mode 100644 index 0000000..350e6b9 --- /dev/null +++ b/debian/rsyslog-mysql.dirs @@ -0,0 +1 @@ +usr/share/dbconfig-common/data/rsyslog-mysql/install diff --git a/debian/rsyslog-mysql.install b/debian/rsyslog-mysql.install new file mode 100644 index 0000000..2b5a957 --- /dev/null +++ b/debian/rsyslog-mysql.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/rsyslog/*.so diff --git a/debian/rsyslog-mysql.postinst b/debian/rsyslog-mysql.postinst new file mode 100644 index 0000000..30ae5c2 --- /dev/null +++ b/debian/rsyslog-mysql.postinst @@ -0,0 +1,66 @@ +#!/bin/sh + +set -e + +# summary of how this script can be called: +# * <postinst> `configure' <most-recently-configured-version> +# * <old-postinst> `abort-upgrade' <new version> +# * <conflictor's-postinst> `abort-remove' `in-favour' <package> +# <new-version> +# * <postinst> `abort-remove' +# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' +# <failed-install-package> <version> `removing' +# <conflicting-package> <version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +. /usr/share/debconf/confmodule +. /usr/share/dbconfig-common/dpkg/postinst + + +db_get rsyslog-mysql/db/dbname +DATABASE="$RET" +db_get rsyslog-mysql/db/app-user +USER="$RET" +db_get rsyslog-mysql/mysql/app-pass +PASS="$RET" +db_get rsyslog-mysql/remote/host +HOST="$RET" +[ -z "$HOST" ] && HOST="localhost" + + +dbc_go rsyslog-mysql $@ + + +case "$1" in + configure) + tempfile=`tempfile` + + cat <<-EOF > $tempfile + ### Configuration file for rsyslog-mysql + ### Changes are preserved + + \$ModLoad MySQL + *.* >$HOST,$DATABASE,$USER,$PASS + EOF + + ucf --debconf-ok $tempfile /etc/rsyslog.d/mysql.conf + ucfr rsyslog-mysql /etc/rsyslog.d/mysql.conf + rm -f $tempfile + + invoke-rc.d rsyslog reload + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + +#DEBHELPER# + +exit 0 diff --git a/debian/rsyslog-mysql.postrm b/debian/rsyslog-mysql.postrm new file mode 100644 index 0000000..f20f9fb --- /dev/null +++ b/debian/rsyslog-mysql.postrm @@ -0,0 +1,55 @@ +#!/bin/sh + +set -e + +# summary of how this script can be called: +# * <postrm> `remove' +# * <postrm> `purge' +# * <old-postrm> `upgrade' <new-version> +# * <new-postrm> `failed-upgrade' <old-version> +# * <new-postrm> `abort-install' +# * <new-postrm> `abort-install' <old-version> +# * <new-postrm> `abort-upgrade' <old-version> +# * <disappearer's-postrm> `disappear' <overwriter> +# <overwriter-version> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +if [ -f /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi +if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then + . /usr/share/dbconfig-common/dpkg/postrm + dbc_go rsyslog-mysql $@ +fi + +case "$1" in + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + purge) + CONFIGFILE=/etc/rsyslog.d/mysql.conf + + for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do + rm -f $CONFIGFILE$ext + done + + rm -f $CONFIGFILE + + if which ucf >/dev/null; then + ucf --purge $CONFIGFILE + fi + if which ucfr >/dev/null; then + ucfr --purge rsyslog-mysql $CONFIGFILE + fi + ;; + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + + +#DEBHELPER# + +exit 0 diff --git a/debian/rsyslog-mysql.prerm b/debian/rsyslog-mysql.prerm new file mode 100644 index 0000000..12c6348 --- /dev/null +++ b/debian/rsyslog-mysql.prerm @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule +. /usr/share/dbconfig-common/dpkg/prerm + +dbc_go rsyslog-mysql $@ + +#DEBHELPER# + +exit 0 diff --git a/debian/rsyslog.install b/debian/rsyslog.install index 2e9cd22..b808122 100644 --- a/debian/rsyslog.install +++ b/debian/rsyslog.install @@ -1,2 +1,4 @@ doc/* /usr/share/doc/rsyslog/html/ debian/rsyslog.conf /etc/ +debian/tmp/usr/sbin/ +debian/tmp/usr/share/man/ diff --git a/debian/rules b/debian/rules index 5c1dbd4..b7994e4 100755 --- a/debian/rules +++ b/debian/rules @@ -6,6 +6,7 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +include /usr/share/quilt/quilt.make # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) @@ -34,13 +35,13 @@ endif --prefix=/usr \ --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info \ - --disable-mysql \ + --enable-mysql \ CFLAGS="$(CFLAGS)" build: build-stamp -build-stamp: config.status +build-stamp: patch config.status dh_testdir # Add here commands to compile the package. @@ -48,7 +49,8 @@ build-stamp: config.status touch $@ -clean: +clean: clean-source unpatch +clean-source: dh_testdir dh_testroot rm -f build-stamp @@ -66,7 +68,9 @@ install: build dh_installdirs # Add here commands to install the package into debian/rsyslog. - $(MAKE) DESTDIR=$(CURDIR)/debian/rsyslog install + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + cp createDB.sql debian/rsyslog-mysql/usr/share/dbconfig-common/data/rsyslog-mysql/install/mysql # Build architecture-independent files here. binary-indep: build install @@ -82,8 +86,8 @@ binary-arch: build install dh_install dh_installlogrotate dh_installinit -- start 10 2 3 4 5 . stop 90 0 1 6 . -# dh_installcron dh_installman + dh_installdebconf dh_link dh_strip dh_compress @@ -95,4 +99,4 @@ binary-arch: build install dh_builddeb binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +.PHONY: build clean binary-indep binary-arch binary install diff --git a/doc/rsyslog_packages.html b/doc/rsyslog_packages.html index 32d282f..38c43c9 100644 --- a/doc/rsyslog_packages.html +++ b/doc/rsyslog_packages.html @@ -24,10 +24,17 @@ functionality. If you need that, you need to compile from the source tarball <h2>BSD</h2> <p>Give <a href="http://www.freshports.org/sysutils/rsyslog/"> http://www.freshports.org/sysutils/rsyslog/</a> a try.</p> + <h2>CentOS 4.3</h2> <a href="http://www.se-community.com/~james/rsyslog/"> http://www.se-community.com/~james/rsyslog/</a></p> <p>Maintained by<b> James Bergamin.</b></p> + +<h2>openSUSE</h2> +<a href="http://download.opensuse.org/repositories/home:/darix/"> +http://download.opensuse.org/repositories/home:/darix/</a></p> +<p>Maintained by<b> darix</b></p> + <h2>Almost any Linux</h2> <p><b>Bennet Todd</b> maintains packages that should work on almost any Linux. He keeps a current i386 tree. There is also a PPC tree, but that one is not paid diff --git a/doc/status.html b/doc/status.html index 786fcc6..3da059d 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,11 +4,11 @@ </head> <body> <h2>rsyslog status page</h2> -<p>This page reflects the status as of 2007-08-22.</p> +<p>This page reflects the status as of 2007-08-28.</p> <h2>Current Releases</h2> -<p><b>development:</b> 1.19.1 - -<a href="http://www.rsyslog.com/Article117.phtml">change log</a> - -<a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-53.phtml">download</a></p> +<p><b>development:</b> 1.19.2 - +<a href="http://www.rsyslog.com/Article119.phtml">change log</a> - +<a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-54.phtml">download</a></p> <p><b>stable:</b> 1.0.5 - <a href="http://www.rsyslog.com/Article85.phtml">change log</a> - <a href="http://www.rsyslog.com/Downloads-index-req-getit-lid-39.phtml">download</a></p> <p> (<a href="version_naming.html">How are versions named?</a>)</p> @@ -1615,12 +1615,10 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, if(*(pRes + iLn - 1) == '\n') { /* we have a LF! */ /* check if we need to obtain a private copy */ - if(pbMustBeFreed == 0) { + if(*pbMustBeFreed == 0) { /* ok, original copy, need a private one */ pB = malloc((iLn + 1) * sizeof(char)); if(pB == NULL) { - if(*pbMustBeFreed == 1) - free(pRes); *pbMustBeFreed = 0; return "**OUT OF MEMORY**"; } @@ -348,6 +348,50 @@ static void dynaFileFreeCache(instanceData *pData) } +/* This is a shared code for both static and dynamic files. + */ +static void prepareFile(instanceData *pData, uchar *newFileName) +{ + if(access((char*)newFileName, F_OK) == 0) { + /* file already exists */ + pData->fd = open((char*) newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, + pData->fCreateMode); + } else { + /* file does not exist, create it (and eventually parent directories */ + if(pData->bCreateDirs) { + /* we fist need to create parent dirs if they are missing + * We do not report any errors here ourselfs but let the code + * fall through to error handler below. + */ + if(makeFileParentDirs(newFileName, strlen((char*)newFileName), + pData->fDirCreateMode, pData->dirUID, + pData->dirGID, pData->bFailOnChown) == 0) { + pData->fd = open((char*) newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, + pData->fCreateMode); + if(pData->fd != -1) { + /* check and set uid/gid */ + if(pData->fileUID != (uid_t)-1 || pData->fileGID != (gid_t) -1) { + /* we need to set owner/group */ + if(fchown(pData->fd, pData->fileUID, + pData->fileGID) != 0) { + if(pData->bFailOnChown) { + int eSave = errno; + close(pData->fd); + pData->fd = -1; + errno = eSave; + } + /* we will silently ignore the chown() failure + * if configured to do so. + */ + } + } + } + } + } + } +} + + /* This function handles dynamic file names. It checks if the * requested file name is already open and, if not, does everything * needed to switch to the it. @@ -425,43 +469,7 @@ static int prepareDynFile(instanceData *pData, uchar *newFileName, unsigned iMsg } /* Ok, we finally can open the file */ - if(access((char*)newFileName, F_OK) == 0) { - /* file already exists */ - pData->fd = open((char*) newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, - pData->fCreateMode); - } else { - /* file does not exist, create it (and eventually parent directories */ - if(pData->bCreateDirs) { - /* we fist need to create parent dirs if they are missing - * We do not report any errors here ourselfs but let the code - * fall through to error handler below. - */ - if(makeFileParentDirs(newFileName, strlen((char*)newFileName), - pData->fDirCreateMode, pData->dirUID, - pData->dirGID, pData->bFailOnChown) == 0) { - pData->fd = open((char*) newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, - pData->fCreateMode); - if(pData->fd != -1) { - /* check and set uid/gid */ - if(pData->fileUID != (uid_t)-1 || pData->fileGID != (gid_t) -1) { - /* we need to set owner/group */ - if(fchown(pData->fd, pData->fileUID, - pData->fileGID) != 0) { - if(pData->bFailOnChown) { - int eSave = errno; - close(pData->fd); - pData->fd = -1; - errno = eSave; - } - /* we will silently ignore the chown() failure - * if configured to do so. - */ - } - } - } - } - } - } + prepareFile(pData, newFileName); /* file is either open now or an error state set */ if(pData->fd == -1) { @@ -729,11 +737,18 @@ CODESTARTparseSelectorAct pData->bDynamicName = 0; pData->fCreateMode = fCreateMode; /* preserve current setting */ + pData->fDirCreateMode = fDirCreateMode; + pData->bCreateDirs = bCreateDirs; + pData->bFailOnChown = bFailOnChown; + pData->fileUID = fileUID; + pData->fileGID = fileGID; + pData->dirUID = dirUID; + pData->dirGID = dirGID; + if(pData->fileType == eTypePIPE) { pData->fd = open(pData->f_fname, O_RDWR|O_NONBLOCK); } else { - pData->fd = open(pData->f_fname, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, - pData->fCreateMode); + prepareFile(pData, pData->f_fname); } if ( pData->fd < 0 ){ @@ -2435,7 +2435,7 @@ static rsRetVal callAction(msg_t *pMsg, action_t *pAction) /* suppress duplicate lines to this file */ - if ((pAction->f_ReduceRepeated == 1) && + if ((pAction->f_ReduceRepeated == 1) && pAction->f_pMsg != NULL && (pMsg->msgFlags & MARK) == 0 && getMSGLen(pMsg) == getMSGLen(pAction->f_pMsg) && !strcmp(getMSG(pMsg), getMSG(pAction->f_pMsg)) && !strcmp(getHOSTNAME(pMsg), getHOSTNAME(pAction->f_pMsg))) { |