From a34ed607d8aa1a537e031ef342674c32bf0d6e88 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 17 Dec 2007 07:01:30 +0000 Subject: fixed a potential race condition with enqueueMsg() - thanks to mildew for making me aware of this issue --- syslogd.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/syslogd.c b/syslogd.c index e9e822eb..d0040422 100644 --- a/syslogd.c +++ b/syslogd.c @@ -2212,13 +2212,6 @@ void printline(char *hname, char *msg, int bParseHost) logmsg(pri, pMsg, SYNC_FILE); - /* rgerhards 2004-11-11: - * we are done with the message object. If it still is - * stored somewhere, we can call discard anyhow. This - * is handled via the reference count - see description - * of msg_t for details. - */ - MsgDestruct(pMsg); return; } @@ -2272,7 +2265,6 @@ logmsgInternal(int pri, char *msg, int flags) * message to the queue engine. */ logmsg(pri, pMsg, flags); - MsgDestruct(pMsg); } #else iminternalAddMsg(pri, pMsg, flags); @@ -2816,7 +2808,7 @@ static void enqueueMsg(msg_t *pMsg) goto unlock; } } - queueAdd(fifo, MsgAddRef(pMsg)); + queueAdd(fifo, pMsg); unlock: /* now activate the worker thread */ pthread_mutex_unlock(fifo->mut); @@ -5538,7 +5530,6 @@ static void processImInternal(void) while(iminternalRemoveMsg(&iPri, &pMsg, &iFlags) == RS_RET_OK) { logmsg(iPri, pMsg, iFlags); - MsgDestruct(pMsg); } } -- cgit From 6cca81769a21a3fddfd5f5746fb5e9fecbd98836 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 18 Dec 2007 13:58:22 +0000 Subject: bumped version number --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ca0e16a9..173d4e8a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[1.20.2],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADER([config.h]) -- cgit From 65d57a9fc357fead6bb3f3efea08ee8bd8a9729c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 18 Dec 2007 13:59:26 +0000 Subject: removed files from cvs that not belong there (thanks to Michael Biebl for pointing that out) --- INSTALL | 234 ---------------------------- install-sh | 507 ------------------------------------------------------------- missing | 367 -------------------------------------------- 3 files changed, 1108 deletions(-) delete mode 100644 INSTALL delete mode 100755 install-sh delete mode 100755 missing diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 5458714e..00000000 --- a/INSTALL +++ /dev/null @@ -1,234 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/install-sh b/install-sh deleted file mode 100755 index 4fbbae7b..00000000 --- a/install-sh +++ /dev/null @@ -1,507 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2006-10-14.15 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -posix_glob= -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chmodcmd=$chmodprog -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - shift - shift - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac -done - -if test $# -ne 0 && test -z "$dir_arg$dstarg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix=/ ;; - -*) prefix=./ ;; - *) prefix= ;; - esac - - case $posix_glob in - '') - if (set -f) 2>/dev/null; then - posix_glob=true - else - posix_glob=false - fi ;; - esac - - oIFS=$IFS - IFS=/ - $posix_glob && set -f - set fnord $dstdir - shift - $posix_glob && set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dst"; then - $doit $rmcmd -f "$dst" 2>/dev/null \ - || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ - && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ - || { - echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - } || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/missing b/missing deleted file mode 100755 index 1c8ff704..00000000 --- a/missing +++ /dev/null @@ -1,367 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2006-05-10.23 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case $1 in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $1 in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: -- cgit From 779558133b0cfd348976dec1a01484496b469b6a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 18 Dec 2007 14:16:05 +0000 Subject: restructured #include's somewhat thanks to Michael Biebl --- omfwd.c | 3 +++ syslogd.c | 4 ++++ syslogd.h | 2 -- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/omfwd.c b/omfwd.c index f21480b7..fe866327 100644 --- a/omfwd.c +++ b/omfwd.c @@ -64,6 +64,9 @@ #ifdef USE_GSSAPI #include "gss-misc.h" #endif +#ifdef USE_NETZIP +#include +#endif #ifdef SYSLOG_INET #define INET_SUSPEND_TIME 60 /* equal to 1 minute diff --git a/syslogd.c b/syslogd.c index d0040422..483fd415 100644 --- a/syslogd.c +++ b/syslogd.c @@ -196,6 +196,10 @@ #include #endif +#ifdef USE_NETZIP +#include +#include +#endif /* handle some defines missing on more than one platform */ #ifndef SUN_LEN diff --git a/syslogd.h b/syslogd.h index c1d765eb..43d4f0ea 100644 --- a/syslogd.h +++ b/syslogd.h @@ -24,8 +24,6 @@ #include "objomsr.h" #ifdef USE_NETZIP -#include -#include /* config param: minimum message size to try compression. The smaller * the message, the less likely is any compression gain. We check for * gain before we submit the message. But to do so we still need to -- cgit From f3eefa2854823a0e4e526b68ffefac2066f32491 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 18 Dec 2007 14:31:05 +0000 Subject: code cleanups thanks to Michael Biebl --- configure.ac | 4 ++-- omfwd.c | 3 +++ plugins/ommysql/.cvsignore | 4 ++-- syslogd.c | 1 - syslogd.h | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 173d4e8a..d057318e 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ AC_PREREQ(2.61) AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) -AC_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC @@ -145,7 +145,7 @@ AC_ARG_ENABLE(gssapi_krb5, if test $want_gssapi_krb5 = yes; then AC_CHECK_LIB(gssapi_krb5, gss_acquire_cred, [ AC_CHECK_HEADER(gssapi/gssapi.h, [ - AC_MSG_ERROR(GSS-API not ready for primt time yet -- wait for next release); + AC_MSG_ERROR(GSS-API not ready for prime time yet -- wait for next release); AC_DEFINE(USE_GSSAPI,, Define if you want to use GSSAPI) gss_libs="-lgssapi_krb5" diff --git a/omfwd.c b/omfwd.c index fe866327..e310e6fc 100644 --- a/omfwd.c +++ b/omfwd.c @@ -43,6 +43,9 @@ #include #include #include +#ifdef USE_NETZIP +#include +#endif #ifdef USE_PTHREADS #include #else diff --git a/plugins/ommysql/.cvsignore b/plugins/ommysql/.cvsignore index 1281f785..9730646f 100644 --- a/plugins/ommysql/.cvsignore +++ b/plugins/ommysql/.cvsignore @@ -2,5 +2,5 @@ .libs Makefile Makefile.in -ommysql.la -ommysql_la-ommysql.lo +*.la +*.lo diff --git a/syslogd.c b/syslogd.c index 483fd415..0ed4065c 100644 --- a/syslogd.c +++ b/syslogd.c @@ -197,7 +197,6 @@ #endif #ifdef USE_NETZIP -#include #include #endif diff --git a/syslogd.h b/syslogd.h index 43d4f0ea..c1d765eb 100644 --- a/syslogd.h +++ b/syslogd.h @@ -24,6 +24,8 @@ #include "objomsr.h" #ifdef USE_NETZIP +#include +#include /* config param: minimum message size to try compression. The smaller * the message, the less likely is any compression gain. We check for * gain before we submit the message. But to do so we still need to -- cgit From 5963c721d6b81882b5941b1bfd741177418b2d30 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 18 Dec 2007 16:07:23 +0000 Subject: code cleanups thanks to Michael Biebl --- configure.ac | 2 ++ rsyslog.h | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index d057318e..50685926 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,8 @@ AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) +AC_GNU_SOURCE + # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O diff --git a/rsyslog.h b/rsyslog.h index b6e17d55..c08c5db9 100644 --- a/rsyslog.h +++ b/rsyslog.h @@ -24,10 +24,6 @@ # define _FILE_OFFSET_BITS 64 #endif -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - /* The error codes below are orginally "borrowed" from * liblogging. As such, we reserve values up to -2999 * just in case we need to borrow something more ;) -- cgit From 745cfae6d3231b409d39bf864706421a2c5a3a2c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 18 Dec 2007 16:19:46 +0000 Subject: applied Michael Biebl's patch to enhance $includeconfig to support wildcard filenames --- ChangeLog | 3 +++ syslogd.c | 40 ++++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 487387b3..e2ef8832 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ --------------------------------------------------------------------------- Version 1.20.2 (rgerhards), 2007-12-?? +- code cleanup +- enhanced $IncludeConfig directive to support wildcard filenames +- changed some multithreading synchronization --------------------------------------------------------------------------- Version 1.20.1 (rgerhards), 2007-12-12 - corrected a debug setting that survived release. Caused TCP connections diff --git a/syslogd.c b/syslogd.c index 0ed4065c..c67e0233 100644 --- a/syslogd.c +++ b/syslogd.c @@ -178,6 +178,10 @@ #include #include #include +#include +#include +#include + #ifndef __sun #endif @@ -3841,24 +3845,44 @@ finalize_it: static rsRetVal doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal) { DEFiRet; - uchar cfgFile[MAXFNAME]; + char pattern[MAXFNAME]; + char *cfgFile; + glob_t cfgFiles; + size_t i = 0; + struct stat fileInfo; assert(pp != NULL); assert(*pp != NULL); - if(getSubString(pp, (char*) cfgFile, sizeof(cfgFile) / sizeof(uchar), ' ') != 0) { + if(getSubString(pp, (char*) pattern, sizeof(pattern) / sizeof(char), ' ') != 0) { logerror("could not extract group name"); ABORT_FINALIZE(RS_RET_NOT_FOUND); } - if(*(cfgFile+strlen((char*) cfgFile) - 1) == '/') { - dbgprintf("requested to include directory '%s'\n", cfgFile); - iRet = doIncludeDirectory(cfgFile); - } else { - dbgprintf("Requested to include config file '%s'\n", cfgFile); - iRet = processConfFile(cfgFile); + /* Use GLOB_MARK to append a trailing slash for directories. + * Required by doIncludeDirectory(). + */ + glob(pattern, GLOB_MARK, NULL, &cfgFiles); + + for(i = 0; i < cfgFiles.gl_pathc; i++) { + cfgFile = cfgFiles.gl_pathv[i]; + + if(stat(cfgFile, &fileInfo) != 0) + continue; /* continue with the next file if we can't stat() the file */ + + if(S_ISREG(fileInfo.st_mode)) { /* config file */ + dbgprintf("requested to include config file '%s'\n", cfgFile); + iRet = processConfFile(cfgFile); + } else if(S_ISDIR(fileInfo.st_mode)) { /* config directory */ + dbgprintf("requested to include directory '%s'\n", cfgFile); + iRet = doIncludeDirectory(cfgFile); + } else { /* TODO: shall we handle symlinks or not? */ + dbgprintf("warning: unable to process IncludeConfig directive '%s'\n", cfgFile); + } } + globfree(&cfgFiles); + finalize_it: return iRet; } -- cgit From 26059b310e2e90a60873cba6a022a61e7999cab4 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 07:14:21 +0000 Subject: applied some more cleanup provided by Michael Biebl --- .cvsignore | 3 +++ omfwd.c | 3 --- plugins/ompgsql/.cvsignore | 4 ++-- syslogd.c | 5 +---- syslogd.h | 2 -- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.cvsignore b/.cvsignore index 405dee34..3a20ebfb 100644 --- a/.cvsignore +++ b/.cvsignore @@ -19,3 +19,6 @@ stamp-h1 rfc3195d rklogd rsyslogd +INSTALL +install-sh +missing diff --git a/omfwd.c b/omfwd.c index e310e6fc..6491aea4 100644 --- a/omfwd.c +++ b/omfwd.c @@ -67,9 +67,6 @@ #ifdef USE_GSSAPI #include "gss-misc.h" #endif -#ifdef USE_NETZIP -#include -#endif #ifdef SYSLOG_INET #define INET_SUSPEND_TIME 60 /* equal to 1 minute diff --git a/plugins/ompgsql/.cvsignore b/plugins/ompgsql/.cvsignore index 1281f785..9730646f 100644 --- a/plugins/ompgsql/.cvsignore +++ b/plugins/ompgsql/.cvsignore @@ -2,5 +2,5 @@ .libs Makefile Makefile.in -ommysql.la -ommysql_la-ommysql.lo +*.la +*.lo diff --git a/syslogd.c b/syslogd.c index c67e0233..6cf9d557 100644 --- a/syslogd.c +++ b/syslogd.c @@ -182,9 +182,6 @@ #include #include - -#ifndef __sun -#endif #include #include #include @@ -196,7 +193,7 @@ #include #endif -#if HAVE_PATHS_H +#if HAVE_PATHS_H #include #endif diff --git a/syslogd.h b/syslogd.h index c1d765eb..43d4f0ea 100644 --- a/syslogd.h +++ b/syslogd.h @@ -24,8 +24,6 @@ #include "objomsr.h" #ifdef USE_NETZIP -#include -#include /* config param: minimum message size to try compression. The smaller * the message, the less likely is any compression gain. We check for * gain before we submit the message. But to do so we still need to -- cgit From dce6853568b164dc015339fc6078ebd75f67346a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 07:16:25 +0000 Subject: cleaned up char/uchar issue --- syslogd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syslogd.c b/syslogd.c index 6cf9d557..45ff32bb 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3843,7 +3843,7 @@ static rsRetVal doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal) { DEFiRet; char pattern[MAXFNAME]; - char *cfgFile; + uchar *cfgFile; glob_t cfgFiles; size_t i = 0; struct stat fileInfo; @@ -3862,9 +3862,9 @@ static rsRetVal doIncludeLine(uchar **pp, __attribute__((unused)) void* pVal) glob(pattern, GLOB_MARK, NULL, &cfgFiles); for(i = 0; i < cfgFiles.gl_pathc; i++) { - cfgFile = cfgFiles.gl_pathv[i]; + cfgFile = (uchar*) cfgFiles.gl_pathv[i]; - if(stat(cfgFile, &fileInfo) != 0) + if(stat((char*) cfgFile, &fileInfo) != 0) continue; /* continue with the next file if we can't stat() the file */ if(S_ISREG(fileInfo.st_mode)) { /* config file */ -- cgit From 33a274f0258d6798f82aa16ddc2a77b718f81953 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 07:25:58 +0000 Subject: applied gss-api enhancement form varmojfekoj --- configure.ac | 1 - gss-misc.c | 10 +-- omfwd.c | 4 +- syslogd.c | 88 ++++++++++++++++++------ syslogd.h | 1 + tcpsyslog.c | 215 +++++++++++++++++++++++++++++++++++++++++++++++------------ tcpsyslog.h | 6 ++ 7 files changed, 253 insertions(+), 72 deletions(-) diff --git a/configure.ac b/configure.ac index 50685926..7a3ce7ea 100644 --- a/configure.ac +++ b/configure.ac @@ -147,7 +147,6 @@ AC_ARG_ENABLE(gssapi_krb5, if test $want_gssapi_krb5 = yes; then AC_CHECK_LIB(gssapi_krb5, gss_acquire_cred, [ AC_CHECK_HEADER(gssapi/gssapi.h, [ - AC_MSG_ERROR(GSS-API not ready for prime time yet -- wait for next release); AC_DEFINE(USE_GSSAPI,, Define if you want to use GSSAPI) gss_libs="-lgssapi_krb5" diff --git a/gss-misc.c b/gss-misc.c index 68197f01..7a09b1b9 100644 --- a/gss-misc.c +++ b/gss-misc.c @@ -85,12 +85,12 @@ static int read_all(int fd, char *buf, unsigned int nbyte) fd_set rfds; struct timeval tv; - FD_ZERO(&rfds); - FD_SET(fd, &rfds); - tv.tv_sec = 1; - tv.tv_usec = 0; - for (ptr = buf; nbyte; ptr += ret, nbyte -= ret) { + FD_ZERO(&rfds); + FD_SET(fd, &rfds); + tv.tv_sec = 1; + tv.tv_usec = 0; + if ((ret = select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) <= 0 || !FD_ISSET(fd, &rfds)) return ret; diff --git a/omfwd.c b/omfwd.c index 6491aea4..d773b23a 100644 --- a/omfwd.c +++ b/omfwd.c @@ -168,7 +168,7 @@ CODESTARTfreeInstance OM_uint32 maj_stat, min_stat; if (pData->gss_context != GSS_C_NO_CONTEXT) { - maj_stat = gss_delete_sec_context(&min_stat, pData->gss_context, GSS_C_NO_BUFFER); + maj_stat = gss_delete_sec_context(&min_stat, &pData->gss_context, GSS_C_NO_BUFFER); if (maj_stat != GSS_S_COMPLETE) display_status("deleting context", maj_stat, min_stat); } @@ -1143,7 +1143,7 @@ ENDqueryEtryPt #ifdef USE_GSSAPI -static rsRetVal setGSSMode(void *pVal, uchar *mode) +static rsRetVal setGSSMode(void __attribute__((unused)) *pVal, uchar *mode) { if (!strcmp((char *) mode, "none")) { gss_mode = GSSMODE_NONE; diff --git a/syslogd.c b/syslogd.c index 45ff32bb..a7e0003f 100644 --- a/syslogd.c +++ b/syslogd.c @@ -643,6 +643,10 @@ static struct AllowedSenders *pAllowedSenders_UDP = NULL; /* the roots of the al struct AllowedSenders *pAllowedSenders_TCP = NULL; /* lists. If NULL, all senders are ok! */ static struct AllowedSenders *pLastAllowedSenders_UDP = NULL; /* and now the pointers to the last */ static struct AllowedSenders *pLastAllowedSenders_TCP = NULL; /* element in the respective list */ +#ifdef USE_GSSAPI +struct AllowedSenders *pAllowedSenders_GSS = NULL; +static struct AllowedSenders *pLastAllowedSenders_GSS = NULL; +#endif #endif /* #ifdef SYSLOG_INET */ int option_DisallowWarning = 1; /* complain if message from disallowed sender is received */ @@ -940,12 +944,24 @@ static void PrintAllowedSenders(int iListToPrint) struct AllowedSenders *pSender; uchar szIP[64]; - assert((iListToPrint == 1) || (iListToPrint == 2)); + assert((iListToPrint == 1) || (iListToPrint == 2) +#ifdef USE_GSSAPI + || (iListToPrint == 3) +#endif + ); printf("\nAllowed %s Senders:\n", - (iListToPrint == 1) ? "UDP" : "TCP"); - pSender = (iListToPrint == 1) ? - pAllowedSenders_UDP : pAllowedSenders_TCP; + (iListToPrint == 1) ? "UDP" : +#ifdef USE_GSSAPI + (iListToPrint == 3) ? "GSS" : +#endif + "TCP"); + + pSender = (iListToPrint == 1) ? pAllowedSenders_UDP : +#ifdef USE_GSSAPI + (iListToPrint == 3) ? pAllowedSenders_GSS : +#endif + pAllowedSenders_TCP; if(pSender == NULL) { printf("\tNo restrictions set.\n"); } else { @@ -1068,7 +1084,6 @@ int isAllowedSender(struct AllowedSenders *pAllowRoot, struct sockaddr *pFrom, c if (MaskCmp (&(pAllow->allowedSender), pAllow->SignificantBits, pFrom, pszFromHost)) return 1; } - dbgprintf("%s is not an allowed sender\n", pszFromHost); return 0; } #endif /* #ifdef SYSLOG_INET */ @@ -1629,7 +1644,7 @@ void getCurrTime(struct syslogTime *t) static int usage(void) { fprintf(stderr, "usage: rsyslogd [-46AdhqQvw] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \ - " [-s domainlist] [-r[port]] [-tport[,max-sessions]] [-f conffile] [-i pidfile] [-x]\n"); + " [-s domainlist] [-r[port]] [-tport[,max-sessions]] [-gport[,max-sessions]] [-f conffile] [-i pidfile] [-x]\n"); exit(1); /* "good" exit - done to terminate usage() */ } @@ -3624,6 +3639,10 @@ static void die(int sig) if(sockTCPLstn != NULL && *sockTCPLstn) { deinit_tcp_listener(); } +#ifdef USE_GSSAPI + if(bEnableTCP & ALLOWEDMETHOD_GSS) + TCPSessGSSDeinit(); +#endif #endif /* Clean-up files. */ @@ -3714,6 +3733,11 @@ static rsRetVal addAllowedSenderLine(char* pName, uchar** ppRestOfConfLine) } else if(!strcasecmp(pName, "tcp")) { ppRoot = &pAllowedSenders_TCP; ppLast = &pLastAllowedSenders_TCP; +#ifdef USE_GSSAPI + } else if(!strcasecmp(pName, "gss")) { + ppRoot = &pAllowedSenders_GSS; + ppLast = &pLastAllowedSenders_GSS; +#endif } else { logerrorSz("Invalid protocol '%s' in allowed sender " "list, line ignored", pName); @@ -4217,6 +4241,9 @@ static void dbgPrintInitInfo(void) /* now the allowedSender lists: */ PrintAllowedSenders(1); /* UDP */ PrintAllowedSenders(2); /* TCP */ +#ifdef USE_GSSAPI + PrintAllowedSenders(3); /* GSS */ +#endif printf("\n"); #endif /* #ifdef SYSLOG_INET */ @@ -4370,9 +4397,19 @@ static void init(void) clearAllowedSenders (pAllowedSenders_TCP); pAllowedSenders_TCP = NULL; } +#ifdef USE_GSSAPI + if (pAllowedSenders_GSS != NULL) { + clearAllowedSenders (pAllowedSenders_GSS); + pAllowedSenders_GSS = NULL; + } +#endif } - assert(pAllowedSenders_UDP == NULL && pAllowedSenders_TCP == NULL); + assert(pAllowedSenders_UDP == NULL && pAllowedSenders_TCP == NULL +#ifdef USE_GSSAPI + && pAllowedSenders_GSS == NULL +#endif + ); #endif /* I was told by an IPv6 expert that calling getservbyname() seems to be * still valid, at least for the use case we have. So I re-enabled that @@ -4509,16 +4546,17 @@ static void init(void) * user-selectable option. rgerhards, 2007-06-21 */ # ifdef USE_GSSAPI - if(bEnableTCP == 2) { + if(bEnableTCP & ALLOWEDMETHOD_GSS) { if(TCPSessGSSInit()) { logerror("GSS-API initialization failed\n"); - bEnableTCP = -1; + bEnableTCP &= ~(ALLOWEDMETHOD_GSS); } } + if(bEnableTCP) # endif - if((sockTCPLstn = create_tcp_socket()) != NULL) { - dbgprintf("Opened %d syslog TCP port(s).\n", *sockTCPLstn); - } + if((sockTCPLstn = create_tcp_socket()) != NULL) { + dbgprintf("Opened %d syslog TCP port(s).\n", *sockTCPLstn); + } } } #endif @@ -5728,6 +5766,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se (struct sockaddr *)&frominet, (char*)fromHostFQDN)) { printchopped((char*)fromHost, line, l, finet[i+1], 1); } else { + dbgprintf("%s is not an allowed sender\n", (char*)fromHostFQDN); if(option_DisallowWarning) { logerrorSz("UDP message from disallowed sender %s discarded", (char*)fromHost); @@ -5752,7 +5791,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se if (FD_ISSET(sockTCPLstn[i+1], pReadfds)) { dbgprintf("New connect on TCP inetd socket: #%d\n", sockTCPLstn[i+1]); # ifdef USE_GSSAPI - if(bEnableTCP == 2) + if(bEnableTCP & ALLOWEDMETHOD_GSS) TCPSessGSSAccept(sockTCPLstn[i+1]); else # endif @@ -5773,14 +5812,15 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se /* Receive message */ # ifdef USE_GSSAPI - if(bEnableTCP == 2) + int allowedMethods = pTCPSessions[iTCPSess].allowedMethods; + if(allowedMethods & ALLOWEDMETHOD_GSS) state = TCPSessGSSRecv(iTCPSess, buf, sizeof(buf)); else # endif state = recv(fdSess, buf, sizeof(buf), 0); if(state == 0) { # ifdef USE_GSSAPI - if(bEnableTCP == 2) + if(allowedMethods & ALLOWEDMETHOD_GSS) TCPSessGSSClose(iTCPSess); else { # endif @@ -5795,7 +5835,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se logerrorInt("TCP session %d will be closed, error ignored\n", fdSess); # ifdef USE_GSSAPI - if(bEnableTCP == 2) + if(allowedMethods & ALLOWEDMETHOD_GSS) TCPSessGSSClose(iTCPSess); else # endif @@ -5810,7 +5850,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se "previous messages for reason(s)\n", iTCPSess); # ifdef USE_GSSAPI - if(bEnableTCP == 2) + if(allowedMethods & ALLOWEDMETHOD_GSS) TCPSessGSSClose(iTCPSess); else # endif @@ -6136,6 +6176,11 @@ static void printVersion(void) #else printf("\tSYSLOG_INET (Internet/remote support):\tNo\n"); #endif +#if defined(SYSLOG_INET) && defined(USE_GSSAPI) + printf("\tFEATURE_GSSAPI (GSSAPI Kerberos 5 support):\tYes\n"); +#else + printf("\tFEATURE_GSSAPI (GSSAPI Kerberos 5 support):\tNo\n"); +#endif #ifndef NDEBUG printf("\tFEATURE_DEBUG (debug build, slow code):\tYes\n"); #else @@ -6282,8 +6327,9 @@ int main(int argc, char **argv) break; case 'g': /* enable tcp gssapi logging */ #if defined(SYSLOG_INET) && defined(USE_GSSAPI) - configureTCPListen(optarg); - bEnableTCP = 2; + if (!bEnableTCP) + configureTCPListen(optarg); + bEnableTCP |= ALLOWEDMETHOD_GSS; #else fprintf(stderr, "rsyslogd: -g not valid - not compiled with gssapi support"); #endif @@ -6341,7 +6387,9 @@ int main(int argc, char **argv) break; case 't': /* enable tcp logging */ #ifdef SYSLOG_INET - configureTCPListen(optarg); + if (!bEnableTCP) + configureTCPListen(optarg); + bEnableTCP |= ALLOWEDMETHOD_TCP; #else fprintf(stderr, "rsyslogd: -t not valid - not compiled with network support"); #endif diff --git a/syslogd.h b/syslogd.h index 43d4f0ea..aefe13b0 100644 --- a/syslogd.h +++ b/syslogd.h @@ -79,6 +79,7 @@ extern char **StripDomains; extern char *LocalDomain; extern int bDropMalPTRMsgs; extern struct AllowedSenders *pAllowedSenders_TCP; +extern struct AllowedSenders *pAllowedSenders_GSS; extern char ctty[]; #endif /* #ifndef SYSLOGD_H_INCLUDED */ diff --git a/tcpsyslog.c b/tcpsyslog.c index c2591663..1891505c 100644 --- a/tcpsyslog.c +++ b/tcpsyslog.c @@ -77,7 +77,7 @@ int *sockTCPLstn = NULL; /* read-only after startup, modified by restart */ struct TCPSession *pTCPSessions; /* The thread-safeness of the sesion table is doubtful */ #ifdef USE_GSSAPI -static gss_cred_id_t gss_server_creds; +static gss_cred_id_t gss_server_creds = GSS_C_NO_CREDENTIAL; char *gss_listen_service_name = NULL; #endif @@ -99,7 +99,6 @@ void configureTCPListen(char *cOptarg) register char *pArg = cOptarg; assert(cOptarg != NULL); - bEnableTCP = -1; /* enable TCP listening */ /* extract port */ i = 0; @@ -166,6 +165,7 @@ static int TCPSessInit(void) #ifdef USE_GSSAPI pTCPSessions[i].gss_flags = 0; pTCPSessions[i].gss_context = GSS_C_NO_CONTEXT; + pTCPSessions[i].allowedMethods = 0; #endif } return(0); @@ -229,7 +229,7 @@ void deinit_tcp_listener(void) close(fd); free(pTCPSessions[iTCPSess].fromHost); #ifdef USE_GSSAPI - if(bEnableTCP == 2) { + if(bEnableTCP & ALLOWEDMETHOD_GSS) { OM_uint32 maj_stat, min_stat; maj_stat = gss_delete_sec_context(&min_stat, &pTCPSessions[iTCPSess].gss_context, GSS_C_NO_BUFFER); if (maj_stat != GSS_S_COMPLETE) @@ -420,6 +420,7 @@ int TCPSessAccept(int fd) uchar fromHost[NI_MAXHOST]; uchar fromHostFQDN[NI_MAXHOST]; char *pBuf; + char allowedMethods = 0; newConn = accept(fd, (struct sockaddr*) &addr, &addrlen); if (newConn < 0) { @@ -453,7 +454,21 @@ int TCPSessAccept(int fd) * configured to do this). * rgerhards, 2005-09-26 */ - if(!isAllowedSender(pAllowedSenders_TCP, (struct sockaddr *)&addr, (char*)fromHostFQDN)) { +#ifdef USE_GSSAPI + if((bEnableTCP & ALLOWEDMETHOD_TCP) && + isAllowedSender(pAllowedSenders_TCP, (struct sockaddr *)&addr, (char*)fromHostFQDN)) + allowedMethods |= ALLOWEDMETHOD_TCP; + if((bEnableTCP & ALLOWEDMETHOD_GSS) && + isAllowedSender(pAllowedSenders_GSS, (struct sockaddr *)&addr, (char*)fromHostFQDN)) + allowedMethods |= ALLOWEDMETHOD_GSS; + if(allowedMethods) + pTCPSessions[iSess].allowedMethods = allowedMethods; + else +#else + if(!isAllowedSender(pAllowedSenders_TCP, (struct sockaddr *)&addr, (char*)fromHostFQDN)) +#endif + { + dbgprintf("%s is not an allowed sender\n", (char *) fromHostFQDN); if(option_DisallowWarning) { errno = 0; logerrorSz("TCP message from disallowed sender %s discarded", @@ -706,7 +721,10 @@ int TCPSessGSSInit(void) gss_buffer_desc name_buf; gss_name_t server_name; OM_uint32 maj_stat, min_stat; - + + if (gss_server_creds != GSS_C_NO_CREDENTIAL) + return 0; + name_buf.value = (gss_listen_service_name == NULL) ? "host" : gss_listen_service_name; name_buf.length = strlen(name_buf.value) + 1; maj_stat = gss_import_name(&min_stat, &name_buf, GSS_C_NT_HOSTBASED_SERVICE, &server_name); @@ -733,60 +751,159 @@ int TCPSessGSSAccept(int fd) { gss_buffer_desc send_tok, recv_tok; gss_name_t client; - gss_OID doid; OM_uint32 maj_stat, min_stat, acc_sec_min_stat; int iSess; gss_ctx_id_t *context; OM_uint32 *sess_flags; int fdSess; + char allowedMethods; if ((iSess = TCPSessAccept(fd)) == -1) return -1; - context = &pTCPSessions[iSess].gss_context; - *context = GSS_C_NO_CONTEXT; - sess_flags = &pTCPSessions[iSess].gss_flags; - fdSess = pTCPSessions[iSess].sock; - - do { - if (recv_token(fdSess, &recv_tok) <= 0) - return -1; - - maj_stat = gss_accept_sec_context(&acc_sec_min_stat, context, gss_server_creds, - &recv_tok, GSS_C_NO_CHANNEL_BINDINGS, &client, - NULL, &send_tok, sess_flags, NULL, NULL); - if (recv_tok.value) { - free(recv_tok.value); - recv_tok.value = NULL; - } - if (send_tok.length != 0) { - if (send_token(fdSess, &send_tok) < 0) { + allowedMethods = pTCPSessions[iSess].allowedMethods; + if (allowedMethods & ALLOWEDMETHOD_GSS) { + /* Buffer to store raw message in case that + * gss authentication fails halfway through. + */ + char buf[MAXLINE]; + int ret = 0; + + dbgprintf("GSS-API Trying to accept TCP session %d\n", iSess); + + fdSess = pTCPSessions[iSess].sock; + if (allowedMethods & ALLOWEDMETHOD_TCP) { + int len; + fd_set fds; + struct timeval tv; + + do { + FD_ZERO(&fds); + FD_SET(fdSess, &fds); + tv.tv_sec = 1; + tv.tv_usec = 0; + ret = select(fdSess + 1, &fds, NULL, NULL, &tv); + } while (ret < 0 && errno == EINTR); + if (ret < 0) { + logerrorInt("TCP session %d will be closed, error ignored\n", iSess); + TCPSessClose(iSess); return -1; + } else if (ret == 0) { + dbgprintf("GSS-API Reverting to plain TCP\n"); + pTCPSessions[iSess].allowedMethods = ALLOWEDMETHOD_TCP; + return 0; } - gss_release_buffer(&min_stat, &send_tok); - } - if (maj_stat != GSS_S_COMPLETE - && maj_stat != GSS_S_CONTINUE_NEEDED) { - display_status("accepting context", maj_stat, - acc_sec_min_stat); - if (*context != GSS_C_NO_CONTEXT) - gss_delete_sec_context(&min_stat, context, - GSS_C_NO_BUFFER); - return -1; - } - } while (maj_stat == GSS_S_CONTINUE_NEEDED); + do { + ret = recv(fdSess, buf, sizeof (buf), MSG_PEEK); + } while (ret < 0 && errno == EINTR); + if (ret <= 0) { + if (ret == 0) + dbgprintf("GSS-API Connection closed by peer\n"); + else + logerrorInt("TCP session %d will be closed, error ignored\n", iSess); + TCPSessClose(iSess); + return -1; + } - maj_stat = gss_display_name(&min_stat, client, &recv_tok, NULL); - if (maj_stat != GSS_S_COMPLETE) - display_status("displaying name", maj_stat, min_stat); - gss_release_name(&min_stat, &client); + if (ret < 4) { + dbgprintf("GSS-API Reverting to plain TCP\n"); + pTCPSessions[iSess].allowedMethods = ALLOWEDMETHOD_TCP; + return 0; + } else if (ret == 4) { + /* The client might has been interupted after sending + * the data length (4B), give him another chance. + */ + sleep(1); + do { + ret = recv(fdSess, buf, sizeof (buf), MSG_PEEK); + } while (ret < 0 && errno == EINTR); + if (ret <= 0) { + if (ret == 0) + dbgprintf("GSS-API Connection closed by peer\n"); + else + logerrorInt("TCP session %d will be closed, error ignored\n", iSess); + TCPSessClose(iSess); + return -1; + } + } - dbgprintf("GSS-API Accepted connection from: %s\n", recv_tok.value); - gss_release_buffer(&min_stat, &recv_tok); + len = ntohl((buf[0] << 24) + | (buf[1] << 16) + | (buf[2] << 8) + | buf[3]); + if ((ret - 4) < len || len == 0) { + dbgprintf("GSS-API Reverting to plain TCP\n"); + pTCPSessions[iSess].allowedMethods = ALLOWEDMETHOD_TCP; + return 0; + } + } - dbgprintf("GSS-API Provided context flags:\n"); - display_ctx_flags(*sess_flags); + context = &pTCPSessions[iSess].gss_context; + *context = GSS_C_NO_CONTEXT; + sess_flags = &pTCPSessions[iSess].gss_flags; + do { + if (recv_token(fdSess, &recv_tok) <= 0) { + logerrorInt("TCP session %d will be closed, error ignored\n", iSess); + TCPSessClose(iSess); + return -1; + } + maj_stat = gss_accept_sec_context(&acc_sec_min_stat, context, gss_server_creds, + &recv_tok, GSS_C_NO_CHANNEL_BINDINGS, &client, + NULL, &send_tok, sess_flags, NULL, NULL); + if (recv_tok.value) { + free(recv_tok.value); + recv_tok.value = NULL; + } + if (maj_stat != GSS_S_COMPLETE + && maj_stat != GSS_S_CONTINUE_NEEDED) { + gss_release_buffer(&min_stat, &send_tok); + if (*context != GSS_C_NO_CONTEXT) + gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER); + if ((allowedMethods & ALLOWEDMETHOD_TCP) && + (GSS_ROUTINE_ERROR(maj_stat) == GSS_S_DEFECTIVE_TOKEN)) { + dbgprintf("GSS-API Reverting to plain TCP\n"); + dbgprintf("tcp session socket with new data: #%d\n", fdSess); + if(TCPSessDataRcvd(iSess, buf, ret) == 0) { + logerrorInt("Tearing down TCP Session %d - see " + "previous messages for reason(s)\n", + iSess); + TCPSessClose(iSess); + return -1; + } + pTCPSessions[iSess].allowedMethods = ALLOWEDMETHOD_TCP; + return 0; + } + display_status("accepting context", maj_stat, + acc_sec_min_stat); + TCPSessClose(iSess); + return -1; + } + if (send_tok.length != 0) { + if (send_token(fdSess, &send_tok) < 0) { + gss_release_buffer(&min_stat, &send_tok); + logerrorInt("TCP session %d will be closed, error ignored\n", iSess); + if (*context != GSS_C_NO_CONTEXT) + gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER); + TCPSessClose(iSess); + return -1; + } + gss_release_buffer(&min_stat, &send_tok); + } + } while (maj_stat == GSS_S_CONTINUE_NEEDED); + + maj_stat = gss_display_name(&min_stat, client, &recv_tok, NULL); + if (maj_stat != GSS_S_COMPLETE) + display_status("displaying name", maj_stat, min_stat); + else + dbgprintf("GSS-API Accepted connection from: %s\n", recv_tok.value); + gss_release_name(&min_stat, &client); + gss_release_buffer(&min_stat, &recv_tok); + + dbgprintf("GSS-API Provided context flags:\n"); + display_ctx_flags(*sess_flags); + pTCPSessions[iSess].allowedMethods = ALLOWEDMETHOD_GSS; + } return 0; } @@ -845,9 +962,19 @@ void TCPSessGSSClose(int iSess) { display_status("deleting context", maj_stat, min_stat); *context = GSS_C_NO_CONTEXT; pTCPSessions[iSess].gss_flags = 0; + pTCPSessions[iSess].allowedMethods = 0; TCPSessClose(iSess); } + + +void TCPSessGSSDeinit(void) { + OM_uint32 maj_stat, min_stat; + + maj_stat = gss_release_cred(&min_stat, &gss_server_creds); + if (maj_stat != GSS_S_COMPLETE) + display_status("releasing credentials", maj_stat, min_stat); +} #endif /* #ifdef USE_GSSAPI */ diff --git a/tcpsyslog.h b/tcpsyslog.h index f8e2fa94..a68e8934 100644 --- a/tcpsyslog.h +++ b/tcpsyslog.h @@ -39,6 +39,7 @@ struct TCPSession { #if defined(SYSLOG_INET) && defined(USE_GSSAPI) OM_uint32 gss_flags; gss_ctx_id_t gss_context; + char allowedMethods; #endif }; @@ -49,8 +50,12 @@ extern int bEnableTCP; extern struct TCPSession *pTCPSessions; #if defined(SYSLOG_INET) && defined(USE_GSSAPI) extern char *gss_listen_service_name; + +#define ALLOWEDMETHOD_GSS 2 #endif +#define ALLOWEDMETHOD_TCP 1 + /* prototypes */ void deinit_tcp_listener(void); int *create_tcp_socket(void); @@ -65,6 +70,7 @@ int TCPSessGSSInit(void); int TCPSessGSSAccept(int fd); int TCPSessGSSRecv(int fd, void *buf, size_t buf_len); void TCPSessGSSClose(int sess); +void TCPSessGSSDeinit(void); #endif #endif /* #ifndef TCPSYSLOG_H_INCLUDED */ -- cgit From 16a542ae6a7b22f6bde5796d6aa7f6cafa474fb0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 07:35:10 +0000 Subject: changed version number back to 1.21.1 because we have too many changes to make this the first stable v2. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7a3ce7ea..0039eacc 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[1.21.0],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) -- cgit From dc0e50e2ac427bf7b4c819da5cf0b57c1dc3bdb5 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 07:55:48 +0000 Subject: updated version number --- doc/status.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/status.html b/doc/status.html index b401a1eb..7d69fb50 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,9 +4,9 @@

rsyslog status page

-

This page reflects the status as of 2007-12-07.

+

This page reflects the status as of 2007-12-19.

Current Releases

-

development: 1.20.0 - +

development: 1.21.0 - change log - download

stable: 1.0.5 - change log - -- cgit From 6a4ab6d26e3a5b9e90c1b1e1a6bca42c79a6f06e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 08:09:17 +0000 Subject: preparing for 1.21.0 release --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e2ef8832..c1f26060 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- -Version 1.20.2 (rgerhards), 2007-12-?? +Version 1.21.0 (rgerhards), 2007-12-19 +- GSS-API support for syslog/TCP connections was added. Thanks to + varmojfekoj for providing the patch with this functionality - code cleanup - enhanced $IncludeConfig directive to support wildcard filenames - changed some multithreading synchronization -- cgit From 31e8d16375165c35e526f86ba425dee1559bd115 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 08:12:32 +0000 Subject: prepared for 1.21.0 release --- doc/features.html | 1 + doc/status.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/features.html b/doc/features.html index e3685d1e..2899cd76 100644 --- a/doc/features.html +++ b/doc/features.html @@ -46,6 +46,7 @@ is going on, you can also subscribe to the change log - -download

+change log - +download

stable: 1.0.5 - change log - download

 (How are versions named?)

-- cgit From e658ff8c43db22daee54dd70f2796cbded268353 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 08:29:58 +0000 Subject: updated $IncludeConfig directive --- doc/rsconf1_includeconfig.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/rsconf1_includeconfig.html b/doc/rsconf1_includeconfig.html index 155dcd44..cd8d8a50 100644 --- a/doc/rsconf1_includeconfig.html +++ b/doc/rsconf1_includeconfig.html @@ -32,6 +32,9 @@ with the /etc/rsyslog.conf file directly.

$IncludeConfig /etc/some-included-file.conf

Directories can also be included. To do so, the name must end on a slash:

$IncludeConfig /etc/rsyslog.d/

+

And finally, only specific files matching a wildcard my be included +from a directory:

+

$IncludeConfig /etc/rsyslog.d/*.conf

[rsyslog.conf overview] [manual index] [rsyslog site]

-- cgit From f4c2ccaf4ad673c5150b9d0fa9cae1ae0a69f85e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 08:49:10 +0000 Subject: fixed description, didn't remove now-irrelevant part --- doc/rsconf1_includeconfig.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/rsconf1_includeconfig.html b/doc/rsconf1_includeconfig.html index cd8d8a50..24462f77 100644 --- a/doc/rsconf1_includeconfig.html +++ b/doc/rsconf1_includeconfig.html @@ -27,13 +27,12 @@ Upon uninstallation, the file could be easily removed again. This approach
would be much cleaner and less error prone, than having to munge around
with the /etc/rsyslog.conf file directly.

-

Please note that in this description, only "*.conf" files would be read. The actual implementation, however, reads all files except for those starting with a dot. If you find this is a real big problem, please complain.

Sample:

$IncludeConfig /etc/some-included-file.conf

Directories can also be included. To do so, the name must end on a slash:

$IncludeConfig /etc/rsyslog.d/

-

And finally, only specific files matching a wildcard my be included -from a directory:

+

And finally, only specific files matching a wildcard my be included +from a directory:

$IncludeConfig /etc/rsyslog.d/*.conf

[rsyslog.conf overview] [manual -- cgit From 9bf43f592d7e367db09d10e0d0e17060412f2400 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 08:50:40 +0000 Subject: bumped version number --- ChangeLog | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c1f26060..d2d0483f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ --------------------------------------------------------------------------- +Version 2.0.0 (rgerhards), 2007-12-?? +- small doc fix for $IncludeConfig +--------------------------------------------------------------------------- Version 1.21.0 (rgerhards), 2007-12-19 - GSS-API support for syslog/TCP connections was added. Thanks to varmojfekoj for providing the patch with this functionality diff --git a/configure.ac b/configure.ac index 0039eacc..7a3ce7ea 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[1.21.0],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) -- cgit From d21a445561d365e3345cdbce40e39ab6340bff9a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 11:54:03 +0000 Subject: added forward-compatibility fix, reserved -c command line option --- syslogd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syslogd.c b/syslogd.c index a7e0003f..9285e727 100644 --- a/syslogd.c +++ b/syslogd.c @@ -6292,7 +6292,7 @@ int main(int argc, char **argv) /* END core initializations */ - while ((ch = getopt(argc, argv, "46Aa:dehi:f:g:l:m:nop:qQr::s:t:u:vwx")) != EOF) { + while ((ch = getopt(argc, argv, "46Aa:c:dehi:f:g:l:m:nop:qQr::s:t:u:vwx")) != EOF) { switch((char)ch) { case '4': family = PF_INET; @@ -6316,6 +6316,9 @@ int main(int argc, char **argv) else fprintf(stderr, "rsyslogd: Out of descriptors, ignoring %s\n", optarg); break; + case 'c': /* forward-compatibility: sets mode in v3+ */ + fprintf(stderr, "-c option not yet supported, reserved for future use\n"); + break; case 'd': /* debug */ Debug = 1; break; -- cgit From bf1713a5d0b11d2200559b98a71431f1e0657d6d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 19 Dec 2007 13:44:47 +0000 Subject: bugfix: llDestroy() left the list with invalid root/last pointers --- ChangeLog | 1 + linkedlist.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index d2d0483f..b1a87f13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ --------------------------------------------------------------------------- Version 2.0.0 (rgerhards), 2007-12-?? - small doc fix for $IncludeConfig +- fixed a bug in llDestroy() --------------------------------------------------------------------------- Version 1.21.0 (rgerhards), 2007-12-19 - GSS-API support for syslog/TCP connections was added. Thanks to diff --git a/linkedlist.c b/linkedlist.c index bea2cb90..27d6db36 100644 --- a/linkedlist.c +++ b/linkedlist.c @@ -104,6 +104,9 @@ rsRetVal llDestroy(linkedList_t *pThis) llDestroyElt(pThis, pEltPrev); } + pThis->pRoot = NULL; + pThis->pLast = NULL; + return iRet; } -- cgit From 177eb0ec5d444537dd11c1dde3a20189d1e3ba71 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 20 Dec 2007 07:48:56 +0000 Subject: bugfix: fixing memory leak when message queue is full and during parsing. Thanks to varmojfekoj for the patch. --- ChangeLog | 2 ++ syslogd.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1a87f13..b5a69f9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Version 2.0.0 (rgerhards), 2007-12-?? - small doc fix for $IncludeConfig - fixed a bug in llDestroy() +- bugfix: fixing memory leak when message queue is full and during + parsing. Thanks to varmojfekoj for the patch. --------------------------------------------------------------------------- Version 1.21.0 (rgerhards), 2007-12-19 - GSS-API support for syslog/TCP connections was added. Thanks to diff --git a/syslogd.c b/syslogd.c index 9285e727..963185c6 100644 --- a/syslogd.c +++ b/syslogd.c @@ -2824,6 +2824,7 @@ static void enqueueMsg(msg_t *pMsg) if(pthread_cond_timedwait (fifo->notFull, fifo->mut, &t) != 0) { dbgprintf("enqueueMsg: cond timeout, dropping message!\n"); + MsgDestruct(pMsg); goto unlock; } } @@ -3030,6 +3031,7 @@ static int parseRFCSyslogMsg(msg_t *pMsg, int flags) /* MSG */ MsgSetMSG(pMsg, p2parse); + free(pBuf); return 0; /* all ok */ } /* parse a legay-formatted syslog message. This function returns @@ -3249,13 +3251,17 @@ logmsg(int pri, msg_t *pMsg, int flags) if(msg[0] == '1' && msg[1] == ' ') { dbgprintf("Message has syslog-protocol format.\n"); setProtocolVersion(pMsg, 1); - if(parseRFCSyslogMsg(pMsg, flags) == 1) + if(parseRFCSyslogMsg(pMsg, flags) == 1) { + MsgDestruct(pMsg); return; + } } else { /* we have legacy syslog */ dbgprintf("Message has legacy syslog format.\n"); setProtocolVersion(pMsg, 0); - if(parseLegacySyslogMsg(pMsg, flags) == 1) + if(parseLegacySyslogMsg(pMsg, flags) == 1) { + MsgDestruct(pMsg); return; + } } /* ---------------------- END PARSING ---------------- */ -- cgit From 76007a666e17d9456cd7e3864f4e23223fae94c3 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 20 Dec 2007 09:54:04 +0000 Subject: bugfix: when compiled without network support, unix sockets were not properly closed --- ChangeLog | 2 ++ syslogd.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b5a69f9b..c34cd768 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Version 2.0.0 (rgerhards), 2007-12-?? - fixed a bug in llDestroy() - bugfix: fixing memory leak when message queue is full and during parsing. Thanks to varmojfekoj for the patch. +- bugfix: when compiled without network support, unix sockets were + not properply closed --------------------------------------------------------------------------- Version 1.21.0 (rgerhards), 2007-12-19 - GSS-API support for syslog/TCP connections was added. Thanks to diff --git a/syslogd.c b/syslogd.c index 963185c6..3c37b991 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3634,11 +3634,11 @@ static void die(int sig) #endif /* now clean up the listener part */ -#ifdef SYSLOG_INET /* Close the UNIX sockets. */ for (i = 0; i < nfunix; i++) if (funix[i] != -1) close(funix[i]); +#ifdef SYSLOG_INET /* Close the UDP inet socket. */ closeUDPListenSockets(); /* Close the TCP inet socket. */ -- cgit From ee9b196128db5c6a30918c795f5adcdd2adaca45 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 20 Dec 2007 11:15:38 +0000 Subject: bugfix: memory leak in cfsysline.c/doGetWord() fixed --- ChangeLog | 1 + cfsysline.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c34cd768..7bfa8fc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ Version 2.0.0 (rgerhards), 2007-12-?? parsing. Thanks to varmojfekoj for the patch. - bugfix: when compiled without network support, unix sockets were not properply closed +- bugfix: memory leak in cfsysline.c/doGetWord() fixed --------------------------------------------------------------------------- Version 1.21.0 (rgerhards), 2007-12-19 - GSS-API support for syslog/TCP connections was added. Thanks to diff --git a/cfsysline.c b/cfsysline.c index 14f50927..cf5def0a 100644 --- a/cfsysline.c +++ b/cfsysline.c @@ -353,6 +353,13 @@ finalize_it: * a pointer to a string which is to receive the option * value. The returned string must be freed by the caller. * rgerhards, 2007-09-07 + * To facilitate multiple instances of the same command line + * directive, doGetWord() now checks if pVal is already a + * non-NULL pointer. If so, we assume it was created by a previous + * incarnation and is automatically freed. This happens only when + * no custom handler is defined. If it is, the customer handler + * must do the cleanup. I have checked and this was al also memory + * leak with some code. Obviously, not a large one. -- rgerhards, 2007-12-20 */ static rsRetVal doGetWord(uchar **pp, rsRetVal (*pSetHdlr)(void*, uchar*), void *pVal) { @@ -381,7 +388,9 @@ static rsRetVal doGetWord(uchar **pp, rsRetVal (*pSetHdlr)(void*, uchar*), void /* we got the word, now set it */ if(pSetHdlr == NULL) { /* we should set value directly to var */ - *((uchar**)pVal) = pNewVal; + if(pVal != NULL) + free(pVal); /* free previous entry */ + *((uchar**)pVal) = pNewVal; /* set new one */ } else { /* we set value via a set function */ CHKiRet(pSetHdlr(pVal, pNewVal)); -- cgit From 89afe21362f446b50f4f8b360697a0a9568ac80a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 20 Dec 2007 11:26:46 +0000 Subject: previous fix had a problem - corrected --- cfsysline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cfsysline.c b/cfsysline.c index cf5def0a..c4d81438 100644 --- a/cfsysline.c +++ b/cfsysline.c @@ -388,8 +388,8 @@ static rsRetVal doGetWord(uchar **pp, rsRetVal (*pSetHdlr)(void*, uchar*), void /* we got the word, now set it */ if(pSetHdlr == NULL) { /* we should set value directly to var */ - if(pVal != NULL) - free(pVal); /* free previous entry */ + if(*((uchar**)pVal) != NULL) + free(*((uchar**)pVal)); /* free previous entry */ *((uchar**)pVal) = pNewVal; /* set new one */ } else { /* we set value via a set function */ -- cgit From 846b6e11662256c9fc04a96aa6ebf2afbd5975d1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 23 Dec 2007 17:10:09 +0000 Subject: preparing for 1.21.1 --- ChangeLog | 2 +- configure.ac | 2 +- doc/status.html | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7bfa8fc2..4032842b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 2.0.0 (rgerhards), 2007-12-?? +Version 1.21.1 (rgerhards), 2007-12-23 - small doc fix for $IncludeConfig - fixed a bug in llDestroy() - bugfix: fixing memory leak when message queue is full and during diff --git a/configure.ac b/configure.ac index 7a3ce7ea..21e883df 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[1.21.1],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/doc/status.html b/doc/status.html index f56422e8..f950d682 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,11 +4,11 @@

rsyslog status page

-

This page reflects the status as of 2007-12-19.

+

This page reflects the status as of 2007-12-23.

Current Releases

-

development: 1.21.0 - -change log - -download

+

development: 1.21.1 - +change log - +download

stable: 1.0.5 - change log - download

 (How are versions named?)

-- cgit From f383030d3bfb9ea560c6377a5f3655c4c486fd2b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 26 Dec 2007 10:01:19 +0000 Subject: bumped version number once again to 2.0.0 - let's see if it works out this time ;) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 21e883df..7a3ce7ea 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[1.21.1],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) -- cgit From 99936729cdd81a628b61e62197069ab2e3ea7a58 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 26 Dec 2007 10:01:40 +0000 Subject: moved cross-platform define for AI_NUMERICSERV to net.h --- ChangeLog | 3 +++ net.h | 13 +++++++++++++ syslogd.c | 13 ------------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4032842b..f6af3d9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ --------------------------------------------------------------------------- +Version 2.0.0 (rgerhards), 2007-12-26 +- increased portability for older platforms (AI_NUMERICSERV moved) +--------------------------------------------------------------------------- Version 1.21.1 (rgerhards), 2007-12-23 - small doc fix for $IncludeConfig - fixed a bug in llDestroy() diff --git a/net.h b/net.h index 1164e33f..8eab9196 100644 --- a/net.h +++ b/net.h @@ -71,5 +71,18 @@ static inline size_t SALEN(struct sockaddr *sa) { rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN); +/* IPv6 compatibility layer for older platforms + * We need to handle a few things different if we are running + * on an older platform which does not support all the glory + * of IPv6. We try to limit toll on features and reliability, + * but obviously it is better to run rsyslog on a platform that + * supports everything... + * rgerhards, 2007-06-22 + */ +#ifndef AI_NUMERICSERV +# define AI_NUMERICSERV 0 +#endif + + #endif /* #ifdef SYSLOG_INET */ #endif /* #ifndef INCLUDED_NET_H */ diff --git a/syslogd.c b/syslogd.c index 3c37b991..c562b4ed 100644 --- a/syslogd.c +++ b/syslogd.c @@ -311,19 +311,6 @@ #endif -/* IPv6 compatibility layer for older platforms - * We need to handle a few things different if we are running - * on an older platform which does not support all the glory - * of IPv6. We try to limit toll on features and reliability, - * but obviously it is better to run rsyslog on a platform that - * supports everything... - * rgerhards, 2007-06-22 - */ -#ifndef AI_NUMERICSERV -# define AI_NUMERICSERV 0 -#endif - - static uchar *ConfFile = (uchar*) _PATH_LOGCONF; /* read-only after startup */ static char *PidFile = _PATH_LOGPID; /* read-only after startup */ static uchar *pModDir = NULL; /* read-only after startup */ -- cgit From 57ebcb05f5510ba6ac41875e5363987766acd938 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 26 Dec 2007 17:32:43 +0000 Subject: removed socket leak in omfwd.c --- ChangeLog | 1 + omfwd.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index f6af3d9f..bc9a7e70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ --------------------------------------------------------------------------- Version 2.0.0 (rgerhards), 2007-12-26 - increased portability for older platforms (AI_NUMERICSERV moved) +- removed socket leak in omfwd.c --------------------------------------------------------------------------- Version 1.21.1 (rgerhards), 2007-12-23 - small doc fix for $IncludeConfig diff --git a/omfwd.c b/omfwd.c index d773b23a..16f30f16 100644 --- a/omfwd.c +++ b/omfwd.c @@ -181,6 +181,9 @@ CODESTARTfreeInstance gss_base_service_name = NULL; } # endif + /* final cleanup */ + if(pData->sock >= 0) + close(pData->sock); ENDfreeInstance -- cgit From 25f911954f1c2a72dade9dff5d1ebeb8be2d0783 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 27 Dec 2007 13:04:38 +0000 Subject: applied cross-platform patch from darix to facilitate GSS-API compile on more platforms --- gss-misc.c | 2 +- gss-misc.h | 2 +- omfwd.c | 2 +- tcpsyslog.c | 2 +- tcpsyslog.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gss-misc.c b/gss-misc.c index 7a09b1b9..93642520 100644 --- a/gss-misc.c +++ b/gss-misc.c @@ -19,7 +19,7 @@ #else #include #endif -#include +#include #include "syslogd.h" #include "syslogd-types.h" #include "srUtils.h" diff --git a/gss-misc.h b/gss-misc.h index 9c879d1c..caf19ef7 100644 --- a/gss-misc.h +++ b/gss-misc.h @@ -1,7 +1,7 @@ #ifndef GSS_MISC_H_INCLUDED #define GSS_MISC_H_INCLUDED 1 -#include +#include int recv_token(int s, gss_buffer_t tok); int send_token(int s, gss_buffer_t tok); diff --git a/omfwd.c b/omfwd.c index 16f30f16..dc530776 100644 --- a/omfwd.c +++ b/omfwd.c @@ -52,7 +52,7 @@ #include #endif #ifdef USE_GSSAPI -#include +#include #endif #include "syslogd.h" #include "syslogd-types.h" diff --git a/tcpsyslog.c b/tcpsyslog.c index 1891505c..a6d7322b 100644 --- a/tcpsyslog.c +++ b/tcpsyslog.c @@ -43,7 +43,7 @@ #include #endif #if defined(SYSLOG_INET) && defined(USE_GSSAPI) -#include +#include #endif #include "syslogd.h" #include "syslogd-types.h" diff --git a/tcpsyslog.h b/tcpsyslog.h index a68e8934..68b4a9c1 100644 --- a/tcpsyslog.h +++ b/tcpsyslog.h @@ -25,7 +25,7 @@ #define TCPSYSLOG_H_INCLUDED 1 #if defined(SYSLOG_INET) && defined(USE_GSSAPI) -#include +#include #endif struct TCPSession { -- cgit From 78544a417cbc290d56bb2e0e6a07b3f6b0a2b3af Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 28 Dec 2007 17:52:37 +0000 Subject: backported rsyslog v3 omgssapi - to provide forward compatibility from v2 to v3. Will release as v1.21.2, because some field experience is needed before it becomes stable v2. --- ChangeLog | 2 + Makefile.am | 5 + configure.ac | 5 +- omfwd.c | 639 ++++------------------------------- plugins/omgssapi/.cvsignore | 6 + plugins/omgssapi/Makefile.am | 6 + plugins/omgssapi/omgssapi.c | 771 +++++++++++++++++++++++++++++++++++++++++++ rsyslog.h | 4 + tcpsyslog.c | 276 ++++++++++++++++ tcpsyslog.h | 6 + 10 files changed, 1146 insertions(+), 574 deletions(-) create mode 100644 plugins/omgssapi/.cvsignore create mode 100644 plugins/omgssapi/Makefile.am create mode 100644 plugins/omgssapi/omgssapi.c diff --git a/ChangeLog b/ChangeLog index bc9a7e70..63ac7b4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Version 2.0.0 (rgerhards), 2007-12-26 - increased portability for older platforms (AI_NUMERICSERV moved) - removed socket leak in omfwd.c +- cross-platform patch for GSS-API compile problem on some platforms + thanks to darix for the patch! --------------------------------------------------------------------------- Version 1.21.1 (rgerhards), 2007-12-23 - small doc fix for $IncludeConfig diff --git a/Makefile.am b/Makefile.am index 1e6cf5a6..6c1b24bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -83,6 +83,11 @@ EXTRA_DIST = \ SUBDIRS = doc + +if ENABLE_GSSAPI +SUBDIRS += plugins/omgssapi +endif + if ENABLE_MYSQL SUBDIRS += plugins/ommysql endif diff --git a/configure.ac b/configure.ac index 7a3ce7ea..03e285a3 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[1.21.2],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) @@ -154,6 +154,7 @@ if test $want_gssapi_krb5 = yes; then ]) ]) fi +AM_CONDITIONAL(ENABLE_GSSAPI, test x$want_gssapi_krb5 = xyes) # multithreading via pthreads AC_ARG_ENABLE(pthreads, @@ -345,7 +346,7 @@ AC_SUBST(pgsql_libs) -AC_CONFIG_FILES([Makefile doc/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile]) +AC_CONFIG_FILES([Makefile doc/Makefile plugins/omgssapi/Makefile plugins/ommysql/Makefile plugins/ompgsql/Makefile]) AC_OUTPUT echo "****************************************************" diff --git a/omfwd.c b/omfwd.c index dc530776..f01e0459 100644 --- a/omfwd.c +++ b/omfwd.c @@ -51,9 +51,6 @@ #else #include #endif -#ifdef USE_GSSAPI -#include -#endif #include "syslogd.h" #include "syslogd-types.h" #include "srUtils.h" @@ -64,9 +61,6 @@ #include "tcpsyslog.h" #include "cfsysline.h" #include "module-template.h" -#ifdef USE_GSSAPI -#include "gss-misc.h" -#endif #ifdef SYSLOG_INET #define INET_SUSPEND_TIME 60 /* equal to 1 minute @@ -117,21 +111,8 @@ typedef struct _instanceData { # ifdef USE_PTHREADS pthread_mutex_t mtxTCPSend; # endif -# ifdef USE_GSSAPI - gss_ctx_id_t gss_context; - OM_uint32 gss_flags; -# endif } instanceData; -#ifdef USE_GSSAPI -static char *gss_base_service_name = NULL; -static enum gss_mode_t { - GSSMODE_NONE, - GSSMODE_MIC, - GSSMODE_ENC -} gss_mode; -#endif - BEGINcreateInstance CODESTARTcreateInstance @@ -162,24 +143,6 @@ CODESTARTfreeInstance if(pData->protocol == FORW_TCP) { pthread_mutex_destroy(&pData->mtxTCPSend); } -# endif -# ifdef USE_GSSAPI - if (gss_mode != GSSMODE_NONE) { - OM_uint32 maj_stat, min_stat; - - if (pData->gss_context != GSS_C_NO_CONTEXT) { - maj_stat = gss_delete_sec_context(&min_stat, &pData->gss_context, GSS_C_NO_BUFFER); - if (maj_stat != GSS_S_COMPLETE) - display_status("deleting context", maj_stat, min_stat); - } - } - /* this is meant to be done when module is unloaded, - but since this module is static... - */ - if (gss_base_service_name != NULL) { - free(gss_base_service_name); - gss_base_service_name = NULL; - } # endif /* final cleanup */ if(pData->sock >= 0) @@ -194,7 +157,7 @@ ENDdbgPrintInstInfo /* CODE FOR SENDING TCP MESSAGES */ -/* get send status +/* set send status * rgerhards, 2005-10-24 */ static void TCPSendSetStatus(instanceData *pData, enum TCPSendStatus iNewState) @@ -216,7 +179,7 @@ static void TCPSendSetStatus(instanceData *pData, enum TCPSendStatus iNewState) } -/* set send status +/* get send status * rgerhards, 2005-10-24 */ static enum TCPSendStatus TCPSendGetStatus(instanceData *pData) @@ -238,519 +201,92 @@ static enum TCPSendStatus TCPSendGetStatus(instanceData *pData) } -/* Initialize TCP sockets (for sender) - * This is done once per selector line, if not yet initialized. +/* get the syslog forward port from selector_t. The passed in + * struct must be one that is setup for forwarding. + * rgerhards, 2007-06-28 + * We may change the implementation to try to lookup the port + * if it is unspecified. So far, we use the IANA default auf 514. */ -static int TCPSendCreateSocket(instanceData *pData, struct addrinfo *addrDest) +static char *getFwdSyslogPt(instanceData *pData) { - int fd; - struct addrinfo *r; - assert(pData != NULL); - - r = addrDest; - - while(r != NULL) { - fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol); - if (fd != -1) { - /* We can not allow the TCP sender to block syslogd, at least - * not in a single-threaded design. That would cause rsyslogd to - * loose input messages - which obviously also would affect - * other selector lines, too. So we do set it to non-blocking and - * handle the situation ourselfs (by discarding messages). IF we run - * dual-threaded, however, the situation is different: in this case, - * the receivers and the selector line processing are only loosely - * coupled via a memory buffer. Now, I think, we can afford the extra - * wait time. Thus, we enable blocking mode for TCP if we compile with - * pthreads. - * rgerhards, 2005-10-25 - */ -# ifndef USE_PTHREADS - /* set to nonblocking - rgerhards 2005-07-20 */ - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); -# endif - if (connect (fd, r->ai_addr, r->ai_addrlen) != 0) { - if(errno == EINPROGRESS) { - /* this is normal - will complete during select */ - TCPSendSetStatus(pData, TCP_SEND_CONNECTING); - return fd; - } else { - char errStr[1024]; - dbgprintf("create tcp connection failed, reason %s", - strerror_r(errno, errStr, sizeof(errStr))); - } - - } - else { - TCPSendSetStatus(pData, TCP_SEND_READY); - return fd; - } - close(fd); - } - else { - char errStr[1024]; - dbgprintf("couldn't create send socket, reason %s", strerror_r(errno, errStr, sizeof(errStr))); - } - r = r->ai_next; - } - - dbgprintf("no working socket could be obtained"); - - return -1; + if(pData->port == NULL) + return("514"); + else + return(pData->port); } - -#ifdef USE_GSSAPI -static int TCPSendGSSInit(instanceData *pData) +/* Send a frame via plain TCP protocol + * rgerhards, 2007-12-28 + */ +static rsRetVal TCPSendFrame(void *pvData, char *msg, size_t len) { - int s = -1; - char *base; - OM_uint32 maj_stat, min_stat, init_sec_min_stat, *sess_flags, ret_flags; - gss_buffer_desc out_tok, in_tok; - gss_buffer_t tok_ptr; - gss_name_t target_name; - gss_ctx_id_t *context; - - assert(pData != NULL); - - base = (gss_base_service_name == NULL) ? "host" : gss_base_service_name; - out_tok.length = strlen(pData->f_hname) + strlen(base) + 2; - if ((out_tok.value = malloc(out_tok.length)) == NULL) - return -1; - strcpy(out_tok.value, base); - strcat(out_tok.value, "@"); - strcat(out_tok.value, pData->f_hname); - dbgprintf("GSS-API service name: %s\n", out_tok.value); - - tok_ptr = GSS_C_NO_BUFFER; - context = &pData->gss_context; - *context = GSS_C_NO_CONTEXT; - - maj_stat = gss_import_name(&min_stat, &out_tok, GSS_C_NT_HOSTBASED_SERVICE, &target_name); - free(out_tok.value); - out_tok.value = NULL; - out_tok.length = 0; - - if (maj_stat != GSS_S_COMPLETE) { - display_status("parsing name", maj_stat, min_stat); - goto fail; - } - - sess_flags = &pData->gss_flags; - *sess_flags = GSS_C_MUTUAL_FLAG; - if (gss_mode == GSSMODE_MIC) { - *sess_flags |= GSS_C_INTEG_FLAG; - } - if (gss_mode == GSSMODE_ENC) { - *sess_flags |= GSS_C_CONF_FLAG; - } - dbgprintf("GSS-API requested context flags:\n"); - display_ctx_flags(*sess_flags); - - do { - maj_stat = gss_init_sec_context(&init_sec_min_stat, GSS_C_NO_CREDENTIAL, context, - target_name, GSS_C_NO_OID, *sess_flags, 0, NULL, - tok_ptr, NULL, &out_tok, &ret_flags, NULL); - if (tok_ptr != GSS_C_NO_BUFFER) - free(in_tok.value); - - if (maj_stat != GSS_S_COMPLETE - && maj_stat != GSS_S_CONTINUE_NEEDED) { - display_status("initializing context", maj_stat, init_sec_min_stat); - goto fail; - } - - if (s == -1) - if ((s = pData->sock = TCPSendCreateSocket(pData, pData->f_addr)) == -1) - goto fail; - - if (out_tok.length != 0) { - dbgprintf("GSS-API Sending init_sec_context token (length: %d)\n", out_tok.length); - if (send_token(s, &out_tok) < 0) { - goto fail; - } - } - gss_release_buffer(&min_stat, &out_tok); - - if (maj_stat == GSS_S_CONTINUE_NEEDED) { - dbgprintf("GSS-API Continue needed...\n"); - if (recv_token(s, &in_tok) <= 0) { - goto fail; - } - tok_ptr = &in_tok; + DEFiRet; + ssize_t lenSend; + instanceData *pData = (instanceData *) pvData; + + lenSend = send(pData->sock, msg, len, 0); + dbgprintf("TCP sent %ld bytes, requested %ld\n", (long) lenSend, (long) len); + + if(lenSend == -1) { + /* we have an error case - check what we can live with */ + switch(errno) { + case EMSGSIZE: + dbgprintf("message not (tcp)send, too large\n"); + /* This is not a real error, so it is not flagged as one */ + break; + default: + dbgprintf("message not (tcp)send"); + iRet = RS_RET_TCP_SEND_ERROR; + break; } - } while (maj_stat == GSS_S_CONTINUE_NEEDED); - - dbgprintf("GSS-API Provided context flags:\n"); - *sess_flags = ret_flags; - display_ctx_flags(*sess_flags); - - dbgprintf("GSS-API Context initialized\n"); - gss_release_name(&min_stat, &target_name); - - return 0; - - fail: - logerror("GSS-API Context initialization failed\n"); - gss_release_name(&min_stat, &target_name); - gss_release_buffer(&min_stat, &out_tok); - if (*context != GSS_C_NO_CONTEXT) { - gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER); - *context = GSS_C_NO_CONTEXT; + } else if(lenSend != (ssize_t) len) { + /* no real error, could "just" not send everything... + * For the time being, we ignore this... + * rgerhards, 2005-10-25 + */ + dbgprintf("message not completely (tcp)send, ignoring %ld\n", lenSend); + usleep(1000); /* experimental - might be benefitial in this situation */ + /* TODO: we need to revisit this code -- rgerhards, 2007-12-28 */ } - if (s != -1) - close(s); - pData->sock = -1; - return -1; + + return iRet; } -static int TCPSendGSSSend(instanceData *pData, char *msg, size_t len) +/* This function is called immediately before a send retry is attempted. + * It shall clean up whatever makes sense. + * rgerhards, 2007-12-28 + */ +static rsRetVal TCPSendPrepRetry(void *pvData) { - int s; - gss_ctx_id_t *context; - OM_uint32 maj_stat, min_stat; - gss_buffer_desc in_buf, out_buf; + instanceData *pData = (instanceData *) pvData; assert(pData != NULL); - assert(msg != NULL); - assert(len > 0); - - s = pData->sock; - context = &pData->gss_context; - in_buf.value = msg; - in_buf.length = len; - maj_stat = gss_wrap(&min_stat, *context, (gss_mode == GSSMODE_ENC) ? 1 : 0, GSS_C_QOP_DEFAULT, - &in_buf, NULL, &out_buf); - if (maj_stat != GSS_S_COMPLETE) { - display_status("wrapping message", maj_stat, min_stat); - goto fail; - } - - if (send_token(s, &out_buf) < 0) { - goto fail; - } - gss_release_buffer(&min_stat, &out_buf); - - return 0; - - fail: - close(s); + close(pData->sock); pData->sock = -1; - TCPSendSetStatus(pData, TCP_SEND_NOTCONNECTED); - gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER); - *context = GSS_C_NO_CONTEXT; - gss_release_buffer(&min_stat, &out_buf); - return -1; + return RS_RET_OK; } -#endif /* #ifdef USE_GSSAPI */ -/* Sends a TCP message. It is first checked if the - * session is open and, if not, it is opened. Then the send - * is tried. If it fails, one silent re-try is made. If the send - * fails again, an error status (-1) is returned. If all goes well, - * 0 is returned. The TCP session is NOT torn down. - * For now, EAGAIN is ignored (causing message loss) - but it is - * hard to do something intelligent in this case. With this - * implementation here, we can not block and/or defer. Things are - * probably a bit better when we move to liblogging. The alternative - * would be to enhance the current select server with buffering and - * write descriptors. This seems not justified, given the expected - * short life span of this code (and the unlikeliness of this event). - * rgerhards 2005-07-06 - * This function is now expected to stay. Libloging won't be used for - * that purpose. I have added the param "len", because it is known by the - * caller and so safes us some time. Also, it MUST be given because there - * may be NULs inside msg so that we can not rely on strlen(). Please note - * that the restrictions outlined above do not existin in multi-threaded - * mode, which we assume will now be most often used. So there is no - * real issue with the potential message loss in single-threaded builds. - * rgerhards, 2006-11-30 - * - * In order to support compressed messages via TCP, we must support an - * octet-counting based framing (LF may be part of the compressed message). - * We are now supporting the same mode that is available in IETF I-D - * syslog-transport-tls-05 (current at the time of this writing). This also - * eases things when we go ahead and implement that framing. I have now made - * available two cases where this framing is used: either by explitely - * specifying it in the config file or implicitely when sending a compressed - * message. In the later case, compressed and uncompressed messages within - * the same session have different framings. If it is explicitely set to - * octet-counting, only this framing mode is used within the session. - * rgerhards, 2006-12-07 +/* initialies everything so that TCPSend can work. + * rgerhards, 2007-12-28 */ -static int TCPSend(instanceData *pData, char *msg, size_t len) +static rsRetVal TCPSendInit(void *pvData) { - int retry = 0; - int done = 0; - int bIsCompressed; - int lenSend; - char *buf = NULL; /* if this is non-NULL, it MUST be freed before return! */ - enum TCPSendStatus eState; - TCPFRAMINGMODE framingToUse; + DEFiRet; + instanceData *pData = (instanceData *) pvData; assert(pData != NULL); - assert(msg != NULL); - assert(len > 0); - - bIsCompressed = *msg == 'z'; /* cache this, so that we can modify the message buffer */ - /* select framing for this record. If we have a compressed record, we always need to - * use octet counting because the data potentially contains all control characters - * including LF. - */ - framingToUse = bIsCompressed ? TCP_FRAMING_OCTET_COUNTING : pData->tcp_framing; - - do { /* try to send message */ - if(pData->sock <= 0) { - /* we need to open the socket first */ -# ifdef USE_GSSAPI - if(gss_mode != GSSMODE_NONE) { - if(TCPSendGSSInit(pData) != 0) - return -1; - } else -# endif - if((pData->sock = TCPSendCreateSocket(pData, pData->f_addr)) <= 0) - return -1; - } - - eState = TCPSendGetStatus(pData); /* cache info */ - - if(eState == TCP_SEND_CONNECTING) { - /* In this case, we save the buffer. If we have a - * system with few messages, that hopefully prevents - * message loss at all. However, we make no further attempts, - * just the first message is saved. So we only try this - * if there is not yet a saved message present. - * rgerhards 2005-07-20 - */ - if(pData->savedMsg == NULL) { - pData->savedMsg = malloc(len * sizeof(char)); - if(pData->savedMsg == NULL) - return 0; /* nothing we can do... */ - memcpy(pData->savedMsg, msg, len); - pData->savedMsgLen = len; - } - return 0; - } else if(eState != TCP_SEND_READY) - /* This here is debatable. For the time being, we - * accept the loss of a single message (e.g. during - * connection setup in favour of not messing with - * wait time and timeouts. The reason is that such - * things might otherwise cost us considerable message - * loss on the receiving side (even at a timeout set - * to just 1 second). - rgerhards 2005-07-20 - */ - return 0; - - /* now check if we need to add a line terminator. We need to - * copy the string in memory in this case, this is probably - * quicker than using writev and definitely quicker than doing - * two socket calls. - * rgerhards 2005-07-22 - *//* - * Some messages already contain a \n character at the end - * of the message. We append one only if we there is not - * already one. This seems the best fit, though this also - * means the message does not arrive unaltered at the final - * destination. But in the spirit of legacy syslog, this is - * probably the best to do... - * rgerhards 2005-07-20 - */ - - /* Build frame based on selected framing */ - if(framingToUse == TCP_FRAMING_OCTET_STUFFING) { - if((*(msg+len-1) != '\n')) { - if(buf != NULL) - free(buf); - /* in the malloc below, we need to add 2 to the length. The - * reason is that we a) add one character and b) len does - * not take care of the '\0' byte. Up until today, it was just - * +1 , which caused rsyslogd to sometimes dump core. - * I have added this comment so that the logic is not accidently - * changed again. rgerhards, 2005-10-25 - */ - if((buf = malloc((len + 2) * sizeof(char))) == NULL) { - /* extreme mem shortage, try to solve - * as good as we can. No point in calling - * any alarms, they might as well run out - * of memory (the risk is very high, so we - * do NOT risk that). If we have a message of - * more than 1 byte (what I guess), we simply - * overwrite the last character. - * rgerhards 2005-07-22 - */ - if(len > 1) { - *(msg+len-1) = '\n'; - } else { - /* we simply can not do anything in - * this case (its an error anyhow...). - */ - } - } else { - /* we got memory, so we can copy the message */ - memcpy(buf, msg, len); /* do not copy '\0' */ - *(buf+len) = '\n'; - *(buf+len+1) = '\0'; - msg = buf; /* use new one */ - ++len; /* care for the \n */ - } - } - } else { - /* Octect-Counting - * In this case, we need to always allocate a buffer. This is because - * we need to put a header in front of the message text - */ - char szLenBuf[16]; - int iLenBuf; - - /* important: the printf-mask is "%d" because there must be a - * space after the len! - *//* The chairs of the IETF syslog-sec WG have announced that it is - * consensus to do the octet count on the SYSLOG-MSG part only. I am - * now changing the code to reflect this. Hopefully, it will not change - * once again (there can no compatibility layer programmed for this). - * To be on the save side, I just comment the code out. I mark these - * comments with "IETF20061218". - * rgerhards, 2006-12-19 - */ - iLenBuf = snprintf(szLenBuf, sizeof(szLenBuf)/sizeof(char), "%d ", (int) len); - /* IETF20061218 iLenBuf = - snprintf(szLenBuf, sizeof(szLenBuf)/sizeof(char), "%d ", len + iLenBuf);*/ - - if((buf = malloc((len + iLenBuf) * sizeof(char))) == NULL) { - /* we are out of memory. This is an extreme situation. We do not - * call any alarm handlers because they most likely run out of mem, - * too. We are brave enough to call debug output, though. Other than - * that, there is nothing left to do. We can not sent the message (as - * in case of the other framing, because the message is incomplete. - * We could, however, send two chunks (header and text separate), but - * that would cause a lot of complexity in the code. So we think it - * is appropriate enough to just make sure we do not crash in this - * very unlikely case. For this, it is justified just to loose - * the message. Rgerhards, 2006-12-07 - */ - dbgprintf("Error: out of memory when building TCP octet-counted " - "frame. Message is lost, trying to continue.\n"); - return 0; - } - - memcpy(buf, szLenBuf, iLenBuf); /* header */ - memcpy(buf + iLenBuf, msg, len); /* message */ - len += iLenBuf; /* new message size */ - msg = buf; /* set message buffer */ - } - - /* frame building complete, on to actual sending */ -# ifdef USE_GSSAPI - if(gss_mode != GSSMODE_NONE) { - if(TCPSendGSSSend(pData, msg, len) == 0) { - if(buf != NULL) { - free(buf); - } - return 0; - } else { - if(retry == 0) { - ++retry; - /* try to recover */ - continue; - } else { - if(buf != NULL) - free(buf); - dbgprintf("message not (tcp)send"); - return -1; - } - } - } else { -# endif - lenSend = send(pData->sock, msg, len, 0); - dbgprintf("TCP sent %d bytes, requested %d, msg: '%s'\n", lenSend, len, - bIsCompressed ? "***compressed***" : msg); - if((unsigned)lenSend == len) { - /* all well */ - if(buf != NULL) { - free(buf); - } - return 0; - } else if(lenSend != -1) { - /* no real error, could "just" not send everything... - * For the time being, we ignore this... - * rgerhards, 2005-10-25 - */ - dbgprintf("message not completely (tcp)send, ignoring %d\n", lenSend); -# if USE_PTHREADS - usleep(1000); /* experimental - might be benefitial in this situation */ -# endif - if(buf != NULL) - free(buf); - return 0; - } - - switch(errno) { - case EMSGSIZE: - dbgprintf("message not (tcp)send, too large\n"); - /* This is not a real error, so it is not flagged as one */ - if(buf != NULL) - free(buf); - return 0; - break; - case EINPROGRESS: - case EAGAIN: - dbgprintf("message not (tcp)send, would block\n"); -# if USE_PTHREADS - usleep(1000); /* experimental - might be benefitial in this situation */ -# endif - /* we loose this message, but that's better than loosing - * all ;) - */ - /* This is not a real error, so it is not flagged as one */ - if(buf != NULL) - free(buf); - return 0; - break; - default: - dbgprintf("message not (tcp)send"); - break; - } - - if(retry == 0) { - ++retry; - /* try to recover */ - close(pData->sock); - TCPSendSetStatus(pData, TCP_SEND_NOTCONNECTED); - pData->sock = -1; - } else { - if(buf != NULL) - free(buf); - return -1; - } -# ifdef USE_GSSAPI - } -# endif - } while(!done); /* warning: do ... while() */ - /*NOT REACHED*/ + if(pData->sock <= 0) { + if((pData->sock = TCPSendCreateSocket(pData->f_addr)) <= 0) + iRet = RS_RET_TCP_SOCKCREATE_ERR; + } - if(buf != NULL) - free(buf); - return -1; /* only to avoid compiler warning! */ + return iRet; } -/* get the syslog forward port from selector_t. The passed in - * struct must be one that is setup for forwarding. - * rgerhards, 2007-06-28 - * We may change the implementation to try to lookup the port - * if it is unspecified. So far, we use the IANA default auf 514. - */ -static char *getFwdSyslogPt(instanceData *pData) -{ - assert(pData != NULL); - if(pData->port == NULL) - return("514"); - else - return(pData->port); -} - /* try to resume connection if it is not ready * rgerhards, 2007-08-02 @@ -917,8 +453,9 @@ CODESTARTdoAction } } } else { - /* forward via TCP */ - if(TCPSend(pData, psz, l) != 0) { + int ret; + ret = TCPSend(pData, psz, l, pData->tcp_framing, TCPSendInit, TCPSendFrame, TCPSendPrepRetry); + if(ret != RS_RET_OK) { /* error! */ dbgprintf("error forwarding via tcp, suspending\n"); pData->eDestState = eDestFORW_SUSP; @@ -1110,8 +647,8 @@ CODESTARTonSelectReadyWrite TCPSendSetStatus(pData, TCP_SEND_READY); /* Send stored message (if any) */ if(pData->savedMsg != NULL) { - if(TCPSend(pData, pData->savedMsg, - pData->savedMsgLen) != 0) { + if(TCPSend(pData, pData->savedMsg, pData->savedMsgLen, pData->tcp_framing, + TCPSendInit, TCPSendFrame, TCPSendPrepRetry) != RS_RET_OK) { /* error! */ pData->eDestState = eDestFORW_SUSP; errno = 0; @@ -1145,52 +682,10 @@ CODEqueryEtryPt_STD_OMOD_QUERIES ENDqueryEtryPt -#ifdef USE_GSSAPI -static rsRetVal setGSSMode(void __attribute__((unused)) *pVal, uchar *mode) -{ - if (!strcmp((char *) mode, "none")) { - gss_mode = GSSMODE_NONE; - free(mode); - dbgprintf("GSS-API gssmode set to GSSMODE_NONE\n"); - } else if (!strcmp((char *) mode, "integrity")) { - gss_mode = GSSMODE_MIC; - free(mode); - dbgprintf("GSS-API gssmode set to GSSMODE_MIC\n"); - } else if (!strcmp((char *) mode, "encryption")) { - gss_mode = GSSMODE_ENC; - free(mode); - dbgprintf("GSS-API gssmode set to GSSMODE_ENC\n"); - } else { - logerrorSz("unknown gssmode parameter: %s", (char *) mode); - free(mode); - return RS_RET_ERR; - } - - return RS_RET_OK; -} - - -static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal) -{ - gss_mode = GSSMODE_NONE; - if (gss_base_service_name != NULL) { - free(gss_base_service_name); - gss_base_service_name = NULL; - } - return RS_RET_OK; -} -#endif /* #ifdef USE_GSSAPI */ - - BEGINmodInit(Fwd) CODESTARTmodInit *ipIFVersProvided = 1; /* so far, we only support the initial definition */ CODEmodInit_QueryRegCFSLineHdlr -# ifdef USE_GSSAPI - CHKiRet(omsdRegCFSLineHdlr((uchar *)"gssforwardservicename", 0, eCmdHdlrGetWord, NULL, &gss_base_service_name, STD_LOADABLE_MODULE_ID)); - CHKiRet(omsdRegCFSLineHdlr((uchar *)"gssmode", 0, eCmdHdlrGetWord, setGSSMode, &gss_mode, STD_LOADABLE_MODULE_ID)); - CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); -# endif ENDmodInit #endif /* #ifdef SYSLOG_INET */ diff --git a/plugins/omgssapi/.cvsignore b/plugins/omgssapi/.cvsignore new file mode 100644 index 00000000..9730646f --- /dev/null +++ b/plugins/omgssapi/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +Makefile +Makefile.in +*.la +*.lo diff --git a/plugins/omgssapi/Makefile.am b/plugins/omgssapi/Makefile.am new file mode 100644 index 00000000..3b568d3d --- /dev/null +++ b/plugins/omgssapi/Makefile.am @@ -0,0 +1,6 @@ +pkglib_LTLIBRARIES = omgssapi.la + +omgssapi_la_SOURCES = omgssapi.c omgssapi.h ../../module-template.h +omgssapi_la_CPPFLAGS = $(pgsql_cflags) -I$(srcdir)/../.. +omgssapi_la_LDFLAGS = -module -avoid-version +omgssapi_la_LIBADD = $(gss_libs) diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c new file mode 100644 index 00000000..97b8bd55 --- /dev/null +++ b/plugins/omgssapi/omgssapi.c @@ -0,0 +1,771 @@ +/* omgssapi.c + * This is the implementation of the build-in forwarding output module. + * + * NOTE: read comments in module-template.h to understand how this file + * works! + * + * Copyright 2007 Rainer Gerhards and Adiscon GmbH. + * + * This file is part of rsyslog. + * + * Rsyslog is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Rsyslog is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Rsyslog. If not, see . + * + * A copy of the GPL can be found in the file "COPYING" in this distribution. + */ +#include "config.h" +#ifdef USE_GSSAPI +#include "rsyslog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef USE_NETZIP +#include +#endif +#include +#include +#include "syslogd.h" +#include "syslogd-types.h" +#include "srUtils.h" +#include "net.h" +#include "omfwd.h" +#include "template.h" +#include "msg.h" +#include "tcpsyslog.h" +#include "cfsysline.h" +#include "module-template.h" +#include "gss-misc.h" + +#define INET_SUSPEND_TIME 60 /* equal to 1 minute */ + /* rgerhards, 2005-07-26: This was 3 minutes. As the + * same timer is used for tcp based syslog, we have + * reduced it. However, it might actually be worth + * thinking about a buffered tcp sender, which would be + * a much better alternative. When that happens, this + * time here can be re-adjusted to 3 minutes (or, + * even better, made configurable). + */ +#define INET_RETRY_MAX 30 /* maximum of retries for gethostbyname() */ + /* was 10, changed to 30 because we reduced INET_SUSPEND_TIME by one third. So + * this "fixes" some of implications of it (see comment on INET_SUSPEND_TIME). + * rgerhards, 2005-07-26 + */ + +/* internal structures + */ +DEF_OMOD_STATIC_DATA + +typedef struct _instanceData { + char f_hname[MAXHOSTNAMELEN+1]; + short sock; /* file descriptor */ + enum { /* TODO: we shoud revisit these definitions */ + eDestFORW, + eDestFORW_SUSP, + eDestFORW_UNKN + } eDestState; + int iRtryCnt; + struct addrinfo *f_addr; + int compressionLevel; /* 0 - no compression, else level for zlib */ + char *port; + char *savedMsg; + int savedMsgLen; /* length of savedMsg in octets */ + TCPFRAMINGMODE tcp_framing; + enum TCPSendStatus { + TCP_SEND_NOTCONNECTED = 0, + TCP_SEND_CONNECTING = 1, + TCP_SEND_READY = 2 + } status; + time_t ttSuspend; /* time selector was suspended */ + gss_ctx_id_t gss_context; + OM_uint32 gss_flags; +# ifdef USE_PTHREADS + pthread_mutex_t mtxTCPSend; +# endif +} instanceData; + +static char *gss_base_service_name = NULL; +static enum gss_mode_t { + GSSMODE_MIC, + GSSMODE_ENC +} gss_mode = GSSMODE_ENC; + +/* get the syslog forward port from selector_t. The passed in + * struct must be one that is setup for forwarding. + * rgerhards, 2007-06-28 + * We may change the implementation to try to lookup the port + * if it is unspecified. So far, we use the IANA default auf 514. + */ +char *getFwdSyslogPt(instanceData *pData) +{ + assert(pData != NULL); + if(pData->port == NULL) + return("514"); + else + return(pData->port); +} + +/* get send status + * rgerhards, 2005-10-24 + */ +static void TCPSendSetStatus(instanceData *pData, enum TCPSendStatus iNewState) +{ + assert(pData != NULL); + assert( (iNewState == TCP_SEND_NOTCONNECTED) + || (iNewState == TCP_SEND_CONNECTING) + || (iNewState == TCP_SEND_READY)); + + /* there can potentially be a race condition, so guard by mutex */ +# ifdef USE_PTHREADS + pthread_mutex_lock(&pData->mtxTCPSend); +# endif + pData->status = iNewState; +# ifdef USE_PTHREADS + pthread_mutex_unlock(&pData->mtxTCPSend); +# endif +} + + +/* get send status + * rgerhards, 2005-10-24 + */ +static enum TCPSendStatus TCPSendGetStatus(instanceData *pData) +{ + enum TCPSendStatus eState; + assert(pData != NULL); + + /* there can potentially be a race condition, so guard by mutex */ +# ifdef USE_PTHREADS + pthread_mutex_lock(&pData->mtxTCPSend); +# endif + eState = pData->status; +# ifdef USE_PTHREADS + pthread_mutex_unlock(&pData->mtxTCPSend); +# endif + + return eState; +} + + +BEGINcreateInstance +CODESTARTcreateInstance +ENDcreateInstance + + +BEGINisCompatibleWithFeature +CODESTARTisCompatibleWithFeature + if(eFeat == sFEATURERepeatedMsgReduction) + iRet = RS_RET_OK; +ENDisCompatibleWithFeature + + +BEGINfreeInstance +OM_uint32 maj_stat, min_stat; +CODESTARTfreeInstance + switch (pData->eDestState) { + case eDestFORW: + case eDestFORW_SUSP: + freeaddrinfo(pData->f_addr); + /* fall through */ + case eDestFORW_UNKN: + if(pData->port != NULL) + free(pData->port); + break; + } + + if (pData->gss_context != GSS_C_NO_CONTEXT) { + maj_stat = gss_delete_sec_context(&min_stat, &pData->gss_context, GSS_C_NO_BUFFER); + if (maj_stat != GSS_S_COMPLETE) + display_status("deleting context", maj_stat, min_stat); + } + /* this is meant to be done when module is unloaded, + but since this module is static... + */ + if (gss_base_service_name != NULL) { + free(gss_base_service_name); + gss_base_service_name = NULL; + } + +# ifdef USE_PTHREADS + /* delete any mutex objects, if present */ + pthread_mutex_destroy(&pData->mtxTCPSend); +# endif + /* final cleanup */ + if(pData->sock >= 0) + close(pData->sock); +ENDfreeInstance + + +BEGINdbgPrintInstInfo +CODESTARTdbgPrintInstInfo + printf("%s", pData->f_hname); +ENDdbgPrintInstInfo + + +/* CODE FOR SENDING TCP MESSAGES */ + +/* This function is called immediately before a send retry is attempted. + * It shall clean up whatever makes sense. + * rgerhards, 2007-12-28 + */ +static rsRetVal TCPSendGSSPrepRetry(void __attribute__((unused)) *pData) +{ + /* in case of TCP/GSS, there is nothing to do */ + return RS_RET_OK; +} + + +static rsRetVal TCPSendGSSInit(void *pvData) +{ + DEFiRet; + int s = -1; + char *base; + OM_uint32 maj_stat, min_stat, init_sec_min_stat, *sess_flags, ret_flags; + gss_buffer_desc out_tok, in_tok; + gss_buffer_t tok_ptr; + gss_name_t target_name; + gss_ctx_id_t *context; + instanceData *pData = (instanceData *) pvData; + + assert(pData != NULL); + + /* if the socket is already initialized, we are done */ + if(pData->sock > 0) + ABORT_FINALIZE(RS_RET_OK); + + base = (gss_base_service_name == NULL) ? "host" : gss_base_service_name; + out_tok.length = strlen(pData->f_hname) + strlen(base) + 2; + if ((out_tok.value = malloc(out_tok.length)) == NULL) { + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); + } + strcpy(out_tok.value, base); + strcat(out_tok.value, "@"); + strcat(out_tok.value, pData->f_hname); + dbgprintf("GSS-API service name: %s\n", (char*) out_tok.value); + + tok_ptr = GSS_C_NO_BUFFER; + context = &pData->gss_context; + *context = GSS_C_NO_CONTEXT; + + maj_stat = gss_import_name(&min_stat, &out_tok, GSS_C_NT_HOSTBASED_SERVICE, &target_name); + free(out_tok.value); + out_tok.value = NULL; + out_tok.length = 0; + + if (maj_stat != GSS_S_COMPLETE) { + display_status("parsing name", maj_stat, min_stat); + goto fail; + } + + sess_flags = &pData->gss_flags; + *sess_flags = GSS_C_MUTUAL_FLAG; + if (gss_mode == GSSMODE_MIC) { + *sess_flags |= GSS_C_INTEG_FLAG; + } + if (gss_mode == GSSMODE_ENC) { + *sess_flags |= GSS_C_CONF_FLAG; + } + dbgprintf("GSS-API requested context flags:\n"); + display_ctx_flags(*sess_flags); + + do { + maj_stat = gss_init_sec_context(&init_sec_min_stat, GSS_C_NO_CREDENTIAL, context, + target_name, GSS_C_NO_OID, *sess_flags, 0, NULL, + tok_ptr, NULL, &out_tok, &ret_flags, NULL); + if (tok_ptr != GSS_C_NO_BUFFER) + free(in_tok.value); + + if (maj_stat != GSS_S_COMPLETE + && maj_stat != GSS_S_CONTINUE_NEEDED) { + display_status("initializing context", maj_stat, init_sec_min_stat); + goto fail; + } + + if (s == -1) + if ((s = pData->sock = TCPSendCreateSocket(pData->f_addr)) == -1) + goto fail; + + if (out_tok.length != 0) { + dbgprintf("GSS-API Sending init_sec_context token (length: %ld)\n", (long) out_tok.length); + if (send_token(s, &out_tok) < 0) { + goto fail; + } + } + gss_release_buffer(&min_stat, &out_tok); + + if (maj_stat == GSS_S_CONTINUE_NEEDED) { + dbgprintf("GSS-API Continue needed...\n"); + if (recv_token(s, &in_tok) <= 0) { + goto fail; + } + tok_ptr = &in_tok; + } + } while (maj_stat == GSS_S_CONTINUE_NEEDED); + + dbgprintf("GSS-API Provided context flags:\n"); + *sess_flags = ret_flags; + display_ctx_flags(*sess_flags); + + dbgprintf("GSS-API Context initialized\n"); + gss_release_name(&min_stat, &target_name); + +finalize_it: + return iRet; + + fail: + logerror("GSS-API Context initialization failed\n"); + gss_release_name(&min_stat, &target_name); + gss_release_buffer(&min_stat, &out_tok); + if (*context != GSS_C_NO_CONTEXT) { + gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER); + *context = GSS_C_NO_CONTEXT; + } + if (s != -1) + close(s); + pData->sock = -1; + return RS_RET_GSS_SENDINIT_ERROR; +} + + +static rsRetVal TCPSendGSSSend(void *pvData, char *msg, size_t len) +{ + int s; + gss_ctx_id_t *context; + OM_uint32 maj_stat, min_stat; + gss_buffer_desc in_buf, out_buf; + instanceData *pData = (instanceData *) pvData; + + assert(pData != NULL); + assert(msg != NULL); + assert(len > 0); + + s = pData->sock; + context = &pData->gss_context; + in_buf.value = msg; + in_buf.length = len; + maj_stat = gss_wrap(&min_stat, *context, (gss_mode == GSSMODE_ENC) ? 1 : 0, GSS_C_QOP_DEFAULT, + &in_buf, NULL, &out_buf); + if (maj_stat != GSS_S_COMPLETE) { + display_status("wrapping message", maj_stat, min_stat); + goto fail; + } + + if (send_token(s, &out_buf) < 0) { + goto fail; + } + gss_release_buffer(&min_stat, &out_buf); + + return RS_RET_OK; + + fail: + close(s); + pData->sock = -1; + gss_delete_sec_context(&min_stat, context, GSS_C_NO_BUFFER); + *context = GSS_C_NO_CONTEXT; + gss_release_buffer(&min_stat, &out_buf); + dbgprintf("message not (GSS/tcp)send"); + return RS_RET_GSS_SEND_ERROR; +} + + +/* try to resume connection if it is not ready + * rgerhards, 2007-08-02 + */ +static rsRetVal doTryResume(instanceData *pData) +{ + DEFiRet; + struct addrinfo *res; + struct addrinfo hints; + unsigned e; + + switch (pData->eDestState) { + case eDestFORW_SUSP: + iRet = RS_RET_OK; /* the actual check happens during doAction() only */ + pData->eDestState = eDestFORW; + break; + + case eDestFORW_UNKN: + /* The remote address is not yet known and needs to be obtained */ + dbgprintf(" %s\n", pData->f_hname); + memset(&hints, 0, sizeof(hints)); + /* port must be numeric, because config file syntax requests this */ + /* TODO: this code is a duplicate from cfline() - we should later create + * a common function. + */ + hints.ai_flags = AI_NUMERICSERV; + hints.ai_family = family; + hints.ai_socktype = SOCK_STREAM; + if((e = getaddrinfo(pData->f_hname, + getFwdSyslogPt(pData), &hints, &res)) == 0) { + dbgprintf("%s found, resuming.\n", pData->f_hname); + pData->f_addr = res; + pData->iRtryCnt = 0; + pData->eDestState = eDestFORW; + } else { + iRet = RS_RET_SUSPENDED; + } + break; + case eDestFORW: + /* rgerhards, 2007-09-11: this can not happen, but I've included it to + * a) make the compiler happy, b) detect any logic errors */ + assert(0); + break; + } + + return iRet; +} + + +BEGINtryResume +CODESTARTtryResume + iRet = doTryResume(pData); +ENDtryResume + +BEGINdoAction + char *psz; /* temporary buffering */ + register unsigned l; +CODESTARTdoAction + switch (pData->eDestState) { + case eDestFORW_SUSP: + dbgprintf("internal error in omgssapi.c, eDestFORW_SUSP in doAction()!\n"); + iRet = RS_RET_SUSPENDED; + break; + + case eDestFORW_UNKN: + dbgprintf("doAction eDestFORW_UNKN\n"); + iRet = doTryResume(pData); + break; + + case eDestFORW: + dbgprintf(" %s:%s/%s\n", pData->f_hname, getFwdSyslogPt(pData), "tcp-gssapi"); + pData->ttSuspend = time(NULL); + psz = (char*) ppString[0]; + l = strlen((char*) psz); + if (l > MAXLINE) + l = MAXLINE; + +# ifdef USE_NETZIP + /* Check if we should compress and, if so, do it. We also + * check if the message is large enough to justify compression. + * The smaller the message, the less likely is a gain in compression. + * To save CPU cycles, we do not try to compress very small messages. + * What "very small" means needs to be configured. Currently, it is + * hard-coded but this may be changed to a config parameter. + * rgerhards, 2006-11-30 + */ + if(pData->compressionLevel && (l > MIN_SIZE_FOR_COMPRESS)) { + Bytef out[MAXLINE+MAXLINE/100+12] = "z"; + uLongf destLen = sizeof(out) / sizeof(Bytef); + uLong srcLen = l; + int ret; + ret = compress2((Bytef*) out+1, &destLen, (Bytef*) psz, + srcLen, pData->compressionLevel); + dbgprintf("Compressing message, length was %d now %d, return state %d.\n", + l, (int) destLen, ret); + if(ret != Z_OK) { + /* if we fail, we complain, but only in debug mode + * Otherwise, we are silent. In any case, we ignore the + * failed compression and just sent the uncompressed + * data, which is still valid. So this is probably the + * best course of action. + * rgerhards, 2006-11-30 + */ + dbgprintf("Compression failed, sending uncompressed message\n"); + } else if(destLen+1 < l) { + /* only use compression if there is a gain in using it! */ + dbgprintf("there is gain in compression, so we do it\n"); + psz = (char*) out; + l = destLen + 1; /* take care for the "z" at message start! */ + } + ++destLen; + } +# endif + + CHKiRet_Hdlr(TCPSend(pData, psz, l, pData->tcp_framing, TCPSendGSSInit, TCPSendGSSSend, TCPSendGSSPrepRetry)) { + /* error! */ + dbgprintf("error forwarding via tcp, suspending\n"); + pData->eDestState = eDestFORW_SUSP; + iRet = RS_RET_SUSPENDED; + } + break; + } +ENDdoAction + + +BEGINparseSelectorAct + uchar *q; + int i; + int error; + int bErr; + struct addrinfo hints, *res; +CODESTARTparseSelectorAct +CODE_STD_STRING_REQUESTparseSelectorAct(1) + /* first check if this config line is actually for us + * The first test [*p == '>'] can be skipped if a module shall only + * support the newer slection syntax [:modname:]. This is in fact + * recommended for new modules. Please note that over time this part + * will be handled by rsyslogd itself, but for the time being it is + * a good compromise to do it at the module level. + * rgerhards, 2007-10-15 + */ + + if(!strncmp((char*) p, ":omgssapi:", sizeof(":omgssapi:") - 1)) { + p += sizeof(":omgssapi:") - 1; /* eat indicator sequence (-1 because of '\0'!) */ + } else { + ABORT_FINALIZE(RS_RET_CONFLINE_UNPROCESSED); + } + + /* ok, if we reach this point, we have something for us */ + if((iRet = createInstance(&pData)) != RS_RET_OK) + goto finalize_it; + +# ifdef USE_PTHREADS + pthread_mutex_init(&pData->mtxTCPSend, 0); +# endif + + /* we are now after the protocol indicator. Now check if we should + * use compression. We begin to use a new option format for this: + * @(option,option)host:port + * The first option defined is "z[0..9]" where the digit indicates + * the compression level. If it is not given, 9 (best compression) is + * assumed. An example action statement might be: + * @@(z5,o)127.0.0.1:1400 + * Which means send via TCP with medium (5) compresion (z) to the local + * host on port 1400. The '0' option means that octet-couting (as in + * IETF I-D syslog-transport-tls) is to be used for framing (this option + * applies to TCP-based syslog only and is ignored when specified with UDP). + * That is not yet implemented. + * rgerhards, 2006-12-07 + */ + if(*p == '(') { + /* at this position, it *must* be an option indicator */ + do { + ++p; /* eat '(' or ',' (depending on when called) */ + /* check options */ + if(*p == 'z') { /* compression */ +# ifdef USE_NETZIP + ++p; /* eat */ + if(isdigit((int) *p)) { + int iLevel; + iLevel = *p - '0'; + ++p; /* eat */ + pData->compressionLevel = iLevel; + } else { + logerrorInt("Invalid compression level '%c' specified in " + "forwardig action - NOT turning on compression.", + *p); + } +# else + logerror("Compression requested, but rsyslogd is not compiled " + "with compression support - request ignored."); +# endif /* #ifdef USE_NETZIP */ + } else if(*p == 'o') { /* octet-couting based TCP framing? */ + ++p; /* eat */ + /* no further options settable */ + pData->tcp_framing = TCP_FRAMING_OCTET_COUNTING; + } else { /* invalid option! Just skip it... */ + logerrorInt("Invalid option %c in forwarding action - ignoring.", *p); + ++p; /* eat invalid option */ + } + /* the option processing is done. We now do a generic skip + * to either the next option or the end of the option + * block. + */ + while(*p && *p != ')' && *p != ',') + ++p; /* just skip it */ + } while(*p && *p == ','); /* Attention: do.. while() */ + if(*p == ')') + ++p; /* eat terminator, on to next */ + else + /* we probably have end of string - leave it for the rest + * of the code to handle it (but warn the user) + */ + logerror("Option block not terminated in gssapi forward action."); + } + /* extract the host first (we do a trick - we replace the ';' or ':' with a '\0') + * now skip to port and then template name. rgerhards 2005-07-06 + */ + for(q = p ; *p && *p != ';' && *p != ':' ; ++p) + /* JUST SKIP */; + + pData->port = NULL; + if(*p == ':') { /* process port */ + uchar * tmp; + + *p = '\0'; /* trick to obtain hostname (later)! */ + tmp = ++p; + for(i=0 ; *p && isdigit((int) *p) ; ++p, ++i) + /* SKIP AND COUNT */; + pData->port = malloc(i + 1); + if(pData->port == NULL) { + logerror("Could not get memory to store syslog forwarding port, " + "using default port, results may not be what you intend\n"); + /* we leave f_forw.port set to NULL, this is then handled by + * getFwdSyslogPt(). + */ + } else { + memcpy(pData->port, tmp, i); + *(pData->port + i) = '\0'; + } + } + + /* now skip to template */ + bErr = 0; + while(*p && *p != ';') { + if(*p && *p != ';' && !isspace((int) *p)) { + if(bErr == 0) { /* only 1 error msg! */ + bErr = 1; + errno = 0; + logerror("invalid selector line (port), probably not doing " + "what was intended"); + } + } + ++p; + } + + /* TODO: make this if go away! */ + if(*p == ';') { + *p = '\0'; /* trick to obtain hostname (later)! */ + strcpy(pData->f_hname, (char*) q); + *p = ';'; + } else + strcpy(pData->f_hname, (char*) q); + + /* process template */ + if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) " StdFwdFmt")) + != RS_RET_OK) + goto finalize_it; + + /* first set the pData->eDestState */ + memset(&hints, 0, sizeof(hints)); + /* port must be numeric, because config file syntax requests this */ + hints.ai_flags = AI_NUMERICSERV; + hints.ai_family = family; + hints.ai_socktype = SOCK_STREAM; + if( (error = getaddrinfo(pData->f_hname, getFwdSyslogPt(pData), &hints, &res)) != 0) { + pData->eDestState = eDestFORW_UNKN; + pData->iRtryCnt = INET_RETRY_MAX; + pData->ttSuspend = time(NULL); + } else { + pData->eDestState = eDestFORW; + pData->f_addr = res; + } + + /* TODO: do we need to call freeInstance if we failed - this is a general question for + * all output modules. I'll address it lates as the interface evolves. rgerhards, 2007-07-25 + */ +CODE_STD_FINALIZERparseSelectorAct +ENDparseSelectorAct + + +BEGINneedUDPSocket +CODESTARTneedUDPSocket + iRet = RS_RET_FALSE; +ENDneedUDPSocket + + +BEGINonSelectReadyWrite +CODESTARTonSelectReadyWrite + dbgprintf("tcp send socket %d ready for writing.\n", pData->sock); + TCPSendSetStatus(pData, TCP_SEND_READY); + /* Send stored message (if any) */ + if(pData->savedMsg != NULL) { + if(TCPSend(pData, pData->savedMsg, pData->savedMsgLen, pData->tcp_framing, + TCPSendGSSInit, TCPSendGSSSend, TCPSendGSSPrepRetry) != RS_RET_OK) { + /* error! */ + pData->eDestState = eDestFORW_SUSP; + errno = 0; + logerror("error forwarding via tcp, suspending..."); + } + free(pData->savedMsg); + pData->savedMsg = NULL; + } +ENDonSelectReadyWrite + + +BEGINgetWriteFDForSelect +CODESTARTgetWriteFDForSelect + if( (pData->eDestState == eDestFORW) + && TCPSendGetStatus(pData) == TCP_SEND_CONNECTING) { + *fd = pData->sock; + iRet = RS_RET_OK; + } +ENDgetWriteFDForSelect + + + + +BEGINmodExit +CODESTARTmodExit +ENDmodExit + + +BEGINqueryEtryPt +CODESTARTqueryEtryPt +CODEqueryEtryPt_STD_OMOD_QUERIES +ENDqueryEtryPt + + +/* set a new GSSMODE based on config directive */ +static rsRetVal setGSSMode(void __attribute__((unused)) *pVal, uchar *mode) +{ + if (!strcmp((char *) mode, "integrity")) { + gss_mode = GSSMODE_MIC; + free(mode); + dbgprintf("GSS-API gssmode set to GSSMODE_MIC\n"); + } else if (!strcmp((char *) mode, "encryption")) { + gss_mode = GSSMODE_ENC; + free(mode); + dbgprintf("GSS-API gssmode set to GSSMODE_ENC\n"); + } else { + logerrorSz("unknown gssmode parameter: %s", (char *) mode); + free(mode); + return RS_RET_ERR; + } + + return RS_RET_OK; +} + + +static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal) +{ + gss_mode = GSSMODE_ENC; + if (gss_base_service_name != NULL) { + free(gss_base_service_name); + gss_base_service_name = NULL; + } + return RS_RET_OK; +} + + +BEGINmodInit() +CODESTARTmodInit + *ipIFVersProvided = 1; /* so far, we only support the initial definition */ +CODEmodInit_QueryRegCFSLineHdlr + CHKiRet(omsdRegCFSLineHdlr((uchar *)"gssforwardservicename", 0, eCmdHdlrGetWord, NULL, &gss_base_service_name, STD_LOADABLE_MODULE_ID)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"gssmode", 0, eCmdHdlrGetWord, setGSSMode, &gss_mode, STD_LOADABLE_MODULE_ID)); + CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID)); +ENDmodInit + +#endif /* #ifdef USE_GSSAPI */ +/* + * vi:set ai: + */ diff --git a/rsyslog.h b/rsyslog.h index c08c5db9..330b9a43 100644 --- a/rsyslog.h +++ b/rsyslog.h @@ -69,6 +69,10 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_INVALID_SOURCE = -2019, /**< source (address) invalid for some reason */ RS_RET_ADDRESS_UNKNOWN = -2020, /**< an address is unknown - not necessarily an error */ RS_RET_MALICIOUS_ENTITY = -2021, /**< there is an malicious entity involved */ + RS_RET_TCP_SEND_ERROR = -2023, /**< error during TCP send process */ + RS_RET_GSS_SEND_ERROR = -2024, /**< error during GSS (via TCP) send process */ + RS_RET_TCP_SOCKCREATE_ERR = -2025, /**< error during creation of TCP socket */ + RS_RET_GSS_SENDINIT_ERROR = -2024, /**< error during GSS (via TCP) send initialization process */ RS_RET_OK_DELETE_LISTENTRY = 1, /**< operation successful, but callee requested the deletion of an entry (special state) */ RS_RET_OK = 0 /**< operation successful */ }; diff --git a/tcpsyslog.c b/tcpsyslog.c index a6d7322b..2527b2e3 100644 --- a/tcpsyslog.c +++ b/tcpsyslog.c @@ -983,6 +983,282 @@ void TCPSessGSSDeinit(void) { * ### END OF SYSLOG/TCP CODE ### ********************************************************************/ +/* ----------------------------------------------------------------- * + * CODE THAT SHALL GO INTO ITS OWN MODULE (SENDING) * + * ----------------------------------------------------------------- */ + +/* Initialize TCP sockets (for sender) + * This is done once per selector line, if not yet initialized. + */ +int TCPSendCreateSocket(struct addrinfo *addrDest) +{ + int fd; + struct addrinfo *r; + + r = addrDest; + + while(r != NULL) { + fd = socket(r->ai_family, r->ai_socktype, r->ai_protocol); + if (fd != -1) { + /* We can not allow the TCP sender to block syslogd, at least + * not in a single-threaded design. That would cause rsyslogd to + * loose input messages - which obviously also would affect + * other selector lines, too. So we do set it to non-blocking and + * handle the situation ourselfs (by discarding messages). IF we run + * dual-threaded, however, the situation is different: in this case, + * the receivers and the selector line processing are only loosely + * coupled via a memory buffer. Now, I think, we can afford the extra + * wait time. Thus, we enable blocking mode for TCP if we compile with + * pthreads. -- rgerhards, 2005-10-25 + * And now, we always run on multiple threads... -- rgerhards, 2007-12-20 + */ + if (connect (fd, r->ai_addr, r->ai_addrlen) != 0) { + if(errno == EINPROGRESS) { + /* this is normal - will complete later select */ + return fd; + } else { + char errStr[1024]; + dbgprintf("create tcp connection failed, reason %s", + strerror_r(errno, errStr, sizeof(errStr))); + } + + } + else { + return fd; + } + close(fd); + } + else { + char errStr[1024]; + dbgprintf("couldn't create send socket, reason %s", strerror_r(errno, errStr, sizeof(errStr))); + } + r = r->ai_next; + } + + dbgprintf("no working socket could be obtained"); + + return -1; +} + + + +/* Build frame based on selected framing + * This function was created by pulling code from TCPSend() + * on 2007-12-27 by rgerhards. Older comments are still relevant. + * + * In order to support compressed messages via TCP, we must support an + * octet-counting based framing (LF may be part of the compressed message). + * We are now supporting the same mode that is available in IETF I-D + * syslog-transport-tls-05 (current at the time of this writing). This also + * eases things when we go ahead and implement that framing. I have now made + * available two cases where this framing is used: either by explitely + * specifying it in the config file or implicitely when sending a compressed + * message. In the later case, compressed and uncompressed messages within + * the same session have different framings. If it is explicitely set to + * octet-counting, only this framing mode is used within the session. + * rgerhards, 2006-12-07 + */ +static rsRetVal TCPSendBldFrame(TCPFRAMINGMODE rqdFraming, char **pmsg, size_t *plen, int *pbMustBeFreed) +{ + DEFiRet; + TCPFRAMINGMODE framingToUse; + int bIsCompressed; + size_t len; + char *msg; + char *buf = NULL; /* if this is non-NULL, it MUST be freed before return! */ + + assert(plen != NULL); + assert(pbMustBeFreed != NULL); + assert(pmsg != NULL); + + msg = *pmsg; + len = *plen; + bIsCompressed = *msg == 'z'; /* cache this, so that we can modify the message buffer */ + /* select framing for this record. If we have a compressed record, we always need to + * use octet counting because the data potentially contains all control characters + * including LF. + */ + framingToUse = bIsCompressed ? TCP_FRAMING_OCTET_COUNTING : rqdFraming; + + /* now check if we need to add a line terminator. We need to + * copy the string in memory in this case, this is probably + * quicker than using writev and definitely quicker than doing + * two socket calls. + * rgerhards 2005-07-22 + * + * Some messages already contain a \n character at the end + * of the message. We append one only if we there is not + * already one. This seems the best fit, though this also + * means the message does not arrive unaltered at the final + * destination. But in the spirit of legacy syslog, this is + * probably the best to do... + * rgerhards 2005-07-20 + */ + + /* Build frame based on selected framing */ + if(framingToUse == TCP_FRAMING_OCTET_STUFFING) { + if((*(msg+len-1) != '\n')) { + /* in the malloc below, we need to add 2 to the length. The + * reason is that we a) add one character and b) len does + * not take care of the '\0' byte. Up until today, it was just + * +1 , which caused rsyslogd to sometimes dump core. + * I have added this comment so that the logic is not accidently + * changed again. rgerhards, 2005-10-25 + */ + if((buf = malloc((len + 2) * sizeof(char))) == NULL) { + /* extreme mem shortage, try to solve + * as good as we can. No point in calling + * any alarms, they might as well run out + * of memory (the risk is very high, so we + * do NOT risk that). If we have a message of + * more than 1 byte (what I guess), we simply + * overwrite the last character. + * rgerhards 2005-07-22 + */ + if(len > 1) { + *(msg+len-1) = '\n'; + } else { + /* we simply can not do anything in + * this case (its an error anyhow...). + */ + } + } else { + /* we got memory, so we can copy the message */ + memcpy(buf, msg, len); /* do not copy '\0' */ + *(buf+len) = '\n'; + *(buf+len+1) = '\0'; + msg = buf; /* use new one */ + ++len; /* care for the \n */ + } + } + } else { + /* Octect-Counting + * In this case, we need to always allocate a buffer. This is because + * we need to put a header in front of the message text + */ + char szLenBuf[16]; + int iLenBuf; + + /* important: the printf-mask is "%d" because there must be a + * space after the len! + *//* The chairs of the IETF syslog-sec WG have announced that it is + * consensus to do the octet count on the SYSLOG-MSG part only. I am + * now changing the code to reflect this. Hopefully, it will not change + * once again (there can no compatibility layer programmed for this). + * To be on the save side, I just comment the code out. I mark these + * comments with "IETF20061218". + * rgerhards, 2006-12-19 + */ + iLenBuf = snprintf(szLenBuf, sizeof(szLenBuf)/sizeof(char), "%d ", (int) len); + /* IETF20061218 iLenBuf = + snprintf(szLenBuf, sizeof(szLenBuf)/sizeof(char), "%d ", len + iLenBuf);*/ + + if((buf = malloc((len + iLenBuf) * sizeof(char))) == NULL) { + /* we are out of memory. This is an extreme situation. We do not + * call any alarm handlers because they most likely run out of mem, + * too. We are brave enough to call debug output, though. Other than + * that, there is nothing left to do. We can not sent the message (as + * in case of the other framing, because the message is incomplete. + * We could, however, send two chunks (header and text separate), but + * that would cause a lot of complexity in the code. So we think it + * is appropriate enough to just make sure we do not crash in this + * very unlikely case. For this, it is justified just to loose + * the message. Rgerhards, 2006-12-07 + */ + dbgprintf("Error: out of memory when building TCP octet-counted " + "frame. Message is lost, trying to continue.\n"); + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); + } + + memcpy(buf, szLenBuf, iLenBuf); /* header */ + memcpy(buf + iLenBuf, msg, len); /* message */ + len += iLenBuf; /* new message size */ + msg = buf; /* set message buffer */ + } + + /* frame building complete, on to actual sending */ + + *plen = len; + if(buf == NULL) { + /* msg not modified */ + *pbMustBeFreed = 0; + } else { + *pmsg = msg; + *pbMustBeFreed = 1; + } + +finalize_it: + return iRet; +} + + +/* Sends a TCP message. It is first checked if the + * session is open and, if not, it is opened. Then the send + * is tried. If it fails, one silent re-try is made. If the send + * fails again, an error status (-1) is returned. If all goes well, + * 0 is returned. The TCP session is NOT torn down. + * For now, EAGAIN is ignored (causing message loss) - but it is + * hard to do something intelligent in this case. With this + * implementation here, we can not block and/or defer. Things are + * probably a bit better when we move to liblogging. The alternative + * would be to enhance the current select server with buffering and + * write descriptors. This seems not justified, given the expected + * short life span of this code (and the unlikeliness of this event). + * rgerhards 2005-07-06 + * This function is now expected to stay. Libloging won't be used for + * that purpose. I have added the param "len", because it is known by the + * caller and so saves us some time. Also, it MUST be given because there + * may be NULs inside msg so that we can not rely on strlen(). Please note + * that the restrictions outlined above do not existin in multi-threaded + * mode, which we assume will now be most often used. So there is no + * real issue with the potential message loss in single-threaded builds. + * rgerhards, 2006-11-30 + * I greatly restructured the function to be more generic and work + * with function pointers. So it now can be used with any type of transport, + * as long as it follows stream semantics. This was initially done to + * support plain TCP and GSS via common code. + */ +int TCPSend(void *pData, char *msg, size_t len, TCPFRAMINGMODE rqdFraming, + rsRetVal (*initFunc)(void*), + rsRetVal (*sendFunc)(void*, char*, size_t), + rsRetVal (*prepRetryFunc)(void*)) +{ + DEFiRet; + int bDone = 0; + int retry = 0; + int bMsgMustBeFreed = 0;/* must msg be freed at end of function? 0 - no, 1 - yes */ + + assert(pData != NULL); + assert(msg != NULL); + assert(len > 0); + + CHKiRet(TCPSendBldFrame(rqdFraming, &msg, &len, &bMsgMustBeFreed)); + + while(!bDone) { /* loop is broken when send succeeds or error occurs */ + CHKiRet(initFunc(pData)); + iRet = sendFunc(pData, msg, len); + + if(iRet == RS_RET_OK || retry > 0) { + /* we are done - either we succeeded or the retry failed */ + bDone = 1; + } else { /* OK, one retry */ + ++retry; + CHKiRet(prepRetryFunc(pData)); /* try to recover */ + } + } + +finalize_it: + if(bMsgMustBeFreed) + free(msg); + return iRet; +} + + +/* ----------------------------------------------------------------- * + * END OF CODE THAT SHALL GO INTO ITS OWN MODULE * + * ----------------------------------------------------------------- */ + + /* * vi:set ai: diff --git a/tcpsyslog.h b/tcpsyslog.h index 68b4a9c1..de818df1 100644 --- a/tcpsyslog.h +++ b/tcpsyslog.h @@ -73,6 +73,12 @@ void TCPSessGSSClose(int sess); void TCPSessGSSDeinit(void); #endif +/* TCP Send support (shall go into its own module later) */ +int TCPSendCreateSocket(struct addrinfo *addrDest); +int TCPSend(void *pData, char *msg, size_t len, TCPFRAMINGMODE rqdFraming, + rsRetVal (*initFunc)(void*), + rsRetVal (*sendFunc)(void*, char*, size_t), + rsRetVal (*prepRetryFunc)(void*)); #endif /* #ifndef TCPSYSLOG_H_INCLUDED */ /* * vi:set ai: -- cgit From 37f0d7e807ebfd6b8736b3448c813550ab6f6276 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 28 Dec 2007 17:56:41 +0000 Subject: prepared for version 1.21.2 --- ChangeLog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 63ac7b4f..bedb55a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ --------------------------------------------------------------------------- -Version 2.0.0 (rgerhards), 2007-12-26 +Version 1.21.2 (rgerhards), 2007-12-29 +- created a gss-api output module. This keeps GSS-API code and + TCP/UDP code separated. It is also important for forward- + compatibility with v3. Please note that this change breaks compatibility + with config files created for 1.21.0 and 1.21.1 - this was considered + acceptable. +- fixed an error in forwarding retry code (could lead to message corruption + but surfaced very seldom) - increased portability for older platforms (AI_NUMERICSERV moved) - removed socket leak in omfwd.c - cross-platform patch for GSS-API compile problem on some platforms -- cgit From 604f2459c25d32fb4ae70b9bb9b5207388c6d5d8 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 28 Dec 2007 18:00:41 +0000 Subject: prepared for 1.21.2 --- ChangeLog | 2 +- doc/status.html | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bedb55a1..e36aabb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 1.21.2 (rgerhards), 2007-12-29 +Version 1.21.2 (rgerhards), 2007-12-28 - created a gss-api output module. This keeps GSS-API code and TCP/UDP code separated. It is also important for forward- compatibility with v3. Please note that this change breaks compatibility diff --git a/doc/status.html b/doc/status.html index f950d682..8a4f1556 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,11 +4,11 @@

rsyslog status page

-

This page reflects the status as of 2007-12-23.

+

This page reflects the status as of 2007-12-28.

Current Releases

-

development: 1.21.1 - -change log - -download

+

development: 1.21.2 - +change log - +download

stable: 1.0.5 - change log - download

 (How are versions named?)

-- cgit From dad51192651dda011597252ddf8fb64ff28e2ec4 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 28 Dec 2007 18:46:33 +0000 Subject: fixed missing conditional compilation (cosmetic issue) --- tcpsyslog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tcpsyslog.c b/tcpsyslog.c index 2527b2e3..c7693102 100644 --- a/tcpsyslog.c +++ b/tcpsyslog.c @@ -420,7 +420,9 @@ int TCPSessAccept(int fd) uchar fromHost[NI_MAXHOST]; uchar fromHostFQDN[NI_MAXHOST]; char *pBuf; +#ifdef USE_GSSAPI char allowedMethods = 0; +#endif newConn = accept(fd, (struct sockaddr*) &addr, &addrlen); if (newConn < 0) { -- cgit From 6e147ca2210e4b30f12e869acccb95371e79c163 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 2 Jan 2008 13:09:15 +0000 Subject: prepared for 2.0.0 --- doc/history.html | 17 +++- doc/manual.html | 178 +++++++++++++++++++++++---------- doc/rsconf1_gssforwardservicename.html | 1 + doc/rsconf1_gssmode.html | 11 +- doc/status.html | 9 +- 5 files changed, 146 insertions(+), 70 deletions(-) diff --git a/doc/history.html b/doc/history.html index 4cb6d561..0f9dbffa 100644 --- a/doc/history.html +++ b/doc/history.html @@ -90,12 +90,21 @@ extremely hard to find segfault bug. It happens on very rare occasions only and never in lab. We are hunting this bug for month now, but still could not get hold of it. Unfortunately, this also affects the new features schedule. It makes limited sense to implement new features if problems with existing ones are not -really understood.

December 2008 showed the appearance of a postgres +really understood.

December 2007 showed the appearance of a postgres output module, contributed by sur5r. With 1.20.0, December is also the first -time since the bughunt that we introduce other new features. It has been deciced +time since the bug hunt that we introduce other new features. It has been decided that we carefully will add features in order to not affect the overall project -by these rare bugs. Still, the bughunt is top priortiy, but we need to have more -data to analyse.

Be sure to visit Rainer's syslog blog +by these rare bugs. Still, the bug hunt is top priority, but we need to have more +data to analyze. At then end of December, it looked like the bug was found (a +race condition), but further confirmation from the field is required before +declaring victory. December also brings the initial development on rsyslog v3, +resulting in loadable input modules, now running on a separate thread each.

On +January, 2nd 2008, rsyslog 1.21.2 is re-released as rsyslog v2.0.0 +stable. This is a major milestone as far as the stable build is concerned. v3 is +not yet officially announced. Other than the stable v2 build, v3 will not be +backwards compatibile (including missing compatibility to stock sysklogd) for +quite a while. Config file changes are required and some command line options do +no longer work due to the new design.

Be sure to visit Rainer's syslog blog to get some more insight into the development and futures of rsyslog and syslog in general. Don't be shy to post to either the blog or the rsyslog forums.

diff --git a/doc/manual.html b/doc/manual.html index 5a776969..4c3c15a0 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -1,54 +1,124 @@ - - -rsyslog documentation - - -

RSyslog - Documentation

-

Rsyslog is an enhanced syslogd -supporting, among others, MySQL, PostgreSQL, failover log destinations, syslog/tcp, -fine grain output format control, and the ability to filter on any message part. -It is quite compatible to stock -sysklogd and can be used as a drop-in replacement. Its -advanced features make it suitable for enterprise-class, -encryption protected syslog -relay chains while at the same time being very easy to setup -for the novice user.

-

Visit the rsyslog status page to obtain current -version information and ports. If you like rsyslog, you might want to lend us -a helping hand. It doesn't require a lot of time - even a single mouse click -helps. Learn how to help the rsyslog project.

-

Follow the links below for the

- -

We have some in-depth papers on

- -

Also, there is an article from Dennis Olvany on -Syslog-to-SQL with rsyslog-0.8.4 on FreeBSD 5.4 -(which unfortunately is a bit outdated now).

-

Our rsyslog history page is for you if you would like to learn a little more -on why there is an rsyslog at all. If you are interested why you should care about rsyslog at all, you may want to read Rainer's essay on "why the world needs another syslogd".

-

Documentation is added continuously. Please note that the documentation here -matches only the current version of rsyslog. If you use an older version, be sure -to use the doc that came with it.

-

You can also browse the following online resources:

- -

And don't forget about the rsyslog mailing list. -If you are interested in the "backstage", you may find -Rainer's -blog an interesting read (filter on syslog and rsyslog tags).

- - + + + + +rsyslog documentation + + + + + +

RSyslog - Documentation

+ +

Rsyslog is an enhanced syslogd + +supporting, among others, MySQL, +PostgreSQL, +failover log +destinations, syslog/tcp, + +fine grain output format control, and the ability to filter on any message part. + +It is quite compatible to stock + +sysklogd and can be used as a drop-in replacement. Its + +advanced features make it suitable for enterprise-class, + +encryption protected syslog + +relay chains while at the same time being very easy to setup + +for the novice user.

+ +

Visit the rsyslog status page to obtain current + +version information and ports. If you like rsyslog, you might want to lend us + +a helping hand. It doesn't require a lot of time - even a single mouse click + +helps. Learn how to help the rsyslog project.

+ +

Follow the links below for the

+ + + +

We have some in-depth papers on

+ + + +

Also, there is an article from Dennis Olvany on + +Syslog-to-SQL with rsyslog-0.8.4 on FreeBSD 5.4 + +(which unfortunately is a bit outdated now).

+ +

Our rsyslog history page is for you if you would like to learn a little more + +on why there is an rsyslog at all. If you are interested why you should care +about rsyslog at all, you may want to read Rainer's essay on "why +the world needs another syslogd".

+ +

Documentation is added continuously. Please note that the documentation here + +matches only the current version of rsyslog. If you use an older version, be sure + +to use the doc that came with it.

+ +

You can also browse the following online resources:

+ + + +

And don't forget about the rsyslog mailing list. + +If you are interested in the "backstage", you may find + +Rainer's + +blog an interesting read (filter on +syslog and rsyslog tags).

+ + + + + diff --git a/doc/rsconf1_gssforwardservicename.html b/doc/rsconf1_gssforwardservicename.html index 63ca9c1f..9d39dc2a 100644 --- a/doc/rsconf1_gssforwardservicename.html +++ b/doc/rsconf1_gssforwardservicename.html @@ -6,6 +6,7 @@

$GssForwardServiceName

Type: global configuration directive

Default: host

+

Provided by: omgssapi

Description:

Specifies the service name used by the client when forwarding GSS-API wrapped messages.

The GSS-API service names are constructed by appending '@' and a hostname following "@@" in each selector.

diff --git a/doc/rsconf1_gssmode.html b/doc/rsconf1_gssmode.html index 6981f1fe..71c50696 100644 --- a/doc/rsconf1_gssmode.html +++ b/doc/rsconf1_gssmode.html @@ -5,13 +5,12 @@

$GssMode

Type: global configuration directive

-

Default: none

+

Default: encryption

+

Provided by: omgssapi

Description:

-

Specifies GSS-API mode to use, which can be "none" - GSS-API - is disabled, "integrity" - clients are authenticated and - messages are checked for integrity, "encryption" - same as - "integrity", but messages are also encrypted if both sides support it. -

Sample:

+

Specifies GSS-API mode to use, which can be "integrity" - clients are authenticated and + messages are checked for integrity, "encryption" - same as + "integrity", but messages are also encrypted if both sides support it.

Sample:

$GssMode Encryption

[rsyslog.conf overview] [manual diff --git a/doc/status.html b/doc/status.html index 8a4f1556..86d1844c 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,17 +4,14 @@

rsyslog status page

-

This page reflects the status as of 2007-12-28.

+

This page reflects the status as of 2008-01-01.

Current Releases

development: 1.21.2 - change log - download

-

stable: 1.0.5 - change log - -download

+

stable: 2.0.0 - change log - +download

 (How are versions named?)

-

Do NOT use versions prior to 1.10.1 or 1.0.1, -because they contain a SQL injection vulnerability (read -security advisory).

Platforms

Thankfully, a number of folks have begin to build packages and help port rsyslog to other platforms. As such, -- cgit From 96e2f60ec61e1614709dd09a73a94701aca55161 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 2 Jan 2008 13:14:02 +0000 Subject: removed unneccessary (and non-existing) header --- plugins/omgssapi/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/omgssapi/Makefile.am b/plugins/omgssapi/Makefile.am index 3b568d3d..9fa6a241 100644 --- a/plugins/omgssapi/Makefile.am +++ b/plugins/omgssapi/Makefile.am @@ -1,6 +1,6 @@ pkglib_LTLIBRARIES = omgssapi.la -omgssapi_la_SOURCES = omgssapi.c omgssapi.h ../../module-template.h +omgssapi_la_SOURCES = omgssapi.c ../../module-template.h omgssapi_la_CPPFLAGS = $(pgsql_cflags) -I$(srcdir)/../.. omgssapi_la_LDFLAGS = -module -avoid-version omgssapi_la_LIBADD = $(gss_libs) -- cgit From cefaff37c6385bdc0b60ea69808c6d942db44c51 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 2 Jan 2008 13:15:22 +0000 Subject: preparing for 2.0.0 --- ChangeLog | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e36aabb0..b4603389 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ --------------------------------------------------------------------------- +Version 2.0.0 STABLE (rgerhards), 2008-01-02 +- re-release of 1.21.2 as STABLE with no modifications except some + doc updates +--------------------------------------------------------------------------- Version 1.21.2 (rgerhards), 2007-12-28 - created a gss-api output module. This keeps GSS-API code and TCP/UDP code separated. It is also important for forward- diff --git a/configure.ac b/configure.ac index 03e285a3..4659f495 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[1.21.2],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) -- cgit From e4d08143bb6c246bf33cc6407bb61c5f3ce18391 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 3 Jan 2008 08:46:23 +0000 Subject: fixed typo pointed out by Jonathan Smith - thanks! --- rsyslogd.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsyslogd.8 b/rsyslogd.8 index 0c4fcf35..58aec529 100644 --- a/rsyslogd.8 +++ b/rsyslogd.8 @@ -78,7 +78,7 @@ While the .B rsyslogd sources have been heavily modified a couple of notes are in order. First of all there has been a systematic attempt to -insure that rsyslogd follows its default, standard BSD behavior. Of course, +ensure that rsyslogd follows its default, standard BSD behavior. Of course, some configuration file changes are necessary in order to support the template system. However, rsyslogd should be able to use a standard syslog.conf and act like the orginal syslogd. However, an original syslogd -- cgit From 7eb0a763c32c9887dd0b1523ac154757f641e27e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sun, 6 Jan 2008 11:46:19 +0000 Subject: fixed a bug in integer conversion --- srUtils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/srUtils.c b/srUtils.c index acd8edd9..9dcea299 100755 --- a/srUtils.c +++ b/srUtils.c @@ -78,9 +78,10 @@ rsRetVal srUtilItoA(char *pBuf, int iLenBuf, int iToConv) i = 0; do { - szBuf[i] = iToConv % 10 + '0'; + szBuf[i++] = iToConv % 10 + '0'; iToConv /= 10; } while(iToConv > 0); /* warning: do...while()! */ + --i; /* undo last increment - we were pointing at NEXT location */ /* make sure we are within bounds... */ if(i + 2 > iLenBuf) /* +2 because: a) i starts at zero! b) the \0 byte */ -- cgit From 3b176b63e167c0d3ca0aefdd549b667bd863a1f0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 14 Jan 2008 13:30:15 +0000 Subject: fixed a bug with standard template definitions (not a big deal) - thanks to varmojfekoj for spotting it --- ChangeLog | 6 ++++++ configure.ac | 2 +- syslogd.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4603389..c8c0558f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ --------------------------------------------------------------------------- +Version 2.0.1 STABLE (rgerhards), 2008-01-?? +- fixed a bug in integer conversion - but this function was never called, + so it is not really a useful bug fix ;) +- fixed a bug with standard template definitions (not a big deal) - thanks + to varmojfekoj for spotting it +--------------------------------------------------------------------------- Version 2.0.0 STABLE (rgerhards), 2008-01-02 - re-release of 1.21.2 as STABLE with no modifications except some doc updates diff --git a/configure.ac b/configure.ac index 4659f495..c2fd803b 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.0],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.1],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/syslogd.c b/syslogd.c index c562b4ed..818f5f35 100644 --- a/syslogd.c +++ b/syslogd.c @@ -6222,7 +6222,7 @@ static void mainThread() pTmp = template_StdUsrMsgFmt; tplAddLine(" StdUsrMsgFmt", &pTmp); pTmp = template_StdDBFmt; - tplLastStaticInit(tplAddLine(" StdDBFmt", &pTmp)); + tplAddLine(" StdDBFmt", &pTmp); pTmp = template_StdPgSQLFmt; tplLastStaticInit(tplAddLine(" StdPgSQLFmt", &pTmp)); -- cgit From 5abc990a6a2178bbc730a43bd0ee9b433abc8303 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 24 Jan 2008 07:27:08 +0000 Subject: fixed a bug that caused a potential hang in file and fwd output module varmojfekoj provided the patch - many thanks! --- ChangeLog | 4 +++- omfile.c | 2 ++ omfwd.c | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8c0558f..1a28dbc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,11 @@ --------------------------------------------------------------------------- -Version 2.0.1 STABLE (rgerhards), 2008-01-?? +Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, so it is not really a useful bug fix ;) - fixed a bug with standard template definitions (not a big deal) - thanks to varmojfekoj for spotting it +- fixed a bug that caused a potential hang in file and fwd output module + varmojfekoj provided the patch - many thanks! --------------------------------------------------------------------------- Version 2.0.0 STABLE (rgerhards), 2008-01-02 - re-release of 1.21.2 as STABLE with no modifications except some diff --git a/omfile.c b/omfile.c index 3691d981..cd5e23c4 100644 --- a/omfile.c +++ b/omfile.c @@ -357,6 +357,7 @@ static void prepareFile(instanceData *pData, uchar *newFileName) pData->fd = open((char*) newFileName, O_WRONLY|O_APPEND|O_CREAT|O_NOCTTY, pData->fCreateMode); } else { + pData->fd = -1; /* file does not exist, create it (and eventually parent directories */ if(pData->bCreateDirs) { /* we fist need to create parent dirs if they are missing @@ -596,6 +597,7 @@ again: BEGINcreateInstance CODESTARTcreateInstance + pData->fd = -1; ENDcreateInstance diff --git a/omfwd.c b/omfwd.c index f01e0459..9b56acd5 100644 --- a/omfwd.c +++ b/omfwd.c @@ -116,6 +116,7 @@ typedef struct _instanceData { BEGINcreateInstance CODESTARTcreateInstance + pData->sock = -1; ENDcreateInstance @@ -278,8 +279,8 @@ static rsRetVal TCPSendInit(void *pvData) instanceData *pData = (instanceData *) pvData; assert(pData != NULL); - if(pData->sock <= 0) { - if((pData->sock = TCPSendCreateSocket(pData->f_addr)) <= 0) + if(pData->sock < 0) { + if((pData->sock = TCPSendCreateSocket(pData->f_addr)) < 0) iRet = RS_RET_TCP_SOCKCREATE_ERR; } -- cgit From f8ab81bbb46f6ac1e2a27178356f6122cf90ec07 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 24 Jan 2008 07:36:25 +0000 Subject: perparing for 2.0.1 --- doc/status.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/status.html b/doc/status.html index 86d1844c..f8b6c7a8 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,13 +4,17 @@

rsyslog status page

-

This page reflects the status as of 2008-01-01.

+

This page reflects the status as of 2008-01-24.

Current Releases

-

development: 1.21.2 - -change log - -download

-

stable: 2.0.0 - change log - -download

+

development: 3.10.2 - +change log - +download

+

Be sure to read the +rsyslog v3 compatibility document!
+Documentation for 3.x is currently sparse. If you need assistance, please +post in the rsyslog forums!

+

stable: 2.0.1 - change log - +download

 (How are versions named?)

Platforms

Thankfully, a number of folks have begin to build packages and help port -- cgit From 2dd6d08b5d4ec053095d532dc1540f6630553c9b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 30 Jan 2008 13:20:58 +0000 Subject: - fixed a bug that could cause invalid string handling via strerror_r varmojfekoj provided the patch - many thanks! --- ChangeLog | 4 ++++ configure.ac | 3 ++- net.c | 2 +- omfwd.c | 2 +- rfc3195d.c | 6 +++--- syslogd.c | 22 ++++++++++++++++++---- syslogd.h | 1 + tcpsyslog.c | 4 ++-- 8 files changed, 32 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a28dbc2..d3cb5095 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ --------------------------------------------------------------------------- +Version 2.0.2 STABLE (rgerhards), 2008-02-?? +- fixed a bug that could cause invalid string handling via strerror_r + varmojfekoj provided the patch - many thanks! +--------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, so it is not really a useful bug fix ;) diff --git a/configure.ac b/configure.ac index c2fd803b..6ca8bb41 100644 --- a/configure.ac +++ b/configure.ac @@ -81,9 +81,10 @@ AC_FUNC_REALLOC AC_FUNC_SELECT_ARGTYPES AC_TYPE_SIGNAL AC_FUNC_STAT +AC_FUNC_STRERROR_R AC_FUNC_VPRINTF AC_FUNC_WAIT3 -AC_CHECK_FUNCS([alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strerror_r strndup strnlen strrchr strstr strtol strtoul uname ttyname_r]) +AC_CHECK_FUNCS([alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r]) # Large file support diff --git a/net.c b/net.c index bf20b9eb..a546e3f5 100644 --- a/net.c +++ b/net.c @@ -66,7 +66,7 @@ int should_use_so_bsdcompat(void) init_done = 1; if (uname(&utsname) < 0) { char errStr[1024]; - dbgprintf("uname: %s\r\n", strerror_r(errno, errStr, sizeof(errStr))); + dbgprintf("uname: %s\r\n", rs_strerror_r(errno, errStr, sizeof(errStr))); return 1; } /* Format is .. diff --git a/omfwd.c b/omfwd.c index 9b56acd5..afa60307 100644 --- a/omfwd.c +++ b/omfwd.c @@ -441,7 +441,7 @@ CODESTARTdoAction int eno = errno; char errStr[1024]; dbgprintf("sendto() error: %d = %s.\n", - eno, strerror_r(eno, errStr, sizeof(errStr))); + eno, rs_strerror_r(eno, errStr, sizeof(errStr))); } } if (lsent == l && !send_to_all) diff --git a/rfc3195d.c b/rfc3195d.c index 7588fb94..e7d13e03 100644 --- a/rfc3195d.c +++ b/rfc3195d.c @@ -96,7 +96,7 @@ static void openlog() if(LogFile < 0) { char errStr[1024]; printf("error opening '%s': %s\n", - pPathLogname, strerror_r(errno, errStr, sizeof(errStr))); + pPathLogname, rs_strerror_r(errno, errStr, sizeof(errStr))); } } if (LogFile != -1 && !connected && @@ -106,7 +106,7 @@ static void openlog() else { char errStr[1024]; printf("error connecting '%s': %s\n", - pPathLogname, strerror_r(errno, errStr, sizeof(errStr))); + pPathLogname, rs_strerror_r(errno, errStr, sizeof(errStr))); } } @@ -162,7 +162,7 @@ void OnReceive(srAPIObj* pAPI, srSLMGObj* pSLMG) if(nWritten < 0) { /* error, recover! */ char errStr[1024]; - printf("error writing to domain socket: %s\r\n", strerror_r(errno, errStr, sizeof(errStr))); + printf("error writing to domain socket: %s\r\n", rs_strerror_r(errno, errStr, sizeof(errStr))); closelog(); } else { /* prepare for (potential) next write */ diff --git a/syslogd.c b/syslogd.c index 818f5f35..883bf00a 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3563,7 +3563,7 @@ void logerror(char *type) if (errno == 0) snprintf(buf, sizeof(buf), "%s", type); else { - strerror_r(errno, errStr, sizeof(errStr)); + rs_strerror_r(errno, errStr, sizeof(errStr)); snprintf(buf, sizeof(buf), "%s: %s", type, errStr); } buf[sizeof(buf)/sizeof(char) - 1] = '\0'; /* just to be on the safe side... */ @@ -4349,7 +4349,7 @@ finalize_it: if(fCurr != NULL) selectorDestruct(fCurr); - strerror_r(errno, errStr, sizeof(errStr)); + rs_strerror_r(errno, errStr, sizeof(errStr)); dbgprintf("error %d processing config file '%s'; os error (if any): %s\n", iRet, pConfFile, errStr); } @@ -5466,6 +5466,20 @@ void dbgprintf(char *fmt, ...) } +char *rs_strerror_r(int errnum, char *buf, size_t buflen) { +#ifdef STRERROR_R_CHAR_P + char *p = strerror_r(errnum, buf, buflen); + if (p != buf) { + strncpy(buf, p, buflen); + buf[buflen - 1] = '\0'; + } +#else + strerror_r(errnum, buf, buflen); +#endif + return buf; +} + + /* * The following function is resposible for handling a SIGHUP signal. Since * we are now doing mallocs/free as part of init we had better not being @@ -5727,7 +5741,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se printchopped(LocalHostName, line, iRcvd, fd, funixParseHost[i]); } else if (iRcvd < 0 && errno != EINTR) { char errStr[1024]; - strerror_r(errno, errStr, sizeof(errStr)); + rs_strerror_r(errno, errStr, sizeof(errStr)); dbgprintf("UNIX socket error: %d = %s.\n", \ errno, errStr); logerror("recvfrom UNIX"); @@ -5768,7 +5782,7 @@ static rsRetVal processSelectAfter(int maxfds, int nfds, fd_set *pReadfds, fd_se } } else if (l < 0 && errno != EINTR && errno != EAGAIN) { char errStr[1024]; - strerror_r(errno, errStr, sizeof(errStr)); + rs_strerror_r(errno, errStr, sizeof(errStr)); dbgprintf("INET socket error: %d = %s.\n", errno, errStr); logerror("recvfrom inet"); /* should be harmless */ diff --git a/syslogd.h b/syslogd.h index aefe13b0..e846c8e4 100644 --- a/syslogd.h +++ b/syslogd.h @@ -48,6 +48,7 @@ #define MARK 0x008 /* this message is a mark */ void dbgprintf(char *, ...); +char *rs_strerror_r(int errnum, char *buf, size_t buflen); void logerror(char *type); void logerrorSz(char *type, char *errMsg); void logerrorInt(char *type, int iErr); diff --git a/tcpsyslog.c b/tcpsyslog.c index c7693102..311e4308 100644 --- a/tcpsyslog.c +++ b/tcpsyslog.c @@ -1021,7 +1021,7 @@ int TCPSendCreateSocket(struct addrinfo *addrDest) } else { char errStr[1024]; dbgprintf("create tcp connection failed, reason %s", - strerror_r(errno, errStr, sizeof(errStr))); + rs_strerror_r(errno, errStr, sizeof(errStr))); } } @@ -1032,7 +1032,7 @@ int TCPSendCreateSocket(struct addrinfo *addrDest) } else { char errStr[1024]; - dbgprintf("couldn't create send socket, reason %s", strerror_r(errno, errStr, sizeof(errStr))); + dbgprintf("couldn't create send socket, reason %s", rs_strerror_r(errno, errStr, sizeof(errStr))); } r = r->ai_next; } -- cgit From 3896b8c5fe0b0058310a8135660fb74822a89ede Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 30 Jan 2008 13:48:56 +0000 Subject: one more strerror_r fix ;) --- pidfile.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/pidfile.c b/pidfile.c index e153a4ed..a0b41579 100644 --- a/pidfile.c +++ b/pidfile.c @@ -39,6 +39,21 @@ #include #endif + +static char *rs_strerror_r(int errnum, char *buf, size_t buflen) { +#ifdef STRERROR_R_CHAR_P + char *p = strerror_r(errnum, buf, buflen); + if (p != buf) { + strncpy(buf, p, buflen); + buf[buflen - 1] = '\0'; + } +#else + strerror_r(errnum, buf, buflen); +#endif + return buf; +} + + /* read_pid * * Reads the specified pidfile and returns the read pid. @@ -120,7 +135,7 @@ int write_pid (char *pidfile) pid = getpid(); if (!fprintf(f,"%d\n", pid)) { char errStr[1024]; - strerror_r(errno, errStr, sizeof(errStr)); + rs_strerror_r(errno, errStr, sizeof(errStr)); printf("Can't write pid , %s.\n", errStr); close(fd); return 0; @@ -130,7 +145,7 @@ int write_pid (char *pidfile) #ifndef __sun if (flock(fd, LOCK_UN) == -1) { char errStr[1024]; - strerror_r(errno, errStr, sizeof(errStr)); + rs_strerror_r(errno, errStr, sizeof(errStr)); printf("Can't unlock pidfile %s, %s.\n", pidfile, errStr); close(fd); return 0; -- cgit From 886bcc2dec65590dfe893d7d02bd28d480a8e876 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 11 Feb 2008 07:15:03 +0000 Subject: added x-info field to rsyslogd startup/shutdown message. Hopefully points users to right location for further info (many don't even know they run rsyslog ;)) --- ChangeLog | 3 +++ syslogd.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d3cb5095..24370bc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ Version 2.0.2 STABLE (rgerhards), 2008-02-?? - fixed a bug that could cause invalid string handling via strerror_r varmojfekoj provided the patch - many thanks! +- added x-info field to rsyslogd startup/shutdown message. Hopefully + points users to right location for further info (many don't even know + they run rsyslog ;)) --------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, diff --git a/syslogd.c b/syslogd.c index 883bf00a..2858b863 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3605,7 +3605,7 @@ static void die(int sig) dbgprintf(" exiting on signal %d\n", sig); (void) snprintf(buf, sizeof(buf) / sizeof(char), " [origin software=\"rsyslogd\" " "swVersion=\"" VERSION \ - "\" x-pid=\"%d\"]" " exiting on signal %d.", + "\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"]" " exiting on signal %d.", (int) myPid, sig); errno = 0; logmsgInternal(LOG_SYSLOG|LOG_INFO, buf, ADDDATE); @@ -4576,7 +4576,7 @@ static void init(void) */ snprintf(bufStartUpMsg, sizeof(bufStartUpMsg)/sizeof(char), " [origin software=\"rsyslogd\" " "swVersion=\"" VERSION \ - "\" x-pid=\"%d\"][x-configInfo udpReception=\"%s\" " \ + "\" x-pid=\"%d\" x-info=\"http://www.rsyslog.com\"][x-configInfo udpReception=\"%s\" " \ "udpPort=\"%s\" tcpReception=\"%s\" tcpPort=\"%s\"]" \ " restart", (int) myPid, -- cgit From 3141c15442cdb669d6e5a609011e655e2b1e8815 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 11 Feb 2008 07:29:01 +0000 Subject: bugfix: suspended actions were not always properly resumed varmojfekoj provided the patch - many thanks! --- ChangeLog | 2 ++ syslogd.c | 13 ++++++++++++- tcpsyslog.c | 6 +++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24370bc9..065956b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ Version 2.0.2 STABLE (rgerhards), 2008-02-?? - added x-info field to rsyslogd startup/shutdown message. Hopefully points users to right location for further info (many don't even know they run rsyslog ;)) +- bugfix: suspended actions were not always properly resumed + varmojfekoj provided the patch - many thanks! --------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, diff --git a/syslogd.c b/syslogd.c index 2858b863..cfe239ac 100644 --- a/syslogd.c +++ b/syslogd.c @@ -2491,7 +2491,7 @@ static rsRetVal callAction(msg_t *pMsg, action_t *pAction) */ if(pAction->f_pMsg != NULL) { if(pAction->f_prevcount > 0) - fprintlog(pAction); + CHKiRet(fprintlog(pAction)); /* we do not care about iRet above - I think it's right but if we have * some troubles, you know where to look at ;) -- rgerhards, 2007-08-01 */ @@ -3437,9 +3437,15 @@ DEFFUNC_llExecFunc(domarkActions) dbgprintf("flush %s: repeated %d times, %d sec.\n", modGetStateName(pAction->pMod), pAction->f_prevcount, repeatinterval[pAction->f_repeatcount]); + if(actionIsSuspended(pAction) && + (actionTryResume(pAction) != RS_RET_OK)) { + goto finalize_it; + } fprintlog(pAction); BACKOFF(pAction); } + +finalize_it: UnlockObj(pAction); return RS_RET_OK; /* we ignore errors, we can not do anything either way */ @@ -4109,9 +4115,14 @@ DEFFUNC_llExecFunc(freeSelectorsActions) /* flush any pending output */ if(pAction->f_prevcount) { + if(actionIsSuspended(pAction) && + (actionTryResume(pAction) != RS_RET_OK)) { + goto finalize_it; + } fprintlog(pAction); } +finalize_it: return RS_RET_OK; /* never fails ;) */ } diff --git a/tcpsyslog.c b/tcpsyslog.c index 311e4308..6b1c446c 100644 --- a/tcpsyslog.c +++ b/tcpsyslog.c @@ -1020,7 +1020,7 @@ int TCPSendCreateSocket(struct addrinfo *addrDest) return fd; } else { char errStr[1024]; - dbgprintf("create tcp connection failed, reason %s", + dbgprintf("create tcp connection failed, reason %s\n", rs_strerror_r(errno, errStr, sizeof(errStr))); } @@ -1032,12 +1032,12 @@ int TCPSendCreateSocket(struct addrinfo *addrDest) } else { char errStr[1024]; - dbgprintf("couldn't create send socket, reason %s", rs_strerror_r(errno, errStr, sizeof(errStr))); + dbgprintf("couldn't create send socket, reason %s\n", rs_strerror_r(errno, errStr, sizeof(errStr))); } r = r->ai_next; } - dbgprintf("no working socket could be obtained"); + dbgprintf("no working socket could be obtained\n"); return -1; } -- cgit From 463e2d8f186e631d07cf8e45b62c725fbc817f8e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 11 Feb 2008 07:34:15 +0000 Subject: a small inline doc fix --- syslogd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/syslogd.c b/syslogd.c index cfe239ac..c6c5dc2f 100644 --- a/syslogd.c +++ b/syslogd.c @@ -2492,9 +2492,11 @@ static rsRetVal callAction(msg_t *pMsg, action_t *pAction) if(pAction->f_pMsg != NULL) { if(pAction->f_prevcount > 0) CHKiRet(fprintlog(pAction)); - /* we do not care about iRet above - I think it's right but if we have - * some troubles, you know where to look at ;) -- rgerhards, 2007-08-01 - */ + /* if we run into trouble (most importantly a suspended + * action), we keep the old message (by virtue of not + * destructing it) and discard the new one (done + * automatically when we return. + */ MsgDestruct(pAction->f_pMsg); } pAction->f_pMsg = MsgAddRef(pMsg); -- cgit From a745208787f3b2752e17d3171ca3e2a2f4f0d5c4 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 11 Feb 2008 07:47:27 +0000 Subject: bugfix: errno could be changed during mark processing, leading to invalid error messages when processing inputs. Thank to varmojfekoj for pointing out this problem. --- ChangeLog | 3 +++ syslogd.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 065956b9..172f3f31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ Version 2.0.2 STABLE (rgerhards), 2008-02-?? they run rsyslog ;)) - bugfix: suspended actions were not always properly resumed varmojfekoj provided the patch - many thanks! +- bugfix: errno could be changed during mark processing, leading to + invalid error messages when processing inputs. Thank to varmojfekoj for + pointing out this problem. --------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, diff --git a/syslogd.c b/syslogd.c index c6c5dc2f..ad740524 100644 --- a/syslogd.c +++ b/syslogd.c @@ -5898,6 +5898,7 @@ static void mainloop(void) int i; int maxfds; int nfds; + int errnoSave; #ifdef SYSLOG_INET selectHelperWriteFDSInfo_t writeFDSInfo; fd_set writefds; @@ -6036,6 +6037,7 @@ static void mainloop(void) #endif nfds = select(maxfds+1, (fd_set *) &readfds, MAIN_SELECT_WRITEFDS, (fd_set *) NULL, MAIN_SELECT_TIMEVAL); + errnoSave = errno; /* save errno for later reference */ if(bRequestDoMark) { domark(); @@ -6056,6 +6058,7 @@ static void mainloop(void) continue; } + errno = errnoSave; /* restore errno to state right after select (which is what we need) -- rgerhards, 2008-02-11 */ processSelectAfter(maxfds, nfds, &readfds, MAIN_SELECT_WRITEFDS); #undef MAIN_SELECT_TIMEVAL -- cgit From 91b54ed246977cb961977ca400c19b6d5b107583 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 11 Feb 2008 08:47:15 +0000 Subject: bugfix: trailing ":" of tag was lost while parsing legacy syslog messages without timestamp - thanks to Anders Blomdell for providing a patch! --- ChangeLog | 2 ++ syslogd.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 172f3f31..4f2f70a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ Version 2.0.2 STABLE (rgerhards), 2008-02-?? - bugfix: errno could be changed during mark processing, leading to invalid error messages when processing inputs. Thank to varmojfekoj for pointing out this problem. +- bugfix: trailing ":" of tag was lost while parsing legacy syslog messages + without timestamp - thanks to Anders Blomdell for providing a patch! --------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, diff --git a/syslogd.c b/syslogd.c index ad740524..57fffbfe 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3113,7 +3113,9 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) */ if(*p2parse == ':') { bTAGCharDetected = 1; - ++p2parse; + /* We will move hostname to tag, so preserve ':' (otherwise we + * will needlessly change the message format) */ + *pWork++ = *p2parse++; } else if(*p2parse == ' ') ++p2parse; *pWork = '\0'; -- cgit From 14a7c82fadd27446af318c61cb46992802a3aa3c Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 11 Feb 2008 12:51:53 +0000 Subject: bugfix (doc): misspelled config directive, invalid signal info - thanks to Peter Vrabec for pointing this out --- ChangeLog | 1 + configure.ac | 2 +- ...sconf1_actionexeconlyifpreviousissuspended.html | 29 ---------------------- ...onf1_actionexeconlywhenpreviousissuspended.html | 29 ++++++++++++++++++++++ doc/rsyslog_conf.html | 2 +- rsyslogd.8 | 7 +----- 6 files changed, 33 insertions(+), 37 deletions(-) delete mode 100644 doc/rsconf1_actionexeconlyifpreviousissuspended.html create mode 100644 doc/rsconf1_actionexeconlywhenpreviousissuspended.html diff --git a/ChangeLog b/ChangeLog index 4f2f70a4..a1bba738 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ Version 2.0.2 STABLE (rgerhards), 2008-02-?? pointing out this problem. - bugfix: trailing ":" of tag was lost while parsing legacy syslog messages without timestamp - thanks to Anders Blomdell for providing a patch! +- bugfix (doc): misspelled config directive, invalid signal info --------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, diff --git a/configure.ac b/configure.ac index 6ca8bb41..bb66bfd6 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.1],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.2],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/doc/rsconf1_actionexeconlyifpreviousissuspended.html b/doc/rsconf1_actionexeconlyifpreviousissuspended.html deleted file mode 100644 index 2568ccfb..00000000 --- a/doc/rsconf1_actionexeconlyifpreviousissuspended.html +++ /dev/null @@ -1,29 +0,0 @@ - - -rsyslog.conf file - - -

$ActionExecOnlyIfPreviousIsSuspended

-

Type: global configuration directive

-

Default: off

-

Description:

-

This directive allows to specify if actions should always be executed ("off," the default) or only if the previous action is suspended ("on"). This directive works hand-in-hand with the multiple actions per selector feature. It can be used, for example, to create rules that automatically switch destination servers or databases to a (set of) backup(s), if the primary server fails. Note that this feature depends on proper implementation of the suspend feature in the output module. All built-in output modules properly support it (most importantly the database write and the syslog message forwarder).

-

This selector processes all messages it receives (*.*). It tries to forward every message to primary-syslog.example.com (via tcp). If it can not reach that server, it tries secondary-1-syslog.example.com, if that fails too, it tries secondary-2-syslog.example.com. If neither of these servers can be connected, the data is stored in /var/log/localbuffer. Please note that the secondaries and the local log buffer are only used if the one before them does not work. So ideally, /var/log/localbuffer will never receive a message. If one of the servers resumes operation, it automatically takes over processing again.

-

We strongly advise not to use repeated line reduction together with ActionExecOnlyIfPreviousIsSuspended. It may lead to "interesting" and undesired results (but you can try it if you like).

-

Sample:

-

*.* @@primary-syslog.example.com -
$ActionExecOnlyIfPreviousIsSuspended on -
& @@secondary-1-syslog.example.com # & is used to have more than one action for -
& @@secondary-2-syslog.example.com # the same selector - the mult-action feature -
& /var/log/localbuffer -
$ActionExecOnlyIfPreviousIsSuspended off # to re-set it for the next selector

- -

[rsyslog.conf overview] [manual -index] [rsyslog site]

-

This documentation is part of the -rsyslog project.
-Copyright © 2007 by Rainer Gerhards and -Adiscon. Released under the GNU GPL -version 2 or higher.

- - \ No newline at end of file diff --git a/doc/rsconf1_actionexeconlywhenpreviousissuspended.html b/doc/rsconf1_actionexeconlywhenpreviousissuspended.html new file mode 100644 index 00000000..2568ccfb --- /dev/null +++ b/doc/rsconf1_actionexeconlywhenpreviousissuspended.html @@ -0,0 +1,29 @@ + + +rsyslog.conf file + + +

$ActionExecOnlyIfPreviousIsSuspended

+

Type: global configuration directive

+

Default: off

+

Description:

+

This directive allows to specify if actions should always be executed ("off," the default) or only if the previous action is suspended ("on"). This directive works hand-in-hand with the multiple actions per selector feature. It can be used, for example, to create rules that automatically switch destination servers or databases to a (set of) backup(s), if the primary server fails. Note that this feature depends on proper implementation of the suspend feature in the output module. All built-in output modules properly support it (most importantly the database write and the syslog message forwarder).

+

This selector processes all messages it receives (*.*). It tries to forward every message to primary-syslog.example.com (via tcp). If it can not reach that server, it tries secondary-1-syslog.example.com, if that fails too, it tries secondary-2-syslog.example.com. If neither of these servers can be connected, the data is stored in /var/log/localbuffer. Please note that the secondaries and the local log buffer are only used if the one before them does not work. So ideally, /var/log/localbuffer will never receive a message. If one of the servers resumes operation, it automatically takes over processing again.

+

We strongly advise not to use repeated line reduction together with ActionExecOnlyIfPreviousIsSuspended. It may lead to "interesting" and undesired results (but you can try it if you like).

+

Sample:

+

*.* @@primary-syslog.example.com +
$ActionExecOnlyIfPreviousIsSuspended on +
& @@secondary-1-syslog.example.com # & is used to have more than one action for +
& @@secondary-2-syslog.example.com # the same selector - the mult-action feature +
& /var/log/localbuffer +
$ActionExecOnlyIfPreviousIsSuspended off # to re-set it for the next selector

+ +

[rsyslog.conf overview] [manual +index] [rsyslog site]

+

This documentation is part of the +rsyslog project.
+Copyright © 2007 by Rainer Gerhards and +Adiscon. Released under the GNU GPL +version 2 or higher.

+ + \ No newline at end of file diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html index 3ee2ae60..bf878e82 100644 --- a/doc/rsyslog_conf.html +++ b/doc/rsyslog_conf.html @@ -25,7 +25,7 @@ to rsyslogd.

start with a dollar-sign. Here is a list in alphabetical order. Follow links for a description.

    -
  • $ActionExecOnlyIfPreviousIsSuspended
  • +
  • $ActionExecOnlyWhenPreviousIsSuspended
  • $ActionResumeInterval
  • $AllowedSender
  • $ControlCharacterEscapePrefix
  • diff --git a/rsyslogd.8 b/rsyslogd.8 index 58aec529..1d44b8d8 100644 --- a/rsyslogd.8 +++ b/rsyslogd.8 @@ -276,15 +276,10 @@ will be reread and the .BR rsyslog (3) facility is started again. .TP -.B SIGTERM +.B SIGTERM "," SIGINT "," SIGQUIT .B Rsyslogd will die. .TP -.BR SIGINT ", " SIGQUIT -If debugging is enabled these are ignored, otherwise -.B rsyslogd -will die. -.TP .B SIGUSR1 Switch debugging on/off. This option can only be used if .B rsyslogd -- cgit From cf11c5f530bde0df3cc31374dc615e4646883b48 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 11 Feb 2008 12:55:00 +0000 Subject: still forgotten one spot... --- doc/rsconf1_actionexeconlywhenpreviousissuspended.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rsconf1_actionexeconlywhenpreviousissuspended.html b/doc/rsconf1_actionexeconlywhenpreviousissuspended.html index 2568ccfb..3f18e243 100644 --- a/doc/rsconf1_actionexeconlywhenpreviousissuspended.html +++ b/doc/rsconf1_actionexeconlywhenpreviousissuspended.html @@ -3,7 +3,7 @@ rsyslog.conf file -

    $ActionExecOnlyIfPreviousIsSuspended

    +

    $ActionExecOnlyWhenPreviousIsSuspended

    Type: global configuration directive

    Default: off

    Description:

    -- cgit From 366e5dcf9c96382ddccd6f094253657c8fbe4e2d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 08:06:54 +0000 Subject: applied patch from Michael Biebl that fixed my doc change from yesterday which was somewhat incomplete --- doc/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 74e1be69..fce42eb9 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -20,7 +20,7 @@ html_files = \ syslog-protocol.html \ version_naming.html \ contributors.html \ - rsconf1_actionexeconlyifpreviousissuspended.html \ + rsconf1_actionexeconlywhenpreviousissuspended.html \ rsconf1_actionresumeinterval.html \ rsconf1_allowedsender.html \ rsconf1_controlcharacterescapeprefix.html \ -- cgit From f61ddec38d94f0679a26229c201e6ad9cd77cd4b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 08:27:15 +0000 Subject: applied some doc fixes from Michel Biebl and cleaned up some no longer needed files suggested by him --- BUGS | 1 - CHANGES | 1 - MANIFEST | 57 ----------------------- doc/Makefile.am | 4 ++ doc/manual.html | 6 --- modutils.patch | 65 -------------------------- syslog.conf | 46 ------------------- syslog_tst.c | 76 ------------------------------ test.conf | 140 -------------------------------------------------------- 9 files changed, 4 insertions(+), 392 deletions(-) delete mode 100644 BUGS delete mode 100644 CHANGES delete mode 100644 MANIFEST delete mode 100644 modutils.patch delete mode 100644 syslog.conf delete mode 100644 syslog_tst.c delete mode 100644 test.conf diff --git a/BUGS b/BUGS deleted file mode 100644 index 7f537a29..00000000 --- a/BUGS +++ /dev/null @@ -1 +0,0 @@ -This file has been superseeded by doc/bugs.html. Check there. diff --git a/CHANGES b/CHANGES deleted file mode 100644 index 07249375..00000000 --- a/CHANGES +++ /dev/null @@ -1 +0,0 @@ -This file has been superseeded by NEWS. Please see there. diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index 6cfb0d3a..00000000 --- a/MANIFEST +++ /dev/null @@ -1,57 +0,0 @@ -This file basically stems back to the sysklog package. It is currently not -being maintained and is considered to be replaced by some other method -in the future. We have not yet removed it, because it still contains some -helpful information. When using it, keep in mind that it is not up to date. -However, what is written here still applies, but often is not the -sole truth ;) - -Rainer Gerhards, 2005-08-10 - -A virgin copy of these sources should include 12 files: - -MANIFEST: This file. - -INSTALL: Brief installation instructions. - -NEWS: Important changes. - -Makefile: A makefile to generate the binaries. - -README.linux: Documentation which may prove useful. - -syslogd.c: Source code for the system log daemon. - -pidfile.c: Source implementing utility functions which are useful - for managing pid files. Used by both syslogd and klogd. - -pidfile.h: Include file containing global definitions for the - pid file utility functions. - -version.h: An include file for setting the version and patchlevel - for the package. - -sample.conf: A sample configuration file. Note that this file uses - extensions to the BSD syntax. See the syslog.conf(5) - manpage for more details. - -####new#### -syslog.c: A slightly modified version of the syslog.c file found in - the standard libraries. This special version is needed - so that klogd will pass messages with kernel priority to - the syslogd facility. - -rsyslog-0.8.1/srUtils.c -rsyslog-0.8.1/stringbuf.c -rsyslog-0.8.1/syslog.c -rsyslog-0.8.1/syslog_tst.c -rsyslog-0.8.1/template.c -rsyslog-0.8.1/liblogging-stub.h -rsyslog-0.8.1/srUtils.h -rsyslog-0.8.1/stringbuf.h -rsyslog-0.8.1/syslogd.h -rsyslog-0.8.1/template.h -rsyslog-0.8.1/BUGS -rsyslog-0.8.1/COPYING -rsyslog-0.8.1/AUTHORS -rsyslog-0.8.1/sample.conf -rsyslog-0.8.1/createDB.sql diff --git a/doc/Makefile.am b/doc/Makefile.am index fce42eb9..1449a13f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -11,6 +11,7 @@ html_files = \ modules.html \ property_replacer.html \ rsyslog_conf.html \ + rsyslog-example.conf \ rsyslog_mysql.html \ rsyslog_packages.html \ rsyslog_php_syslog_ng.html \ @@ -38,6 +39,9 @@ html_files = \ rsconf1_filecreatemode.html \ rsconf1_filegroup.html \ rsconf1_fileowner.html \ + rsconf1_gssforwardservicename.html \ + rsconf1_gsslistenservicename.html \ + rsconf1_gssmode.html \ rsconf1_includeconfig.html \ rsconf1_mainmsgqueuesize.html \ rsconf1_modload.html \ diff --git a/doc/manual.html b/doc/manual.html index 4c3c15a0..aeddb04f 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -72,12 +72,6 @@ of Fame" -->
  • description of rsyslog modules -

    Also, there is an article from Dennis Olvany on - -Syslog-to-SQL with rsyslog-0.8.4 on FreeBSD 5.4 - -(which unfortunately is a bit outdated now).

    -

    Our rsyslog history page is for you if you would like to learn a little more on why there is an rsyslog at all. If you are interested why you should care diff --git a/modutils.patch b/modutils.patch deleted file mode 100644 index 4dff7f35..00000000 --- a/modutils.patch +++ /dev/null @@ -1,65 +0,0 @@ -diff -u --new-file --recursive base/modules-2.0.0/depmod/modprobe.c ./modules-2.0.0/depmod/modprobe.c ---- base/modules-2.0.0/depmod/modprobe.c Mon Jun 10 05:29:08 1996 -+++ ./modules-2.0.0/depmod/modprobe.c Thu Aug 29 09:58:01 1996 -@@ -233,6 +233,13 @@ - verbose ("\r\t%s\n\t\t",cmd); - int ret = system(cmd); - #endif -+ if ( fork() == 0 ) -+ { -+ /* Child process. */ -+ if ( execlp("klogd", "klogd", "-i", (char *) 0) < 0 ) -+ fprintf(stderr, "Failure in signaling klogd.\n"); -+ exit(0); -+ } - return ret; - } - /* -diff -u --new-file --recursive base/modules-2.0.0/insmod/insmod.c ./modules-2.0.0/insmod/insmod.c ---- base/modules-2.0.0/insmod/insmod.c Mon Jun 10 06:42:25 1996 -+++ ./modules-2.0.0/insmod/insmod.c Thu Aug 29 09:56:53 1996 -@@ -253,6 +253,18 @@ - ++n_stringpatches; - } - -+ -+void signal_klogd() { -+ if ( fork() == 0 ) -+ { -+ if ( execlp("klogd", "klogd", "-i", (char *) 0) < 0 ) -+ fprintf(stderr, "Failure in signaling klogd.\n"); -+ exit(0); -+ } -+ return; -+} -+ -+ - int main(int argc, char **argv) - { - FILE *fp; -@@ -983,6 +995,8 @@ - symvalue(sp) + addr, symtype, symname(sp)); - } - -+ signal_klogd(); -+ - if (nksyms > 0) - free(ksymtab); /* it has done its job */ - -@@ -1292,6 +1306,7 @@ - --argc; - ++argv; - } -+ signal_klogd(); - return errors; - } - /* else recursive removal */ -@@ -1353,6 +1368,8 @@ - break; - } - } -+ -+ signal_klogd(); - - return errors; - } diff --git a/syslog.conf b/syslog.conf deleted file mode 100644 index 801f35fb..00000000 --- a/syslog.conf +++ /dev/null @@ -1,46 +0,0 @@ -# /etc/syslog.conf - Configuration file for syslogd(8) -# -# For info about the format of this file, see "man syslog.conf". -# -*.=debug -/usr/adm/debug -*.warning /usr/adm/syslog - -# Store critical stuff in critical -# -*.=crit;kern.none /var/adm/critical - -# Kernel messages are first, stored in the kernel file, -# critical messages and higher ones also go to another -# host and to the console -# -kern.* /var/adm/kernel -kern.crit @finlandia -kern.crit /dev/console -kern.info;kern.!err /var/adm/kernel-info - -# The tcp wrapper loggs with mail.info, we display all -# the connections on tty12 -# -mail.=info /dev/tty12 - -# Store all mail concearning stuff in a file -# -mail.*;mail.!=info -/var/adm/mail - -# Log all mail.info and news.info messages to info -# -mail,news.=info -/var/adm/info - -# Log info and notice mesages to messages file -# -*.=info;*.=notice;mail.none -/usr/adm/messages -#*.=info;mail,news.none -/usr/adm/messages - -# Emergency messages will be displayed using wall -# -*.=emerg * - -# Messages of the priority alert will be directed -# to the operator -# -*.alert root,joey diff --git a/syslog_tst.c b/syslog_tst.c deleted file mode 100644 index 40896b31..00000000 --- a/syslog_tst.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Program to test daemon logging. */ - -/* - * Sat Dec 11 12:07:50 CST 1993: Dr. Wettstein - * Compiles clean with -Wall. Renamed for first public distribution. - * Use this freely but if you make a ton of money with it I - * expect a cut... :-) - * - * Thu Jan 6 11:52:10 CST 1994: Dr. Wettstein - * Added support for reading getting log input from the standard - * input. To activate this use a - as the single arguement to the - * the program. Note that there is a hack in the code to pause - * after each 1K has been written. This eliminates what appears - * to be a problem with overrunning a UNIX domain socket with - * excessive amounts of input. - */ -#include "config.h" - - -#include -#include -#include -#include -#include - -extern int main(int, char **); - - -int main(int argc, char *argv[]) -{ - auto char *nl, - bufr[512]; - auto int logged = 0; - - openlog("DOTEST", LOG_PID, LOG_DAEMON); - if (argc > 1) - { - if ( (*argv[1] == '-') && (*(argv[1]+1) == '\0') ) - { - while (!feof(stdin)) - if ( fgets(bufr, sizeof(bufr), stdin) != \ - (char *) 0 ) - { - if ( (nl = strrchr(bufr, '\n')) != \ - (char *) 0) - *nl = '\0'; - syslog(LOG_INFO, bufr); - logged += strlen(bufr); - if ( logged > 1024 ) - { - sleep(1); - logged = 0; - } - - } - } - else - while (argc-- > 1) - syslog(LOG_INFO, argv++[1]); - } - else - { - syslog(LOG_EMERG, "EMERG log."); - syslog(LOG_ALERT, "Alert log."); - syslog(LOG_CRIT, "Critical log."); - syslog(LOG_ERR, "Error log."); - syslog(LOG_WARNING, "Warning log."); - syslog(LOG_NOTICE, "Notice log."); - syslog(LOG_INFO, "Info log."); - syslog(LOG_DEBUG, "Debug log."); - closelog(); - return(0); - } - - return(0); -} diff --git a/test.conf b/test.conf deleted file mode 100644 index 94ab8934..00000000 --- a/test.conf +++ /dev/null @@ -1,140 +0,0 @@ -# 2004-11-17 rgerhards: work copy of the new syslog.conf -# We try to keep things as consistent with existing syslog implementation -# as possible. We use "$" to start lines that contain new dirctives. -# Set syslogd options - -# Templates are a key feature of rsyslog. They allow to specify any -# format a user might want. Every output in rsyslog uses templates - this -# holds true for files, user messages and so on. The database writer -# expects its template to be a proper SQL statement - so this is highly -# customizable too. You might ask how does all of this work when no templates -# at all are specified. Good question ;) The answer is simple, though. Templates -# compatible with the stock syslogd formats are hardcoded into rsyslog. So if -# no template is specified, we use one of these hardcoded templates. Search for -# "template_" in syslogd.c and you will find the hardcoded ones. -# -# A template consists of a template directive, a name, the actual template text -# and optional options. A sample is: -# -# $template MyTemplateName,"\7Text %property% some more text\n", -# -# The "$template" is the template directive. It tells rsyslog that this -# line contains a template. -# -# "MyTemplateName" is the template name. All other config lines refer to -# this name. -# -# The text within quotes is the actual template text. The backslash is -# a escape character, much as in C. It does all these "cool" things. For -# example, \7 rings the bell (this is an ASCII value), \n is a new line. -# C programmers and perl coders have the advantage of knowing this, but the -# set in rsyslog is a bit restricted currently. All text in the template -# is used literally, except for things within percent signs. These are -# properties and allow you access to the contents of the syslog message. -# Properties are accessed via the property replacer (nice name, huh) and -# it can do cool things, too. For example, it can pick a substring or -# do date-specific formatting. More on this is below, on some lines of the -# property replacer. -# -# The part is optional. It carries options that influence the -# template as whole. Details are below. Be sure NOT to mistake template -# options with property options - the later ones are processed by the -# property replacer and apply to a SINGLE property, only (and not the -# whole template). -# -# Template options are case-insensitive. Currently defined are: -# sql - format the string suitable for a SQL statement. This will replace single -# quotes ("'") by two single quotes ("''") inside each field. This option MUST -# be specified when a template is used for writing to a database, otherwise SQL -# injection might occur. -# -# Please note that the database writer *checks* that the sql option is -# present in the template. If it is not present, the write database action -# is disabled. This is to guard you against accidential forgetting it and -# then becoming vulnerable for SQL injection. -# The sql option can also be useful with files - especially if you want -# to run them on another machine for performance reasons. However, do NOT -# use it if you do not have a real need for it - among others, it takes -# some toll on the processing time. Not much, but on a really busy system -# you might notice it ;) -# -# To escape: -# % = \% -# \ = \\ -# --> '\' is used to escape (as in C) -#$template TraditionalFormat,%timegenerated% %HOSTNAME% %syslogtag%%msg%\n" -# -# Properties can be accessed by the property replacer. They are accessed -# inside the template by putting them between percent signs. Properties -# can be modifed by the property replacer. The full syntax is as follows: -# -# %propname:fromChar:toChar:options% -# -# propname is the name of the property to access. This IS case-sensitive! -# Currently supported are: -# msg the MSG part of the message (aka "the message" ;)) -# rawmsg the message excactly as it was received from the -# socket. Should be useful for debugging. -# UxTradMsg will disappear soon - do NOT use! -# HOSTNAME hostname from the message -# source alias for HOSTNAME -# syslogtag TAG from the message -# PRI PRI part of the message - undecoded (single value) -# IUT the monitorware InfoUnitType - used when talking to a -# MonitorWare backend (also for phpLogCon) -# syslogfacility the facility from the message - in numerical form -# syslogpriority the priority (actully severity!) from the -# message - in numerical form -# timegenerated timestamp when the message was RECEIVED. Always in high -# resolution -# timereported timestamp from the message. Resolution depends on what -# was provided in the message (in most cases, only seconds) -# TIMESTAMP alias for timereported -# -# FromChar and toChar are used to build substrings. They specify the -# offset within the string that should be copied. Offset counting -# starts at 1, so if you need to obtain the first 2 characters of the -# message text, you can use this syntax: "%msg:1:2%". -# If you do not whish to specify from and to, but you want to -# specify options, you still need to include the colons. For example, -# if you would like to convert the full message text to lower case -# only, use "%msg:::lowercase%". -# -# property options are case-insensitive, currently defined are: -# uppercase convert property to lowercase only -# lowercase convert property text to uppercase only -# drop-last-lf The last LF in the message (if any), is dropped. -# Especially useful for PIX. -# date-mysql format as mysql date -# date-rfc3164 format as RFC 3164 date -# date-rfc3339 format as RFC 3339 date -# escape-cc NOT yet implemented - -# Below find some samples of what a template can do. Have a good -# time finding out what they do ;) - -# A template that resambles traditional syslogd file output: -$template TraditionalFormat,"%timegenerated% %HOSTNAME% %syslogtag%%msg:::drop-last-lf%\n" - -# A template that tells you a little more about the message: - $template precise,"%syslogpriority%,%syslogfacility%,%timegenerated%,%HOSTNAME%,%syslogtag%,%msg%\n" -$template RFC3164fmt,"<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg%" -#$template precise,"%syslogpriority%,%syslogfacility%,%timegenerated::fulltime%,%HOSTNAME%,%syslogtag%,%msg%\n",1024 -$template usermsg," XXXX%syslogtag%%msg%\n\r" -#$template wallmsg,"\r\n\7Message from syslogd@%HOSTNAME% at %timegenerated% ...\r\n %syslogtag%%msg%\n\r" -$template MySQLInsert,"insert iut, message, receivedat values ('%iut%', '%msg:::UPPERCASE%', '%timegenerated:::date-mysql%') into systemevents\r\n", SQL - -# the template below emulates winsyslog format, but we need to check the time -# stamps used. for now, it is good enough ;) -$template WinSyslogFmt,"%HOSTNAME%,%timegenerated:1:10:date-rfc3339%,%timegenerated:12:19:date-rfc3339%,%timegenerated:1:10:date-rfc3339%,%timegenerated:12:19:date-rfc3339%,%syslogfacility%,%syslogpriority%,%syslogtag%%msg%\n" -#$template wallmsg,"\r\n\7Message from syslogd@%HOSTNAME% at %timegenerated:::date-rfc3339% ...\r\n %syslogtag%%msg%\n\r" - -# now follow output channel definitions -#$outchannel name,file-name-template,max-size,action-on-max-size -#$outchannel rg, /home/rger/proj/rsyslog/size-file , 1000 - -# Selector lines are now modified -# The "action" (e.g. file logging) can be followed -# by a comma and then the name of a template to use. -# This is an example: -*.* rger -- cgit From a3021f86318f5fbec829a73146cf78105490b178 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 09:06:10 +0000 Subject: cleaned up stringbuf.c to fix an annoyance reported by Anders Blomdell --- ChangeLog | 5 ++++- stringbuf.c | 22 ---------------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1bba738..11bbc3e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 2.0.2 STABLE (rgerhards), 2008-02-?? +Version 2.0.2 STABLE (rgerhards), 2008-02-12 - fixed a bug that could cause invalid string handling via strerror_r varmojfekoj provided the patch - many thanks! - added x-info field to rsyslogd startup/shutdown message. Hopefully @@ -13,6 +13,9 @@ Version 2.0.2 STABLE (rgerhards), 2008-02-?? - bugfix: trailing ":" of tag was lost while parsing legacy syslog messages without timestamp - thanks to Anders Blomdell for providing a patch! - bugfix (doc): misspelled config directive, invalid signal info +- applied some doc fixes from Michel Biebl and cleaned up some no longer + needed files suggested by him +- cleaned up stringbuf.c to fix an annoyance reported by Anders Blomdell --------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, diff --git a/stringbuf.c b/stringbuf.c index 902831ef..01467f4d 100755 --- a/stringbuf.c +++ b/stringbuf.c @@ -380,28 +380,6 @@ finalize_it: rsRetVal rsCStrFinish(rsCStrObj __attribute__((unused)) *pThis) { rsCHECKVALIDOBJECT(pThis, OIDrsCStr); - -# if STRINGBUF_TRIM_ALLOCSIZE == 1 - /* in this mode, we need to trim the string. To do - * so, we must allocate a new buffer of the exact - * string size, and then copy the old one over. - * This new buffer is then to be returned. - */ - if((pRetBuf = malloc((pThis->iBufSize) * sizeof(uchar))) == NULL) - { /* OK, in this case we use the previous buffer. At least - * we have it ;) - */ - } - else - { /* got the new buffer, so let's use it */ - uchar* pBuf; - memcpy(pBuf, pThis->pBuf, pThis->iBufPtr + 1); - pThis->pBuf = pBuf; - } -# else - /* here, we need to do ... nothing ;) - */ -# endif return RS_RET_OK; } -- cgit From c96bb3660e89d4f4d45feb58d35262bb4ffca9c6 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 11:19:48 +0000 Subject: fixed bug that caused invalid treatment of tabs (HT) in rsyslog.conf --- syslogd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/syslogd.c b/syslogd.c index 57fffbfe..396a540b 100644 --- a/syslogd.c +++ b/syslogd.c @@ -5536,13 +5536,12 @@ int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep) { uchar *pSrc = *ppSrc; int iErr = 0; /* 0 = no error, >0 = error */ - while(*pSrc != cSep && *pSrc != '\n' && *pSrc != '\0' && DstSize>1) { + while((cSep == ' ' ? !isspace(*pSrc) : *pSrc != cSep) && *pSrc != '\n' && *pSrc != '\0' && DstSize>1) { *pDst++ = *(pSrc)++; DstSize--; } /* check if the Dst buffer was to small */ - if (*pSrc != cSep && *pSrc != '\n' && *pSrc != '\0') - { + if ((cSep == ' ' ? !isspace(*pSrc) : *pSrc != cSep) && *pSrc != '\n' && *pSrc != '\0') { dbgprintf("in getSubString, error Src buffer > Dst buffer\n"); iErr = 1; } -- cgit From 3bf1f3a7880adcff504c61f90dad9712c9e83bad Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 11:28:05 +0000 Subject: preparing for 2.0.2 --- doc/status.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/status.html b/doc/status.html index f8b6c7a8..8f2b5335 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,17 +4,17 @@

    rsyslog status page

    -

    This page reflects the status as of 2008-01-24.

    +

    This page reflects the status as of 2008-02-12.

    Current Releases

    -

    development: 3.10.2 - -change log - -download

    +

    development: 3.11.0 - +change log - +download

    Be sure to read the rsyslog v3 compatibility document!
    Documentation for 3.x is currently sparse. If you need assistance, please post in the rsyslog forums!

    -

    stable: 2.0.1 - change log - -download

    +

    stable: 2.0.2 - change log - +download

     (How are versions named?)

    Platforms

    Thankfully, a number of folks have begin to build packages and help port -- cgit From e14dbae80c2f0541a67f23e00c44b7bd43f85bf1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 11:33:21 +0000 Subject: fixed invalid link --- ChangeLog | 1 + doc/status.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 11bbc3e8..5e81354b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ Version 2.0.2 STABLE (rgerhards), 2008-02-12 - applied some doc fixes from Michel Biebl and cleaned up some no longer needed files suggested by him - cleaned up stringbuf.c to fix an annoyance reported by Anders Blomdell +- fixed bug that caused invalid treatment of tabs (HT) in rsyslog.conf --------------------------------------------------------------------------- Version 2.0.1 STABLE (rgerhards), 2008-01-24 - fixed a bug in integer conversion - but this function was never called, diff --git a/doc/status.html b/doc/status.html index 8f2b5335..503892b2 100644 --- a/doc/status.html +++ b/doc/status.html @@ -14,7 +14,7 @@ rsyslog v3 compatibility document!
    Documentation for 3.x is currently sparse. If you need assistance, please post in the rsyslog forums!

    stable: 2.0.2 - change log - -download

    +download

     (How are versions named?)

    Platforms

    Thankfully, a number of folks have begin to build packages and help port -- cgit From dd70fc145fc8b8d94bfa98fc25e4ccd5a073859a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 11:51:39 +0000 Subject: bumping version number --- ChangeLog | 2 ++ configure.ac | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5e81354b..0f05a14f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ --------------------------------------------------------------------------- +Version 2.0.3 STABLE (rgerhards), 2008-02-?? +--------------------------------------------------------------------------- Version 2.0.2 STABLE (rgerhards), 2008-02-12 - fixed a bug that could cause invalid string handling via strerror_r varmojfekoj provided the patch - many thanks! diff --git a/configure.ac b/configure.ac index bb66bfd6..15c73dae 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.2],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.3],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) -- cgit From 09d7d7d2583de936cfafa8b9452c77664b3fcdfa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 13:12:32 +0000 Subject: clarified dependency of control character property replacer options to $EscapeControlCharactersOnReceive --- doc/property_replacer.html | 27 ++++++++++++++++++----- doc/rsconf1_escapecontrolcharactersonreceive.html | 5 +++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/doc/property_replacer.html b/doc/property_replacer.html index 3df2fd0b..4b98774b 100644 --- a/doc/property_replacer.html +++ b/doc/property_replacer.html @@ -125,14 +125,29 @@ are defined:

    date-mysqlformat as mysql date date-rfc3164format as RFC 3164 date date-rfc3339format as RFC 3339 date -escape-ccreplace control characters (ASCII value 127 and - values less then 32) with an escape sequence. The sequnce is "#<charval>" + + escape-ccreplace control characters (ASCII value 127 and + values less then 32) with an escape sequence. The sequence is "#<charval>" where charval is the 3-digit decimal value of the control character. For - example, a tabulator would be replaced by "#009". -space-ccreplace control characters by spaces -drop-ccdrop control characters - the resulting string + example, a tabulator would be replaced by "#009".
    + Note: using this option requires that + $EscapeControlCharactersOnReceive + is set to off. + + + space-ccreplace control characters by spaces
    + Note: using this option requires that + $EscapeControlCharactersOnReceive + is set to off. + + + drop-ccdrop control characters - the resulting string will neither contain control characters, escape sequences nor any other - replacement character like space. + replacement character like space.
    + Note: using this option requires that + $EscapeControlCharactersOnReceive + is set to off. +

    Further Links

    diff --git a/doc/rsconf1_escapecontrolcharactersonreceive.html b/doc/rsconf1_escapecontrolcharactersonreceive.html index a8855119..26917736 100644 --- a/doc/rsconf1_escapecontrolcharactersonreceive.html +++ b/doc/rsconf1_escapecontrolcharactersonreceive.html @@ -14,6 +14,11 @@ (like Japanese, Chinese and Korean)
  • turning on this option destroys digital signatures if such exists inside the message
  • +
  • if turned on, the drop-cc, space-cc and escape-cc + property replacer options do not work + as expected because control characters are already removed upon message + reception. If you intend to use these property replacer options, you must + turn off $EscapeControlCharactersOnReceive.

Sample:

$EscapeControlCharactersOnReceive on

-- cgit From c73ab075e6185eb424df9c9e588de664c55a8d96 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 13:14:11 +0000 Subject: bugfix: setting for $EscapeCopntrolCharactersOnReceive was not properly initialized --- ChangeLog | 2 ++ syslogd.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0f05a14f..c125ea1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 2.0.3 STABLE (rgerhards), 2008-02-?? +- bugfix: setting for $EscapeCopntrolCharactersOnReceive was not + properly initialized --------------------------------------------------------------------------- Version 2.0.2 STABLE (rgerhards), 2008-02-12 - fixed a bug that could cause invalid string handling via strerror_r diff --git a/syslogd.c b/syslogd.c index 396a540b..e03ff05e 100644 --- a/syslogd.c +++ b/syslogd.c @@ -471,7 +471,7 @@ static int bDebugPrintCfSysLineHandlerList = 1;/* output cfsyslinehandler list i static int bDebugPrintModuleList = 1;/* output module list in debug mode? */ int bDropMalPTRMsgs = 0;/* Drop messages which have malicious PTR records during DNS lookup */ static uchar cCCEscapeChar = '\\';/* character to be used to start an escape sequence for control chars */ -static int bEscapeCCOnRcv; /* escape control characters on reception: 0 - no, 1 - yes */ +static int bEscapeCCOnRcv = 1; /* escape control characters on reception: 0 - no, 1 - yes */ static int bReduceRepeatMsgs; /* reduce repeated message - 0 - no, 1 - yes */ static int bActExecWhenPrevSusp; /* execute action only when previous one was suspended? */ static int logEveryMsg = 0;/* no repeat message processing - read-only after startup -- cgit From 8eceb79ccdd1177a89c30a386916b64ef4df433b Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 14:49:40 +0000 Subject: updated some trackers; changed tracking system --- doc/bugs.html | 39 ++++++--------------------------------- doc/features.html | 34 +++++----------------------------- 2 files changed, 11 insertions(+), 62 deletions(-) diff --git a/doc/bugs.html b/doc/bugs.html index 8f775600..a12c43f3 100644 --- a/doc/bugs.html +++ b/doc/bugs.html @@ -4,37 +4,14 @@

rsyslog bugs and annoyances

-

This page lists the known bugs rsyslog has to offer. Please note that -we also have a - -bug tracker at sourceforge.net. This list here contains more architectural -things while the bug tracker most often lists things that you will actually -experience. Please be sure to visit the bug tracker in addition to this list -here.

-

This list has last been updated on 2007-07-30 by +

This page lists the known bugs rsyslog has to offer.  It lists +old and esoteric bugs. A live list of bugs is contained in our bugzilla. +Please visit +http://www.rsyslog.com/bugs to see what we +have. There, you can also open your own bug report if you think you found one.

+

This list has last been updated on 2008-02-12 by Rainer Gerhards.

rsyslogd

-

stability in multithreaded mode

-

We have some reports that rsyslogd, if compiled with multi-threading enabled, -segfaults in some environments. We are actively looking at fixing this issue, -but as it does not occur in our lab environment, that unfortunately takes some -time. If you experience a segfault, please report it. As a work-around, you can -compile rsyslog without multi-threading:

-

./configure --disable-pthreads
-make clean
-make
-make install

-

This somewhat reduces the ability to handle large message bursts, but even in -single-threaded mode rsyslogd offers great performance (just think that stock -sysklogd has always been using a single thread, only).

-

forwarding remotely received messages

-

Sysklogd does not forward remotely received messages to other network -destination except when the -h option is given. This code is currently defunct. -No matter if -h is specified or not, messages are ALWAYS forwarded. It is -currently under review if the sysklogd's functionality is actually needed. -Please see my -blog -post on this topic for further detail.

EQUALLY-NAMED TEMPLATES

If multiple templates with the SAME name are created, all but the first definition is IGNORED. So you can NOT (yet) replace a @@ -46,10 +23,6 @@ names...).

This format is actually not 100% compatible with stock syslogd - the date is missing. Will be fixed soon and can also be fixed just via the proper template. Anyone up for this? ;)

-

SIGPIPE HANDLING

-

Currently, SIGPIPE is ignored. This is necessary to handle broken TCP - connections. We should further look into this issue and see which other - ways exist to handle the situation.

MULTIPLE INSTANCES

If multiple instances are running on a single machine, the one with the -r switch must start first. Also, UDP-based syslog forwarding between the diff --git a/doc/features.html b/doc/features.html index 2899cd76..c71194dc 100644 --- a/doc/features.html +++ b/doc/features.html @@ -53,36 +53,12 @@ is going on, you can also subscribe to the feature -request tracker at sourceforge.net. This tracker has things typically within +feature +request tracker at our bugzilla. This tracker has things typically within reach of implementation. Users are encouraged to submit feature requests there -(or via our forums). If we like them but they look quite long-lived (aka "not -soon to be implemented"), they will possibly be migrated to this list here and -at some time moved back to the sourceforge tracker.

-
    -
  • create a plug-in-interface - we are very close to this. A neat interface is - already used internally for output modules and the MySQL module already - works as a plug-in. However, no interface definition is yet formally - published.
  • implement native email-functionality in - selector (probably best done as a plug-in)
  • port it to more *nix variants - (eg AIX and HP UX) - this needs volunteers with access to those machines and - knowledge
  • provide an on-disk queue for syslog messages; should be - combined with reliable delivery to the next hop
  • support for native SSL enryption of plain tcp syslog sessions. This will - most probably happen based on syslog-transport-tls.
  • even more enhanced multi-threading, - with a message queue for each action (when implementing this, search - for CHECKMULTIQUEUE comments in the source - they already contain hints of - what to look at). Some detail information on this can already be found in - - Rainer's blog.
  • pcre filtering - maybe (depending on feedback)  - simple regex already - partly added. So far, this seems sufficient so that there is no urgent need - to do pcre
  • support for RFC 3195 as a sender - this is currently unlikely to happen, because there is no real - demand for it. Any work on RFC 3195 has been suspend until we see some real - interest in it.  It is probably much better to use TCP-based syslog, - which is interoperable with a large number of applications. You may also - read my blog post on the future of liblogging, which contains interesting - information about the - - future of RFC 3195 in rsyslog.
+(or via our forums). Please note that rsyslog v2 is feature-complete. New +features will be implemented in the v3 branch only. Version 3 already has a +number of very exciting additional features.

To see when each feature was added, see the rsyslog change log (online only).

-- cgit From 1a4ea8dc01a946ad48a0e85808d3e09d047c98d3 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 13 Feb 2008 07:11:21 +0000 Subject: improved man pages thank to Michael Biebl for the patch --- ChangeLog | 1 + rfc3195d.8 | 3 +-- rklogd.8 | 3 +-- rsyslog.conf.5 | 4 ++-- rsyslogd.8 | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index c125ea1f..ce61ea82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ Version 2.0.3 STABLE (rgerhards), 2008-02-?? - bugfix: setting for $EscapeCopntrolCharactersOnReceive was not properly initialized +- improved the man pages a bit - thanks to Michael Biebl for the patch --------------------------------------------------------------------------- Version 2.0.2 STABLE (rgerhards), 2008-02-12 - fixed a bug that could cause invalid string handling via strerror_r diff --git a/rfc3195d.8 b/rfc3195d.8 index 2fef91b0..5e4b415f 100644 --- a/rfc3195d.8 +++ b/rfc3195d.8 @@ -1,7 +1,7 @@ .\" Copyright 2005 Rainer Gerhards and Adiscon for the rsyslog modifications .\" Distributed under the GNU General Public License. .\" -.TH RSYSLOGD 8 "03 July 2007" "Version 1.14.2 (devel)" "Linux System Administration" +.TH RSYSLOGD 8 "12 February 2008" "Version 2.0.2" "Linux System Administration" .SH NAME rfc3195d \- RFC 3195 listener .SH SYNOPSIS @@ -82,4 +82,3 @@ protocol handling. .PD 0 .TP Rainer Gerhards -.zZ diff --git a/rklogd.8 b/rklogd.8 index 0bc7d768..8ef99c2c 100644 --- a/rklogd.8 +++ b/rklogd.8 @@ -4,7 +4,7 @@ .\" Sun Nov 19 23:22:21 MET: Martin Schulze: Updates .\" Mon Aug 19 09:42:08 CDT 1996: Dr. G.W. Wettstein: Updates .\" -.TH RKLOGD 8 "03 JULY 2007" "Version 1.14.2 (devel)" "Linux System Administration" +.TH RKLOGD 8 "12 February 2008" "Version 2.0.2" "Linux System Administration" .SH NAME rklogd \- Kernel Log Daemon .LP @@ -438,4 +438,3 @@ Roger Maris Cancer Center .TP Fargo, ND 58122 .PD -.zZ diff --git a/rsyslog.conf.5 b/rsyslog.conf.5 index 7f6ca98b..a21aca0f 100644 --- a/rsyslog.conf.5 +++ b/rsyslog.conf.5 @@ -17,7 +17,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. .\" -.TH RSYSLOG.CONF 5 "04 September 2007" "Version 1.19.4" "Linux System Administration" +.TH RSYSLOG.CONF 5 "12 February 2008" "Version 2.0.2" "Linux System Administration" .SH NAME rsyslog.conf \- rsyslogd(8) configuration file .SH DESCRIPTION @@ -527,7 +527,7 @@ extract from a position until the end of the string, you can place a dollar-sign (e.g. %msg:10:$%, which will extract from position 10 to the end of the string). There is also support for -.Bregular expressions. +.B regular expressions. To use them, you need to place a "R" into FromChar. This tells rsyslog that a regular expression instead of position-based extraction is desired. The actual regular expression diff --git a/rsyslogd.8 b/rsyslogd.8 index 1d44b8d8..ae6cebd2 100644 --- a/rsyslogd.8 +++ b/rsyslogd.8 @@ -1,7 +1,7 @@ .\" Copyright 2004-2005 Rainer Gerhards and Adiscon for the rsyslog modifications .\" May be distributed under the GNU General Public License .\" -.TH RSYSLOGD 8 "11 December 2008" "Version 1.20.1 (devel)" "Linux System Administration" +.TH RSYSLOGD 8 "12 February 2008" "Version 2.0.2" "Linux System Administration" .SH NAME rsyslogd \- reliable and extended syslogd .SH SYNOPSIS @@ -599,4 +599,3 @@ Adiscon GmbH .TP mmeckelein@adiscon.com .PD -.zZ -- cgit From b00cf838bb11fdff8a55c67f07e1045350ec8981 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 26 Feb 2008 13:43:13 +0000 Subject: - bugfix: resolved potential segfault condition on HUP (extremely unlikely to happen in practice), for details see tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=38 --- ChangeLog | 3 +++ modules.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index ce61ea82..1caea15b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ Version 2.0.3 STABLE (rgerhards), 2008-02-?? - bugfix: setting for $EscapeCopntrolCharactersOnReceive was not properly initialized +- bugfix: resolved potential segfault condition on HUP (extremely + unlikely to happen in practice), for details see tracker: + http://bugzilla.adiscon.com/show_bug.cgi?id=38 - improved the man pages a bit - thanks to Michael Biebl for the patch --------------------------------------------------------------------------- Version 2.0.2 STABLE (rgerhards), 2008-02-12 diff --git a/modules.c b/modules.c index f04c4a97..406cf32a 100644 --- a/modules.c +++ b/modules.c @@ -378,6 +378,18 @@ rsRetVal modUnloadAndDestructDynamic(void) } } + /* Note: the last modules pNext pointer is now invalid + * (except if the last module was not touched, what is highly + * unlikely. We simply fix this be setting it to NULL. After all, + * it is the last module ;). This bug had some severe effects in + * v3, but none in v2 because in v2 the list was never again + * traversed before a new one was added. But even in v2 it may cause + * a segfault if the number of loaded modules changed between HUPs. + * rgerhards, 2008-02-26 + */ + if(pLoadedModulesLast != NULL) + pLoadedModulesLast->pNext = NULL; + return iRet; } /* -- cgit From 230883321cfa7e2dea6d4e5bffe5c3a6b00883ba Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 12 Mar 2008 08:07:30 +0000 Subject: - bugfix: not properly initialized data could cause several segfaults if there were errors in the config file - thanks to varmojfekoj for the patch --- ChangeLog | 2 ++ module-template.h | 2 +- omfile.c | 5 +++-- syslogd.c | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1caea15b..a8b562cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ Version 2.0.3 STABLE (rgerhards), 2008-02-?? unlikely to happen in practice), for details see tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=38 - improved the man pages a bit - thanks to Michael Biebl for the patch +- bugfix: not properly initialized data could cause several segfaults if + there were errors in the config file - thanks to varmojfekoj for the patch --------------------------------------------------------------------------- Version 2.0.2 STABLE (rgerhards), 2008-02-12 - fixed a bug that could cause invalid string handling via strerror_r diff --git a/module-template.h b/module-template.h index 13ae4b86..a5ece4fb 100644 --- a/module-template.h +++ b/module-template.h @@ -260,7 +260,7 @@ finalize_it:\ *ppOMSR = NULL;\ }\ if(pData != NULL)\ - freeInstance(&pData);\ + freeInstance(pData);\ } #define ENDparseSelectorAct \ diff --git a/omfile.c b/omfile.c index cd5e23c4..db2ec3eb 100644 --- a/omfile.c +++ b/omfile.c @@ -344,7 +344,8 @@ static void dynaFileFreeCache(instanceData *pData) dynaFileDelCacheEntry(pData->dynCache, i, 1); } - free(pData->dynCache); + if(pData->dynCache != NULL) + free(pData->dynCache); } @@ -605,7 +606,7 @@ BEGINfreeInstance CODESTARTfreeInstance if(pData->bDynamicName) { dynaFileFreeCache(pData); - } else + } else if(pData->fd != -1) close(pData->fd); ENDfreeInstance diff --git a/syslogd.c b/syslogd.c index e03ff05e..06780bf9 100644 --- a/syslogd.c +++ b/syslogd.c @@ -5220,6 +5220,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction) /* loop through all modules and see if one picks up the line */ pMod = omodGetNxt(NULL); while(pMod != NULL) { + pOMSR = NULL; iRet = pMod->mod.om.parseSelectorAct(p, &pModData, &pOMSR); dbgprintf("tried selector action for %s: %d\n", modGetName(pMod), iRet); if(iRet == RS_RET_OK || iRet == RS_RET_SUSPENDED) { -- cgit From 81f612f98b937a3809927150ef62d02ca3d45cb1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 12 Mar 2008 17:40:56 +0000 Subject: preparing for 2.0.3 --- ChangeLog | 2 +- doc/status.html | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8b562cf..65d683aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 2.0.3 STABLE (rgerhards), 2008-02-?? +Version 2.0.3 STABLE (rgerhards), 2008-03-12 - bugfix: setting for $EscapeCopntrolCharactersOnReceive was not properly initialized - bugfix: resolved potential segfault condition on HUP (extremely diff --git a/doc/status.html b/doc/status.html index 503892b2..90cb44dd 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,17 +4,18 @@

rsyslog status page

-

This page reflects the status as of 2008-02-12.

+

This page reflects the status as of 2008-03-12.

Current Releases

-

development: 3.11.0 - -change log - -download

-

Be sure to read the -rsyslog v3 compatibility document!
+

development: 3.12.1 - +change +log - +download

+

If you used version 2, be sure to read the rsyslog v3 +compatibility document!
Documentation for 3.x is currently sparse. If you need assistance, please post in the rsyslog forums!

-

stable: 2.0.2 - change log - -download

+

stable: 2.0.3 - change log - +download

 (How are versions named?)

Platforms

Thankfully, a number of folks have begin to build packages and help port -- cgit From a2f31852b1467a2e9672ccd8d06a2139f5030942 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 22 Mar 2008 17:16:17 +0000 Subject: bumping version number --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 15c73dae..881d4179 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.3],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.4],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) -- cgit From 9971f8ffd2241c9fb398a5b78bc8ed6240089cc0 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Sat, 22 Mar 2008 17:16:35 +0000 Subject: bugfix: internally generated messages had "FROMHOST" property not set --- ChangeLog | 3 +++ syslogd.c | 1 + 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 65d683aa..65c4049d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ --------------------------------------------------------------------------- +Version 2.0.4 STABLE (rgerhards), 2008-03-?? +- bugfix: internally generated messages had "FROMHOST" property not set +--------------------------------------------------------------------------- Version 2.0.3 STABLE (rgerhards), 2008-03-12 - bugfix: setting for $EscapeCopntrolCharactersOnReceive was not properly initialized diff --git a/syslogd.c b/syslogd.c index 06780bf9..a28c2566 100644 --- a/syslogd.c +++ b/syslogd.c @@ -2256,6 +2256,7 @@ logmsgInternal(int pri, char *msg, int flags) MsgSetUxTradMsg(pMsg, msg); MsgSetRawMsg(pMsg, msg); MsgSetHOSTNAME(pMsg, LocalHostName); + MsgSetRcvFrom(pMsg, LocalHostName); MsgSetTAG(pMsg, "rsyslogd:"); pMsg->iFacility = LOG_FAC(pri); pMsg->iSeverity = LOG_PRI(pri); -- cgit From 6b2f3da3b511c842465ea4d0826ea915cc1a11fe Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 25 Mar 2008 08:52:11 +0000 Subject: bugfix: continue parsing if tag is oversize (discard oversize part) - thanks to mclaughlin77@gmail.com for the patch --- ChangeLog | 2 ++ syslogd.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 65c4049d..d9931505 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ --------------------------------------------------------------------------- Version 2.0.4 STABLE (rgerhards), 2008-03-?? - bugfix: internally generated messages had "FROMHOST" property not set +- bugfix: continue parsing if tag is oversize (discard oversize part) - thanks + to mclaughlin77@gmail.com for the patch --------------------------------------------------------------------------- Version 2.0.3 STABLE (rgerhards), 2008-03-12 - bugfix: setting for $EscapeCopntrolCharactersOnReceive was not diff --git a/syslogd.c b/syslogd.c index a28c2566..a039eeed 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3159,6 +3159,11 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) rsCStrAppendChar(pStrB, *p2parse++); ++iCnt; } + if (iCnt == 32) { + while(*p2parse && *p2parse != ':' && *p2parse != ' ') { + ++p2parse; + } + } if(*p2parse == ':') { ++p2parse; rsCStrAppendChar(pStrB, ':'); -- cgit From 2962bfb7abb25bfeb8d0f818826992ab7c5ac62f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 25 Mar 2008 09:16:41 +0000 Subject: added $HHOUR and $QHOUR system properties - can be used for half- and quarter-hour logfile rotation --- ChangeLog | 2 ++ doc/property_replacer.html | 12 ++++++++++++ msg.c | 18 +++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d9931505..84021a62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Version 2.0.4 STABLE (rgerhards), 2008-03-?? - bugfix: internally generated messages had "FROMHOST" property not set - bugfix: continue parsing if tag is oversize (discard oversize part) - thanks to mclaughlin77@gmail.com for the patch +- added $HHOUR and $QHOUR system properties - can be used for half- and + quarter-hour logfile rotation --------------------------------------------------------------------------- Version 2.0.3 STABLE (rgerhards), 2008-03-12 - bugfix: setting for $EscapeCopntrolCharactersOnReceive was not diff --git a/doc/property_replacer.html b/doc/property_replacer.html index 4b98774b..8b777a73 100644 --- a/doc/property_replacer.html +++ b/doc/property_replacer.html @@ -71,6 +71,18 @@ only seconds) $DAYThe current day of the month (2-digit) $HOURThe current hour in military (24 hour) time (2-digit) + +$HHOUR +The current half hour we are in. From minute 0 to 29, +this is always 0 while +from 30 to 59 it is always 1. + + +$QHOUR +The current quarter hour we are in. Much like $HHOUR, but values +range from 0 to 3 (for the four quater hours that are in each hour) + + $MINUTEThe current minute (2-digit)

Properties starting with a $-sign are so-called system properties. These do diff --git a/msg.c b/msg.c index 5b211b8a..16180e56 100644 --- a/msg.c +++ b/msg.c @@ -1243,7 +1243,7 @@ char *textpri(char *pRes, size_t pResLen, int pri) * can not allocate memory, it returns a NULL pointer. * Added 2007-07-10 rgerhards */ -typedef enum ENOWType { NOW_NOW, NOW_YEAR, NOW_MONTH, NOW_DAY, NOW_HOUR, NOW_MINUTE } eNOWType; +typedef enum ENOWType { NOW_NOW, NOW_YEAR, NOW_MONTH, NOW_DAY, NOW_HOUR, NOW_HHOUR, NOW_QHOUR, NOW_MINUTE } eNOWType; #define tmpBUFSIZE 16 /* size of formatting buffer */ static uchar *getNOW(eNOWType eNow) { @@ -1272,6 +1272,12 @@ static uchar *getNOW(eNOWType eNow) case NOW_HOUR: snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour); break; + case NOW_HHOUR: + snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour / 30); + break; + case NOW_QHOUR: + snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour / 15); + break; case NOW_MINUTE: snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute); break; @@ -1424,6 +1430,16 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, return "***OUT OF MEMORY***"; } else *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */ + } else if(!strcmp((char*) pName, "$HHOUR")) { + if((pRes = (char*) getNOW(NOW_HHOUR)) == NULL) { + return "***OUT OF MEMORY***"; + } else + *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */ + } else if(!strcmp((char*) pName, "$QHOUR")) { + if((pRes = (char*) getNOW(NOW_QHOUR)) == NULL) { + return "***OUT OF MEMORY***"; + } else + *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */ } else if(!strcmp((char*) pName, "$MINUTE")) { if((pRes = (char*) getNOW(NOW_MINUTE)) == NULL) { return "***OUT OF MEMORY***"; -- cgit From a628d02d9ff9d630119338e82007282b02d6196d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 25 Mar 2008 09:22:31 +0000 Subject: added professional support options --- doc/Makefile.am | 1 + doc/manual.html | 2 +- doc/professional_support.html | 57 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 doc/professional_support.html diff --git a/doc/Makefile.am b/doc/Makefile.am index 1449a13f..57e93a6f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -17,6 +17,7 @@ html_files = \ rsyslog_php_syslog_ng.html \ rsyslog_recording_pri.html \ rsyslog_stunnel.html \ + professional_support.html \ status.html \ syslog-protocol.html \ version_naming.html \ diff --git a/doc/manual.html b/doc/manual.html index aeddb04f..d4e00155 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -29,7 +29,7 @@ advanced features make it suitable for enterprise-class, relay chains while at the same time being very easy to setup -for the novice user.

+for the novice user. And as we know what enterprise users really need, there is also professional rsyslog support available directly from the source!

Visit the rsyslog status page to obtain current diff --git a/doc/professional_support.html b/doc/professional_support.html new file mode 100644 index 00000000..7f5e8371 --- /dev/null +++ b/doc/professional_support.html @@ -0,0 +1,57 @@ + + +Professional Support for Rsyslog + + + +

Professional Support for Rsyslog

+

Professional Support is offered by Adiscon, the company +that sponsors rsyslog development. For details, please contact Adiscon Sales.

+

+

EMail Support Service

+Price: 99.00 EURO
+Duration: 180 days +
+Support level: 8x5 +

Purchase rsyslog support directly from the source. This +contract provides priority email support. It is a great option if you +need to provide proof of software support in your organization. This +contract provides

+
    +
  • unlimited email support tickets during validity +
  • fixes for +current and past rsyslog +releases +
  • advise on how to implement rsyslog in the best possible way. +
+

Under this contract, fixes for old rsyslog releases will be +provided / created, provided that it is possible to do that with the +code base in question. Phone support is not included.

Custom-Written Config File

+Price: 29.00 EURO +
+Duration: N/A +
+Support level: 8x5 +

Creating rsyslog config files is easy - but if you would like +to have that extra feature and have no time to do it, this service is +for you. Important: BEFORE you purchase this service, contact us and +inquire (via info@adiscon.com) +whether or not your desired result can be achieved via rsyslog. Once +this is clear, order the service and we will ship a custom-made +configuration file within 5 working days (at latest, most often much +faster). For security reasons, we will not put passwords into the +configuration file, but will place easy to read comments in the places +where you need to put them in. The agreement is governed under German +law. You may also purchase this service if you would like to have your +own configuration file reviewed, e.g. for auditing purposes.


All agreements are +governed under German law. +

+

[manual index] [rsyslog site]

+

This documentation is part of the +rsyslog +project.
+Copyright © 2008 by Rainer +Gerhards and +Adiscon. +Released under the GNU GPL version 2 or higher.

+ -- cgit From 0e2d246a2e07c62b692aa8ef15415fb77af921a7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 26 Mar 2008 08:18:26 +0000 Subject: bugfix: QHOUR and HHOUR properties were wrongly calculated --- msg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msg.c b/msg.c index 16180e56..fa3e747f 100644 --- a/msg.c +++ b/msg.c @@ -1273,10 +1273,10 @@ static uchar *getNOW(eNOWType eNow) snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour); break; case NOW_HHOUR: - snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour / 30); + snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute / 30); break; case NOW_QHOUR: - snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour / 15); + snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute / 15); break; case NOW_MINUTE: snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute); -- cgit From 9d2f32339f9e364dd8492564e29f253d2f176161 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 27 Mar 2008 16:01:36 +0000 Subject: preparing for 2.0.4 release --- ChangeLog | 2 +- doc/status.html | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84021a62..9fe0de67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -Version 2.0.4 STABLE (rgerhards), 2008-03-?? +Version 2.0.4 STABLE (rgerhards), 2008-03-27 - bugfix: internally generated messages had "FROMHOST" property not set - bugfix: continue parsing if tag is oversize (discard oversize part) - thanks to mclaughlin77@gmail.com for the patch diff --git a/doc/status.html b/doc/status.html index 90cb44dd..cc197318 100644 --- a/doc/status.html +++ b/doc/status.html @@ -4,18 +4,20 @@

rsyslog status page

-

This page reflects the status as of 2008-03-12.

+

This page reflects the status as of 2008-03-27.

Current Releases

-

development: 3.12.1 - -change +p>development: 3.12.4 - +change log - -download

+download

If you used version 2, be sure to read the rsyslog v3 compatibility document!
-Documentation for 3.x is currently sparse. If you need assistance, please -post in the rsyslog forums!

-

stable: 2.0.3 - change log - -download

+Documentation for 3.x is currently partly sparse. If you need +assistance, please +post in +the rsyslog forums!

+

stable: 2.0.4 - change log - +download

 (How are versions named?)

Platforms

Thankfully, a number of folks have begin to build packages and help port -- cgit From 6b9369c95f8dab6571ae508311a6318bddfd7cc9 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 28 Mar 2008 15:33:04 +0000 Subject: a bit less humor as tribute to the corporate world ;) --- rsyslogd.8 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/rsyslogd.8 b/rsyslogd.8 index ae6cebd2..eecf96d6 100644 --- a/rsyslogd.8 +++ b/rsyslogd.8 @@ -1,7 +1,7 @@ .\" Copyright 2004-2005 Rainer Gerhards and Adiscon for the rsyslog modifications .\" May be distributed under the GNU General Public License .\" -.TH RSYSLOGD 8 "12 February 2008" "Version 2.0.2" "Linux System Administration" +.TH RSYSLOGD 8 "28 March 2008" "Version 2.0.5" "Linux System Administration" .SH NAME rsyslogd \- reliable and extended syslogd .SH SYNOPSIS @@ -481,16 +481,6 @@ that this will require rsyslogd to be run as a non-root process. rsyslogd will be unable to bind to the 514/UDP socket. .IP 4. Disabling inet domain sockets will limit risk to the local machine. -.IP 5. -Use step 4 and if the problem persists and is not secondary to a rogue -program/daemon get a 3.5 ft (approx. 1 meter) length of sucker rod* -and have a chat with the user in question. - -Sucker rod def. \(em 3/4, 7/8 or 1in. hardened steel rod, male -threaded on each end. Primary use in the oil industry in Western -North Dakota and other locations to pump 'suck' oil from oil wells. -Secondary uses are for the construction of cattle feed lots and for -dealing with the occasional recalcitrant or belligerent individual. .SS Message replay and spoofing If remote logging is enabled, messages can easily be spoofed and replayed. As the messages are transmitted in clear-text, an attacker might use -- cgit From 1e4963f7fb25763c8ec9b9edc4c5ffdd6a0c5409 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 28 Mar 2008 15:33:34 +0000 Subject: bugfix: regular expressions inside property replacer did not work properly --- ChangeLog | 4 ++++ configure.ac | 2 +- msg.c | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9fe0de67..8feac649 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ --------------------------------------------------------------------------- +Version 2.0.5 STABLE (rgerhards), 2008-??-?? +- bugfix: regular expressions inside property replacer did not work + properly +--------------------------------------------------------------------------- Version 2.0.4 STABLE (rgerhards), 2008-03-27 - bugfix: internally generated messages had "FROMHOST" property not set - bugfix: continue parsing if tag is oversize (discard oversize part) - thanks diff --git a/configure.ac b/configure.ac index 881d4179..6163078f 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([rsyslog],[2.0.4],[rsyslog@lists.adiscon.com.]) +AC_INIT([rsyslog],[2.0.5],[rsyslog@lists.adiscon.com.]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([syslogd.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/msg.c b/msg.c index fa3e747f..3473495c 100644 --- a/msg.c +++ b/msg.c @@ -1336,8 +1336,8 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, #ifdef FEATURE_REGEXP /* Variables necessary for regular expression matching */ - size_t nmatch = 2; - regmatch_t pmatch[2]; + size_t nmatch = 1; + regmatch_t pmatch[1]; #endif assert(pMsg != NULL); @@ -1582,7 +1582,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, int iLenBuf; char *pB; - iLenBuf = pmatch[1].rm_eo - pmatch[1].rm_so; + iLenBuf = pmatch[0].rm_eo - pmatch[0].rm_so; pB = (char *) malloc((iLenBuf + 1) * sizeof(char)); if (pB == NULL) { @@ -1593,7 +1593,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, } /* Lets copy the matched substring to the buffer */ - memcpy(pB, pRes + pmatch[1].rm_so, iLenBuf); + memcpy(pB, pRes + pmatch[0].rm_so, iLenBuf); pB[iLenBuf] = '\0';/* terminate string, did not happen before */ if (*pbMustBeFreed == 1) -- cgit From 769598da4cfc7c9fb3ceb337044a9313e4b1b68d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Apr 2008 14:40:19 +0200 Subject: cleanup and bugfix in imklog - some cleanup in imklog - bugfix: potential segfault in imklog when kernel is compiled without /proc/kallsyms and the file System.map is missing. Thanks to Andrea Morandi for pointing it out and suggesting a fix. --- ChangeLog | 4 ++ plugins/imklog/imklog.h | 3 +- plugins/imklog/ksym.c | 128 +++++++++++++++------------------------------- plugins/imklog/ksym_mod.c | 93 ++++++++++++--------------------- plugins/imklog/ksyms.h | 15 +++--- plugins/imklog/module.h | 9 ++-- 6 files changed, 91 insertions(+), 161 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e1b28e0..8fda865b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ Version 3.14.2 (rgerhards), 2008-04-?? Vrabec for patching it based on the development in sysklogd - and thanks to the sysklogd project for upgrading klogd to support the new functionality +- some cleanup in imklog +- bugfix: potential segfault in imklog when kernel is compiled without + /proc/kallsyms and the file System.map is missing. Thanks to + Andrea Morandi for pointing it out and suggesting a fix. --------------------------------------------------------------------------- Version 3.14.1 (rgerhards), 2008-04-04 - bugfix: some messages were emited without hostname diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h index 2db75009..71525a79 100644 --- a/plugins/imklog/imklog.h +++ b/plugins/imklog/imklog.h @@ -42,6 +42,5 @@ extern void vsyslog(int pri, const char *fmt, va_list ap); rsRetVal Syslog(int priority, char *fmt, ...) __attribute__((format(printf,2, 3))); #endif /* #ifndef IMKLOG_H_INCLUDED */ -/* - * vi:set ai: +/* vi:set ai: */ diff --git a/plugins/imklog/ksym.c b/plugins/imklog/ksym.c index 4fa2fbb6..b7d5903e 100644 --- a/plugins/imklog/ksym.c +++ b/plugins/imklog/ksym.c @@ -1,8 +1,9 @@ -/* - ksym.c - functions for kernel address->symbol translation - Copyright (c) 1995, 1996 Dr. G.W. Wettstein - Copyright (c) 1996 Enjellic Systems Development - +/* ksym.c - functions for kernel address->symbol translation + * Copyright (c) 1995, 1996 Dr. G.W. Wettstein + * Copyright (c) 1996 Enjellic Systems Development + * Copyright (c) 1998-2007 Martin Schulze + * Copyright (C) 2007-2008 Rainer Gerhards + * * This file is part of rsyslog. * * Rsyslog is free software: you can redistribute it and/or modify @@ -181,26 +182,20 @@ extern int InitKsyms(char *mapfile) /* * Search for and open the file containing the kernel symbols. */ - if ( mapfile != (char *) 0 ) - { + if ( mapfile != (char *) 0 ) { if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 ) { - Syslog(LOG_WARNING, "Cannot open map file: %s.", \ - mapfile); + Syslog(LOG_WARNING, "Cannot open map file: %s.", mapfile); return(0); } - } - else - { - if ( (mapfile = FindSymbolFile()) == (char *) 0 ) - { + } else { + if ( (mapfile = FindSymbolFile()) == (char *) 0 ) { Syslog(LOG_WARNING, "Cannot find map file."); dbgprintf("Cannot find map file.\n"); return(0); } - if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 ) - { + if ( (sym_file = fopen(mapfile, "r")) == (FILE *) 0 ) { Syslog(LOG_WARNING, "Cannot open map file."); dbgprintf("Cannot open map file.\n"); return(0); @@ -216,11 +211,8 @@ extern int InitKsyms(char *mapfile) * e-mail me a diff containing a parser with suitable political * correctness -- GW. */ - while ( !feof(sym_file) ) - { - if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym) - != 3 ) - { + while ( !feof(sym_file) ) { + if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym) != 3 ) { Syslog(LOG_ERR, "Error in symbol table input (#1)."); fclose(sym_file); return(0); @@ -228,8 +220,7 @@ extern int InitKsyms(char *mapfile) if(dbgPrintSymbols) dbgprintf("Address: %lx, Type: %c, Symbol: %s\n", address, type, sym); - if ( AddSymbol(address, sym) == 0 ) - { + if ( AddSymbol(address, sym) == 0 ) { Syslog(LOG_ERR, "Error adding symbol - %s.", sym); fclose(sym_file); return(0); @@ -241,16 +232,14 @@ extern int InitKsyms(char *mapfile) Syslog(LOG_INFO, "Loaded %d symbols from %s.", num_syms, mapfile); - switch ( version ) - { + switch(version) { case -1: Syslog(LOG_WARNING, "Symbols do not match kernel version."); num_syms = 0; break; case 0: - Syslog(LOG_WARNING, "Cannot verify that symbols match " \ - "kernel version."); + Syslog(LOG_WARNING, "Cannot verify that symbols match kernel version."); break; case 1: @@ -311,18 +300,16 @@ static char *FindSymbolFile(void) auto FILE *sym_file = (FILE *) 0; - if ( uname(&utsname) < 0 ) - { + if ( uname(&utsname) < 0 ) { Syslog(LOG_ERR, "Cannot get kernel version information."); return(0); } dbgprintf("Searching for symbol map.\n"); - for (mf = system_maps; *mf != (char *) 0 && file == (char *) 0; ++mf) - { + for(mf = system_maps; *mf != (char *) 0 && file == (char *) 0; ++mf) { - sprintf (symfile, "%s-%s", *mf, utsname.release); + snprintf(symfile, sizeof(symfile), "%s-%s", *mf, utsname.release); dbgprintf("Trying %s.\n", symfile); if ( (sym_file = fopen(symfile, "r")) != (FILE *) 0 ) { if (CheckMapVersion(symfile) == 1) @@ -341,10 +328,7 @@ static char *FindSymbolFile(void) } - /* - * At this stage of the game we are at the end of the symbol - * tables. - */ + /* At this stage of the game we are at the end of the symbol tables. */ dbgprintf("End of search list encountered.\n"); return(file); } @@ -407,8 +391,7 @@ static int CheckVersion(char *version) return(0); - /* - * Since the symbol looks like a kernel version we can start + /* Since the symbol looks like a kernel version we can start * things out by decoding the version string into its component * parts. */ @@ -420,24 +403,20 @@ static int CheckVersion(char *version) strlen(prefix), major, minor, patch); sprintf(vstring, "%d.%d.%d", major, minor, patch); - /* - * We should now have the version string in the vstring variable in + /* We should now have the version string in the vstring variable in * the same format that it is stored in by the kernel. We now * ask the kernel for its version information and compare the two * values to determine if our system map matches the kernel * version level. */ - if ( uname(&utsname) < 0 ) - { + if ( uname(&utsname) < 0 ) { Syslog(LOG_ERR, "Cannot get kernel version information."); return(0); } dbgprintf("Comparing kernel %s with symbol table %s.\n", utsname.release, vstring); - if ( sscanf (utsname.release, "%d.%d.%d", &major, &minor, &patch) < 3 ) - { - Syslog(LOG_ERR, "Kernel send bogus release string `%s'.", - utsname.release); + if ( sscanf (utsname.release, "%d.%d.%d", &major, &minor, &patch) < 3 ) { + Syslog(LOG_ERR, "Kernel send bogus release string `%s'.", utsname.release); return(0); } @@ -494,11 +473,8 @@ static int CheckMapVersion(char *fname) Syslog(LOG_INFO, "Inspecting %s", fname); version = 0; - while ( !feof(sym_file) && (version == 0) ) - { - if ( fscanf(sym_file, "%lx %c %s\n", &address, \ - &type, sym) != 3 ) - { + while ( !feof(sym_file) && (version == 0) ) { + if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym) != 3 ) { Syslog(LOG_ERR, "Error in symbol table input (#2)."); fclose(sym_file); return(0); @@ -509,11 +485,9 @@ static int CheckMapVersion(char *fname) } fclose(sym_file); - switch ( version ) - { + switch ( version ) { case -1: - Syslog(LOG_ERR, "Symbol table has incorrect " \ - "version number.\n"); + Syslog(LOG_ERR, "Symbol table has incorrect version number.\n"); break; case 0: dbgprintf("No version information found.\n"); @@ -546,14 +520,13 @@ static int CheckMapVersion(char *fname) static int AddSymbol(unsigned long address, char *symbol) { /* Allocate the the symbol table entry. */ - sym_array = (struct sym_table *) realloc(sym_array, (num_syms+1) * \ + sym_array = (struct sym_table *) realloc(sym_array, (num_syms+1) * sizeof(struct sym_table)); if ( sym_array == (struct sym_table *) 0 ) return(0); /* Then the space for the symbol. */ - sym_array[num_syms].name = (char *) malloc(strlen(symbol)*sizeof(char)\ - + 1); + sym_array[num_syms].name = (char *) malloc(strlen(symbol)*sizeof(char) + 1); if ( sym_array[num_syms].name == (char *) 0 ) return(0); @@ -583,12 +556,7 @@ static int AddSymbol(unsigned long address, char *symbol) * If a match is found the pointer to the symbolic name most * closely matching the address is returned. **************************************************************************/ -char * LookupSymbol(value, sym) - - unsigned long value; - - struct symbol *sym; - +char * LookupSymbol(unsigned long value, struct symbol *sym) { auto int lp; @@ -606,10 +574,8 @@ char * LookupSymbol(value, sym) if ( value < sym_array[0].value ) return((char *) 0); - for(lp = 0; lp <= num_syms; ++lp) - { - if ( sym_array[lp].value > value ) - { + for(lp = 0; lp <= num_syms; ++lp) { + if ( sym_array[lp].value > value ) { ksym.offset = value - sym_array[lp-1].value; ksym.size = sym_array[lp].value - \ sym_array[lp-1].value; @@ -620,20 +586,16 @@ char * LookupSymbol(value, sym) name = LookupModuleSymbol(value, &msym); - if ( ksym.offset == 0 && msym.offset == 0 ) - { + if ( ksym.offset == 0 && msym.offset == 0 ) { return((char *) 0); } if ( ksym.offset == 0 || msym.offset < 0 || - (ksym.offset > 0 && ksym.offset < msym.offset) ) - { + (ksym.offset > 0 && ksym.offset < msym.offset) ) { sym->offset = ksym.offset; sym->size = ksym.size; return(last); - } - else - { + } else { sym->offset = msym.offset; sym->size = msym.size; return(name); @@ -730,12 +692,10 @@ extern char *ExpandKadds(char *line, char *el) * messages in this line. */ if ( (num_syms == 0) || - (kp = strstr(line, "[<")) == (char *) 0 ) - { + (kp = strstr(line, "[<")) == (char *) 0 ) { #ifdef __sparc__ if (num_syms) { - /* - * On SPARC, register dumps do not have the [< >] characters in it. + /* On SPARC, register dumps do not have the [< >] characters in it. */ static struct sparc_tests { char *str; @@ -815,14 +775,12 @@ extern char *ExpandKadds(char *line, char *el) } /* Loop through and expand all kernel messages. */ - do - { + do { while ( sl < kp+1 ) *elp++ = *sl++; /* Now poised at a kernel delimiter. */ - if ( (kp = strstr(sl, ">]")) == (char *) 0 ) - { + if ( (kp = strstr(sl, ">]")) == (char *) 0 ) { strcpy(el, sl); return(el); } @@ -839,8 +797,7 @@ extern char *ExpandKadds(char *line, char *el) (sym.size==0) ? symbol+1 : symbol, sym.offset, sym.size); value = 2; - if ( sym.size != 0 ) - { + if ( sym.size != 0 ) { --value; ++kp; elp += sprintf(elp, "+0x%x/0x%02x", sym.offset, sym.size); @@ -871,7 +828,6 @@ extern char *ExpandKadds(char *line, char *el) * present when resolving kernel exceptions. * Return: void **************************************************************************/ - extern void SetParanoiaLevel(int level) { i_am_paranoid = level; diff --git a/plugins/imklog/ksym_mod.c b/plugins/imklog/ksym_mod.c index ec1231be..11535a5f 100644 --- a/plugins/imklog/ksym_mod.c +++ b/plugins/imklog/ksym_mod.c @@ -1,8 +1,10 @@ /* - ksym_mod.c - functions for building symbol lookup tables for klogd - Copyright (c) 1995, 1996 Dr. G.W. Wettstein - Copyright (c) 1996 Enjellic Systems Development - + * ksym_mod.c - functions for building symbol lookup tables for klogd + * Copyright (c) 1995, 1996 Dr. G.W. Wettstein + * Copyright (c) 1996 Enjellic Systems Development + * Copyright (c) 1998-2007 Martin Schulze + * Copyright (C) 2007-2008 Rainer Gerhards + * * This file is part of rsyslog. * * Rsyslog is free software: you can redistribute it and/or modify @@ -145,9 +147,7 @@ extern int InitMsyms(void) auto int rtn, tmp; - FILE *ksyms; - char buf[128]; char *p; @@ -156,8 +156,7 @@ extern int InitMsyms(void) ksyms = fopen(KSYMS, "r"); - if ( ksyms == NULL ) - { + if ( ksyms == NULL ) { if ( errno == ENOENT ) Syslog(LOG_INFO, "No module symbols loaded - " "kernel modules not enabled.\n"); @@ -170,8 +169,7 @@ extern int InitMsyms(void) dbgprintf("Loading kernel module symbols - Source: %s\n", KSYMS); - while ( fgets(buf, sizeof(buf), ksyms) != NULL ) - { + while ( fgets(buf, sizeof(buf), ksyms) != NULL ) { if (num_syms > 0 && index(buf, '[') == NULL) continue; @@ -187,13 +185,13 @@ extern int InitMsyms(void) AddSymbol(buf); } - fclose(ksyms); + if(ksyms != NULL) + fclose(ksyms); have_modules = 1; /* Sort the symbol tables in each module. */ - for (rtn = tmp = 0; tmp < num_modules; ++tmp) - { + for (rtn = tmp = 0; tmp < num_modules; ++tmp) { rtn += sym_array_modules[tmp].num_syms; if ( sym_array_modules[tmp].num_syms < 2 ) continue; @@ -243,14 +241,11 @@ extern void DeinitMsyms(void) * Return: void **************************************************************************/ static void FreeModules() - { auto int nmods, nsyms; - auto struct Module *mp; - /* Check to see if the module symbol tables need to be cleared. */ have_modules = 0; if ( num_modules == 0 ) @@ -259,8 +254,7 @@ static void FreeModules() if ( sym_array_modules == NULL ) return; - for (nmods = 0; nmods < num_modules; ++nmods) - { + for (nmods = 0; nmods < num_modules; ++nmods) { mp = &sym_array_modules[nmods]; if ( mp->num_syms == 0 ) continue; @@ -278,28 +272,26 @@ static void FreeModules() return; } + /************************************************************************** - * * Function: AddModule - * * - * * Purpose: This function is responsible for adding a module to - * * the list of currently loaded modules. - * * - * * Arguments: (const char *) module - * * - * * module:-> The name of the module. - * * - * * Return: struct Module * - * **************************************************************************/ + * Function: AddModule + * + * Purpose: This function is responsible for adding a module to + * the list of currently loaded modules. + * + * Arguments: (const char *) module + * + * module:-> The name of the module. + * + * Return: struct Module * + **************************************************************************/ struct Module *AddModule(module) - const char *module; - { struct Module *mp; - if ( num_modules == 0 ) - { + if ( num_modules == 0 ) { sym_array_modules = (struct Module *)malloc(sizeof(struct Module)); if ( sym_array_modules == NULL ) @@ -308,9 +300,7 @@ struct Module *AddModule(module) return NULL; } mp = sym_array_modules; - } - else - { + } else { /* Allocate space for the module. */ mp = (struct Module *) \ realloc(sym_array_modules, \ @@ -353,9 +343,7 @@ struct Module *AddModule(module) * successful. False if not. **************************************************************************/ static int AddSymbol(line) - const char *line; - { char *module; unsigned long address; @@ -365,16 +353,13 @@ static int AddSymbol(line) module = index(line, '['); - if ( module != NULL ) - { + if ( module != NULL ) { p = index(module, ']'); - if ( p != NULL ) *p = '\0'; - p = module++; - - while ( isspace(*(--p)) ); + while ( isspace(*(--p)) ) + /*SKIP*/; *(++p) = '\0'; } @@ -392,14 +377,12 @@ static int AddSymbol(line) if ( num_modules == 0 || ( lastmodule == NULL && module != NULL ) || ( module == NULL && lastmodule != NULL) || - ( module != NULL && strcmp(module, lastmodule))) - { + ( module != NULL && strcmp(module, lastmodule))) { mp = AddModule(module); if ( mp == NULL ) return(0); - } - else + } else mp = &sym_array_modules[num_modules-1]; lastmodule = mp->name; @@ -444,29 +427,21 @@ static int AddSymbol(line) * closely matching the address is returned. **************************************************************************/ extern char * LookupModuleSymbol(value, sym) - unsigned long value; - struct symbol *sym; - { auto int nmod, nsym; - auto struct sym_table *last; - auto struct Module *mp; - static char ret[100]; - sym->size = 0; sym->offset = 0; if ( num_modules == 0 ) return((char *) 0); - for (nmod = 0; nmod < num_modules; ++nmod) - { + for (nmod = 0; nmod < num_modules; ++nmod) { mp = &sym_array_modules[nmod]; /* @@ -475,8 +450,7 @@ extern char * LookupModuleSymbol(value, sym) */ for(nsym = 1, last = &mp->sym_array[0]; nsym < mp->num_syms; - ++nsym) - { + ++nsym) { if ( mp->sym_array[nsym].value > value ) { if ( sym->size == 0 || @@ -507,4 +481,3 @@ extern char * LookupModuleSymbol(value, sym) /* It has been a hopeless exercise. */ return((char *) 0); } - diff --git a/plugins/imklog/ksyms.h b/plugins/imklog/ksyms.h index 316950a0..b5362ff3 100644 --- a/plugins/imklog/ksyms.h +++ b/plugins/imklog/ksyms.h @@ -1,10 +1,9 @@ -/* - ksym.h - Definitions for symbol table utilities. - Copyright (c) 1995, 1996 Dr. G.W. Wettstein - Copyright (c) 1996 Enjellic Systems Development - - This file is part of the sysklogd package, a kernel and system log daemon. - +/* ksym.h - Definitions for symbol table utilities. + * Copyright (c) 1995, 1996 Dr. G.W. Wettstein + * Copyright (c) 1996 Enjellic Systems Development + * Copyright (c) 2004-7 Martin Schulze + * Copyright (c) 2007-2008 Rainer Gerhards + * * This file is part of rsyslog. * * Rsyslog is free software: you can redistribute it and/or modify @@ -21,7 +20,7 @@ * along with Rsyslog. If not, see . * * A copy of the GPL can be found in the file "COPYING" in this distribution. -*/ + */ /* Variables, structures and type definitions static to this module. */ diff --git a/plugins/imklog/module.h b/plugins/imklog/module.h index 7a26ad02..38a26fea 100644 --- a/plugins/imklog/module.h +++ b/plugins/imklog/module.h @@ -1,6 +1,7 @@ -/* Module definitions for klogd's module support - * - * Copyright 2007 by Rainer Gerhards and others +/* module.h - Miscellaneous module definitions + * Copyright (c) 1996 Richard Henderson + * Copyright (c) 2004-7 Martin Schulze + * Copyright (c) 2007-2008 Rainer Gerhards * * This file is part of rsyslog. * @@ -19,7 +20,6 @@ * * A copy of the GPL can be found in the file "COPYING" in this distribution. */ - struct sym_table { unsigned long value; @@ -33,4 +33,3 @@ struct Module char *name; }; - -- cgit From 9ae630384e1d95d7289f44c8ac20597311704914 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Apr 2008 14:49:26 +0200 Subject: - bugfixes in legacy options processing, credits to varmojfekoj * reset errno before printing a warning message * misspelled directive name in code processing legacy options --- ChangeLog | 3 +++ syslogd.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8fda865b..901bc1d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ Version 3.14.2 (rgerhards), 2008-04-?? - bugfix: potential segfault in imklog when kernel is compiled without /proc/kallsyms and the file System.map is missing. Thanks to Andrea Morandi for pointing it out and suggesting a fix. +- bugfixes, credits to varmojfekoj: + * reset errno before printing a warning message + * misspelled directive name in code processing legacy options --------------------------------------------------------------------------- Version 3.14.1 (rgerhards), 2008-04-04 - bugfix: some messages were emited without hostname diff --git a/syslogd.c b/syslogd.c index 4d9f8257..ca70e7c3 100644 --- a/syslogd.c +++ b/syslogd.c @@ -1741,6 +1741,7 @@ void legacyOptsHook(void) while(pThis != NULL) { if(pThis->line != NULL) { + errno = 0; errmsg.LogError(NO_ERRCODE, "Warning: backward compatibility layer added to following " "directive to rsyslog.conf: %s", pThis->line); conf.cfsysline(pThis->line); @@ -3109,7 +3110,7 @@ int realMain(int argc, char **argv) legacyOptsEnq((uchar *) "ModLoad imuxsock"); bImUxSockLoaded = 1; } - legacyOptsEnq((uchar *) "OmitLocaLogging"); + legacyOptsEnq((uchar *) "OmitLocalLogging"); } else { fprintf(stderr, "error -o is no longer supported, use module imuxsock instead"); } -- cgit From 894ba37a55f5f723e3b87e87262707903b2ed6a2 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Apr 2008 15:53:15 +0200 Subject: removed files that no (longer) belong under souce control --- ANNOUNCE | 41 ------------------ compile | 142 --------------------------------------------------------------- 2 files changed, 183 deletions(-) delete mode 100644 ANNOUNCE delete mode 100755 compile diff --git a/ANNOUNCE b/ANNOUNCE deleted file mode 100644 index 85475306..00000000 --- a/ANNOUNCE +++ /dev/null @@ -1,41 +0,0 @@ -I am pleased to announce the initial beta release of the rsyslog package. - -Rsyslog has been forked from the sysklogd package. It currently shares its -base design but includes many important enhancements. Most importantly -it supports - -- the ability to receive syslog messages via tcp -- direct logging to MySQL database servers -- fully configurable output formats, including - * high precision timestamps with year ;) - * access to each of the message parts as well as substrings thereof - (includes access to facility and priority) - * access to the raw message received -- compatibility to stock linux syslogd - -Rsyslog is GPL'ed software. Details and the download on it can be found at - - http://www.monitorware.com/rsyslog/ - -This package has performed well in our test environments but it is a beta -release. So you might experience problems of all kind when you try it. So far, -it has been compiled Red Hat and Debian Linux as well as FreeBSD (but BSD -sometimes slips final testing and thus there might be some compile issues). - -We would appreciate any feedback from early testers, including bug reports, -additional platforms it runs on and new ideas. - -Thanks to everyone who has contributed ideas, patches and bug reports. -Special thanks to Tina Bird for being a constant source of new ideas and also -to Bennett Todd for his suggestions (yes, those back from 2003 also finally -made it into rsyslog ;)). - -We hope to receive ample feedback. The more feedback we receive, the more -enhancements will happen (and the faster they will appear). You can -send any feedback and suggestion to the rsyslog mailing list. Archive -and subscription management is available at - -http://lists.adiscon.net/mailman/listinfo/rsyslog - -Rainer Gerhards -Adiscon diff --git a/compile b/compile deleted file mode 100755 index 1b1d2321..00000000 --- a/compile +++ /dev/null @@ -1,142 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. - -scriptversion=2005-05-14.22 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; -esac - -ofile= -cfile= -eat= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: -- cgit From 830be9525052f89aa5b436883083f0df047842bc Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Apr 2008 16:02:16 +0200 Subject: rklogd is no longer part of rsyslog, so we don't need the man --- rklogd.8 | 440 --------------------------------------------------------------- 1 file changed, 440 deletions(-) delete mode 100644 rklogd.8 diff --git a/rklogd.8 b/rklogd.8 deleted file mode 100644 index 8ef99c2c..00000000 --- a/rklogd.8 +++ /dev/null @@ -1,440 +0,0 @@ -.\" Copyright 1994 Dr. Greg Wettstein, Enjellic Systems Development. -.\" May be distributed under the GNU General Public License -.\" Sun Jul 30 01:35:55 MET: Martin Schulze: Updates -.\" Sun Nov 19 23:22:21 MET: Martin Schulze: Updates -.\" Mon Aug 19 09:42:08 CDT 1996: Dr. G.W. Wettstein: Updates -.\" -.TH RKLOGD 8 "12 February 2008" "Version 2.0.2" "Linux System Administration" -.SH NAME -rklogd \- Kernel Log Daemon -.LP -.SH SYNOPSIS -.B rklogd -.RB [ " \-c " -.I n -] -.RB [ " \-d " ] -.RB [ " \-f " -.I fname -] -.RB [ " \-iI " ] -.RB [ " \-n " ] -.RB [ " \-o " ] -.RB [ " \-p " ] -.RB [ " \-s " ] -.RB [ " \-k " -.I fname -] -.RB [ " \-v " ] -.RB [ " \-x " ] -.RB [ " \-2 " ] -.LP -.SH DESCRIPTION -.B rklogd -is a system daemon which intercepts and logs Linux kernel -messages. -.LP -.SH OPTIONS -.TP -.BI "\-c " n -Sets the default log level of console messages to \fIn\fR. -.TP -.B "\-d" -Enable debugging mode. This will generate \fBLOTS\fR of output to -stderr. -.TP -.BI "\-f " file -Log messages to the specified filename rather than to the syslog facility. -.TP -.BI "\-i \-I" -Signal the currently executing rklogd daemon. Both of these switches control -the loading/reloading of symbol information. The \-i switch signals the -daemon to reload the kernel module symbols. The \-I switch signals for a -reload of both the static kernel symbols and the kernel module symbols. -.TP -.B "\-n" -Avoid auto-backgrounding. This is needed especially if the -.B rklogd -is started and controlled by -.BR init (8). -.TP -.B "-o" -Execute in 'one\-shot' mode. This causes \fBrklogd\fP to read and log -all the messages that are found in the kernel message buffers. After -a single read and log cycle the daemon exits. -.TP -.B "-p" -Enable paranoia. This option controls when rklogd loads kernel module symbol -information. Setting this switch causes rklogd to load the kernel module -symbol information whenever an Oops string is detected in the kernel message -stream. -.TP -.B "-s" -Force \fBrklogd\fP to use the system call interface to the kernel message -buffers. -.TP -.BI "\-k " file -Use the specified file as the source of kernel symbol information. -.TP -.B "\-v" -Print version and exit. -.TP -.B "\-x" -Omits EIP translation and therefore doesn't read the System.map file. -.TP -.B "\-2" -When symbols are expanded, print the line twice. Once with addresses -converted to symbols, once with the raw text. This allows external -programs such as ksymoops do their own processing on the original -data. -.LP -.SH OVERVIEW -The functionality of rklogd has been typically incorporated into other -versions of syslogd but this seems to be a poor place for it. In the -modern Linux kernel a number of kernel messaging issues such as -sourcing, prioritization and resolution of kernel addresses must be -addressed. Incorporating kernel logging into a separate process -offers a cleaner separation of services. - -In Linux there are two potential sources of kernel log information: the -.I /proc -file system and the syscall (sys_syslog) interface, although -ultimately they are one and the same. Klogd is designed to choose -whichever source of information is the most appropriate. It does this -by first checking for the presence of a mounted -.I /proc -file system. If this is found the -.I /proc/kmsg -file is used as the source of kernel log -information. If the proc file system is not mounted -.B rklogd -uses a -system call to obtain kernel messages. The command line switch -.RB ( "\-s" ) -can be used to force rklogd to use the system call interface as its -messaging source. - -If kernel messages are directed through the -.BR syslogd " daemon the " rklogd -daemon, as of version 1.1, has the ability to properly prioritize -kernel messages. Prioritization of the kernel messages was added to it -at approximately version 0.99pl13 of the kernel. The raw kernel messages -are of the form: -.IP -\<[0\-7]\>Something said by the kernel. -.PP -The priority of the kernel message is encoded as a single numeric -digit enclosed inside the <> pair. The definitions of these values is -given in the kernel include file kernel.h. When a message is received -from the kernel the rklogd daemon reads this priority level and assigns -the appropriate priority level to the syslog message. If file output -(\fB-f\fR) is used the prioritization sequence is left pre\-pended to the -kernel message. - -The -.B rklogd -daemon also allows the ability to alter the presentation of -kernel messages to the system console. Consequent with the -prioritization of kernel messages was the inclusion of default -messaging levels for the kernel. In a stock kernel the the default -console log level is set to 7. Any messages with a priority level -numerically lower than 7 (higher priority) appear on the console. - -Messages of priority level 7 are considered to be 'debug' messages and -will thus not appear on the console. Many administrators, -particularly in a multi\-user environment, prefer that all kernel -messages be handled by rklogd and either directed to a file or to -the syslogd daemon. This prevents 'nuisance' messages such as line -printer out of paper or disk change detected from cluttering the -console. - -When -.B \-c -is given on the commandline the -.B rklogd -daemon will execute a system call to inhibit all kernel messages from -being displayed on the console. Former versions always issued this -system call and defaulted to all kernel messages except for panics. -This is handled differently nowardays so -.B rklogd -doesn't need to set this value anymore. The -argument given to the \fB\-c\fR switch specifies the priority level of -messages which will be directed to the console. Note that messages of -a priority value LOWER than the indicated number will be directed to -the console. -.IP -For example, to have the kernel display all messages with a -priority level of 3 -.BR "" ( KERN_ERR ) -or more severe the following -command would be executed: -.IP -.nf - rklogd \-c 4 -.fi -.PP -The definitions of the numeric values for kernel messages are given in -the file -.IR kernel.h " which can be found in the " /usr/include/linux -directory if the kernel sources are installed. These values parallel -the syslog priority values which are defined in the file -.IR syslog.h " found in the " /usr/include/sys " sub\-directory." - -The rklogd daemon can also be used in a 'one\-shot' mode for reading the -kernel message buffers. One shot mode is selected by specifying the -\fB\-o\fR switch on the command line. Output will be directed to either the -syslogd daemon or to an alternate file specified by the \fB-f\fR switch. -.IP -For example, to read all the kernel messages after a system -boot and record them in a file called krnl.msg the following -command would be given. -.IP -.nf - rklogd -o -f ./krnl.msg -.fi -.PP -.SH KERNEL ADDRESS RESOLUTION -If the kernel detects an internal error condition a general protection -fault will be triggered. As part of the GPF handling procedure the -kernel prints out a status report indicating the state of the -processor at the time of the fault. Included in this display are the -contents of the microprocessor's registers, the contents of the kernel -stack and a tracing of what functions were being executed at the time -of the fault. - -This information is -.B EXTREMELY IMPORTANT -in determining what caused the internal error condition. The -difficulty comes when a kernel developer attempts to analyze this -information. The raw numeric information present in the protection -fault printout is of very little use to the developers. This is due -to the fact that kernels are not identical and the addresses of -variable locations or functions will not be the same in all kernels. -In order to correctly diagnose the cause of failure a kernel developer -needs to know what specific kernel functions or variable locations -were involved in the error. - -As part of the kernel compilation process a listing is created which -specified the address locations of important variables and function in -the kernel being compiled. This listing is saved in a file called -System.map in the top of the kernel directory source tree. Using this -listing a kernel developer can determine exactly what the kernel was -doing when the error condition occurred. - -The process of resolving the numeric addresses from the protection -fault printout can be done manually or by using the -.B ksymoops -program which is included in the kernel sources. - -As a convenience -.B rklogd -will attempt to resolve kernel numeric addresses to their symbolic -forms if a kernel symbol table is available at execution time. If you -require the original address of the symbol, use the -.B -2 -switch to preserve the numeric address. A -symbol table may be specified by using the \fB\-k\fR switch on the -command line. If a symbol file is not explicitly specified the -following filenames will be tried: - -.nf -.I /boot/System.map -.I /System.map -.I /usr/src/linux/System.map -.fi - -Version information is supplied in the system maps as of kernel -1.3.43. This version information is used to direct an intelligent -search of the list of symbol tables. This feature is useful since it -provides support for both production and experimental kernels. - -For example a production kernel may have its map file stored in -/boot/System.map. If an experimental or test kernel is compiled with -the sources in the 'standard' location of /usr/src/linux the system -map will be found in /usr/src/linux/System.map. When rklogd starts -under the experimental kernel the map in /boot/System.map will be -bypassed in favor of the map in /usr/src/linux/System.map. - -Modern kernels as of 1.3.43 properly format important kernel addresses -so that they will be recognized and translated by rklogd. Earlier -kernels require a source code patch be applied to the kernel sources. -This patch is supplied with the sysrklogd sources. - -The process of analyzing kernel protections faults works very well -with a static kernel. Additional difficulties are encountered when -attempting to diagnose errors which occur in loadable kernel modules. -Loadable kernel modules are used to implement kernel functionality in -a form which can be loaded or unloaded at will. The use of loadable -modules is useful from a debugging standpoint and can also be useful -in decreasing the amount of memory required by a kernel. - -The difficulty with diagnosing errors in loadable modules is due to -the dynamic nature of the kernel modules. When a module is loaded the -kernel will allocate memory to hold the module, when the module is -unloaded this memory will be returned back to the kernel. This -dynamic memory allocation makes it impossible to produce a map file -which details the addresses of the variable and functions in a kernel -loadable module. Without this location map it is not possible for a -kernel developer to determine what went wrong if a protection fault -involves a kernel module. - -.B rklogd -has support for dealing with the problem of diagnosing protection -faults in kernel loadable modules. At program start time or in -response to a signal the daemon will interrogate the kernel for a -listing of all modules loaded and the addresses in memory they are -loaded at. Individual modules can also register the locations of -important functions when the module is loaded. The addresses of these -exported symbols are also determined during this interrogation -process. - -When a protection fault occurs an attempt will be made to resolve -kernel addresses from the static symbol table. If this fails the -symbols from the currently loaded modules are examined in an attempt -to resolve the addresses. At the very minimum this allows rklogd to -indicate which loadable module was responsible for generating the -protection fault. Additional information may be available if the -module developer chose to export symbol information from the module. - -Proper and accurate resolution of addresses in kernel modules requires -that -.B rklogd -be informed whenever the kernel module status changes. The -.B \-i -and -.B \-I -switches can be used to signal the currently executing daemon that -symbol information be reloaded. Of most importance to proper -resolution of module symbols is the -.B \-i -switch. Each time a kernel module is loaded or removed from the -kernel the following command should be executed: - -.nf -.I rklogd \-i -.fi - -The -.B \-p -switch can also be used to insure that module symbol information is up -to date. This switch instructs -.B rklogd -to reload the module symbol information whenever a protection fault -is detected. Caution should be used before invoking the program in -\'paranoid\' mode. The stability of the kernel and the operating -environment is always under question when a protection fault occurs. -Since the rklogd daemon must execute system calls in order to read the -module symbol information there is the possibility that the system may -be too unstable to capture useful information. A much better policy -is to insure that rklogd is updated whenever a module is loaded or -unloaded. Having uptodate symbol information loaded increases the -probability of properly resolving a protection fault if it should occur. - -Included in the sysrklogd source distribution is a patch to the -modules-2.0.0 package which allows the -.B insmod, -.B rmmod -and -.B modprobe -utilities to automatically signal -.B rklogd -whenever a module is inserted or removed from the kernel. Using this -patch will insure that the symbol information maintained in rklogd is -always consistent with the current kernel state. -.PP -.SH SIGNAL HANDLING -The -.B rklogd -will respond to eight signals: -.BR SIGHUP ", " SIGINT ", " SIGKILL ", " SIGTERM ", " SIGTSTP ", " -.BR SIGUSR1 ", "SIGUSR2 " and " SIGCONT ". The" -.BR SIGINT ", " SIGKILL ", " SIGTERM " and " SIGHUP -signals will cause the daemon to close its kernel log sources and -terminate gracefully. - -The -.BR SIGTSTP " and " SIGCONT -signals are used to start and stop kernel logging. Upon receipt of a -.B SIGTSTP -signal the daemon will close its -log sources and spin in an idle loop. Subsequent receipt of a -.B SIGCONT -signal will cause the daemon to go through its initialization sequence -and re-choose an input source. Using -.BR SIGSTOP " and " SIGCONT -in combination the kernel log input can be re-chosen without stopping and -restarting the daemon. For example if the \fI/proc\fR file system is to be -un-mounted the following command sequence should be used: -.PP -.PD 0 -.TP - # kill -TSTP pid -.TP - # umount /proc -.TP - # kill -CONT pid -.PD -.PP -Notations will be made in the system logs with -.B LOG_INFO -priority -documenting the start/stop of logging. - -The -.BR SIGUSR1 " and " SIGUSR2 -signals are used to initiate loading/reloading of kernel symbol information. -Receipt of the -.B SIGUSR1 -signal will cause the kernel module symbols to be reloaded. Signaling the -daemon with -.B SIGUSR2 -will cause both the static kernel symbols and the kernel module symbols to -be reloaded. - -Provided that the System.map file is placed in an appropriate location the -signal of generally greatest usefulness is the -.B SIGUSR1 -signal. This signal is designed to be used to signal the daemon when kernel -modules are loaded/unloaded. Sending this signal to the daemon after a -kernel module state change will insure that proper resolution of symbols will -occur if a protection fault occurs in the address space occupied by a kernel -module. -.LP -.SH FILES -.PD 0 -.TP -.I /proc/kmsg -One Source for kernel messages -.B rklogd -.TP -.I /var/run/rklogd.pid -The file containing the process id of -.B rklogd -.TP -.I /boot/System.map, /System.map, /usr/src/linux/System.map -Default locations for kernel system maps. -.PD -.SH BUGS -Probably numerous. Well formed context diffs appreciated. -.LP -.SH AUTHOR -The -.B rklogd -was originally written by Steve Lord (lord@cray.com), Greg Wettstein -made major improvements. - -.PD 0 -.TP -Dr. Greg Wettstein (greg@wind.enjellic.com) -.TP -Enjellic Systems Development -.PD -.PP -.PD 0 -.TP -Oncology Research Divsion Computing Facility -.TP -Roger Maris Cancer Center -.TP -Fargo, ND 58122 -.PD -- cgit From 2a6b13ae0d11244648f3705dc20cc90aa83b9a3d Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 8 Apr 2008 17:10:52 +0200 Subject: bugfix: some legacy options not correctly interpreted - thanks to varmojfekoj for the patch --- ChangeLog | 2 ++ syslogd.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 901bc1d6..ac04af2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ Version 3.14.2 (rgerhards), 2008-04-?? - bugfixes, credits to varmojfekoj: * reset errno before printing a warning message * misspelled directive name in code processing legacy options +- bugfix: some legacy options not correctly interpreted - thanks to + varmojfekoj for the patch --------------------------------------------------------------------------- Version 3.14.1 (rgerhards), 2008-04-04 - bugfix: some messages were emited without hostname diff --git a/syslogd.c b/syslogd.c index ca70e7c3..4265bd45 100644 --- a/syslogd.c +++ b/syslogd.c @@ -3023,7 +3023,7 @@ int realMain(int argc, char **argv) /* END core initializations */ - while ((ch = getopt(argc, argv, "46Ac:dehi:f:g:l:m:M:nqQr::s:t:u:vwx")) != EOF) { + while ((ch = getopt(argc, argv, "46aAc:def:g:hi:l:m:M:nopqQr::s:t:u:vwx")) != EOF) { switch((char)ch) { case '4': family = PF_INET; -- cgit