diff --git a/CMakeLists.txt b/CMakeLists.txt index c8e14f5101..4c663b3671 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,6 @@ set(SYSLOG_NG_PATH_TOPSRC_DIR "${PROJECT_SOURCE_DIR}") set(LIBDIR "\${exec_prefix}/lib") set(INCLUDEDIR "\${prefix}/include") set(TOOLSDIR "\${datadir}/syslog-ng/tools") -set(SYSLOG_NG_ENABLE_FORCED_SERVER_MODE 1) set (LOGGEN_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/syslog-ng/loggen") diff --git a/cmake/syslog-ng-config.h.in b/cmake/syslog-ng-config.h.in index d3f538fdcd..cc31365c7e 100644 --- a/cmake/syslog-ng-config.h.in +++ b/cmake/syslog-ng-config.h.in @@ -28,7 +28,6 @@ #cmakedefine SYSLOG_NG_VERSION "@SYSLOG_NG_VERSION@" #cmakedefine SYSLOG_NG_COMBINED_VERSION "@SYSLOG_NG_COMBINED_VERSION@" #cmakedefine01 SYSLOG_NG_ENABLE_CPP -#cmakedefine01 SYSLOG_NG_ENABLE_FORCED_SERVER_MODE #cmakedefine01 SYSLOG_NG_ENABLE_DEBUG #cmakedefine01 SYSLOG_NG_ENABLE_GPROF #cmakedefine01 SYSLOG_NG_ENABLE_IPV6 diff --git a/configure.ac b/configure.ac index ca1ee34e50..76c252a271 100644 --- a/configure.ac +++ b/configure.ac @@ -193,9 +193,6 @@ AC_ARG_WITH(package_name, [ --with-package-name=package name Package name is printed out when syslog-ng started with --version], PACKAGE_NAME=$with_package_name) -AC_ARG_ENABLE(forced_server_mode, - [ --enable-forced-server-mode Enable forced server mode.],, enable_forced_server_mode="yes") - AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging code.],, enable_debug="no") @@ -2236,7 +2233,6 @@ AC_DEFINE_UNQUOTED(PACKAGE_NAME, "$PACKAGE_NAME", [package name]) AC_DEFINE_UNQUOTED(WITH_COMPILE_DATE, $wcmp_date, [Include the compile date in the binary]) -AC_DEFINE_UNQUOTED(ENABLE_FORCED_SERVER_MODE, `enable_value $enable_forced_server_mode`, [Enable forced server mode]) AC_DEFINE_UNQUOTED(ENABLE_DEBUG, `enable_value $enable_debug`, [Enable debugging]) AC_DEFINE_UNQUOTED(ENABLE_GPROF, `enable_value $enable_gprof`, [Enable gcc profiling]) AC_DEFINE_UNQUOTED(ENABLE_MEMTRACE, `enable_value $enable_memtrace`, [Enable memtrace]) @@ -2404,7 +2400,6 @@ echo " Unit tests : ${enable_tests:=no}" echo " Submodules:" echo " ivykis : $with_ivykis" echo " Features:" -echo " Forced server mode : ${enable_forced_server_mode:=yes}" echo " Debug symbols : ${enable_debug:=no}" echo " GCC profiling : ${enable_gprof:=no}" echo " Memtrace : ${enable_memtrace:=no}" diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 171544ff18..1684d9d6bd 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -78,10 +78,6 @@ EXTRA_DIST += \ \ contrib/apparmor/opt.syslog-ng.sbin.syslog-ng \ \ - contrib/balabit-initscripts/init.d \ - contrib/balabit-initscripts/init.d.freebsd \ - contrib/balabit-initscripts/init-functions \ - \ contrib/upstart/syslog-ng.conf.upstart \ contrib/systemd/syslog-ng@.service \ contrib/systemd/syslog-ng@default \ diff --git a/contrib/balabit-initscripts/init-functions b/contrib/balabit-initscripts/init-functions deleted file mode 100644 index 5b46c1bbbb..0000000000 --- a/contrib/balabit-initscripts/init-functions +++ /dev/null @@ -1,321 +0,0 @@ -# /lib/lsb/init-functions replacement for syslog-ng Premium Edition - -RED= -YELLOW= -NORMAL= -FANCYTTY= -PSOPTS= - -ECHO=echo - -OS=`uname -s` - -# LSB Functions -# ripped from ubuntu/debian lsb -log_use_fancy_output() { - case "$TERM" in - dumb|raw|serial|vt*|cons*|unknown) - return 1 - ;; - *) - if [ -n "$FANCYTTY" ] && [ $FANCYTTY -ne 1 ]; then - return 1 - fi - RED="\033[31m" - YELLOW="\033[33m" - NORMAL="\033[0m" - return 0 - ;; - esac - return 1 -} - -log_success_msg() { - $ECHO "$@" -} - -log_failure_msg() { - log_use_fancy_output - $ECHO "${RED}$@${NORMAL}" -} - -log_warning_msg() { - log_use_fancy_output - $ECHO "${YELLOW}$@${NORMAL}" -} - -# NON-LSB Functions - -log_begin_msg() { - if [ -z "$1" ]; then - return 1 - fi - - $ECHO "$@\c " -} - -log_daemon_msg() { - if [ -z "$1" ];then - return 1 - fi - - if [ -z "$2" ]; then - $ECHO "$1:\c " - return - fi - - $ECHO "$1: $2\c " -} - -log_progress_msg() { - if [ -z "$1" ]; then - return 1 - fi - - if [ $1 -eq 0 ]; then - $ECHO "." - else - $ECHO " failed" - fi -} - -log_end_msg() { - if [ -z "$1" ]; then - return 1 - fi - - log_fancy_output - if [ $1 -eq 0 ];then - $ECHO "." - else - $ECHO "${RED}failed!${NORMAL}" - fi - return $1 -} - -log_action_msg() { - $ECHO "$@." -} - -log_action_begin_msg() { - $ECHO "$@...\c " -} - -log_action_cont_msg() { - $ECHO "$@...\c " -} - -log_action_end_msg() { - if [ -z "$2" ]; then - end="." - else - end=" ($2)." - fi - - log_fancy_output - if [ $1 -eq 0 ]; then - $ECHO "done${end}" - else - $ECHO "${RED}failed${end}${NORMAL}" - fi -} - -# overide log_*_msg if the init-functions file exits on the system -[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions - -# in these three cases we have to use our functions -unalias start_daemon 2>/dev/null -unalias killproc 2>/dev/null -unalias pidofproc 2>/dev/null - - -disable_xpg_echo() { - # \X chars only passed to echo under bash, if xpg_echo enabled or echo -e - # used on Linux. - if [ -n "$BASH_VERSION" ];then - shopt -s xpg_echo - fi -} - -case $OS in - # default ps -e cuts the process' name at 8 characters, so we have to list it - # in a long form - SunOS) - PSOPTS=" -o pid -o tty -o time -o comm" - disable_xpg_echo - ;; - Linux) - if [ -z "$BASH_VERSION" ]; then - # beware of dash's builtin echo ... - ECHO="/bin/echo -e" - fi - ;; - *) disable_xpg_echo ;; -esac - - -_checkpid() { - _pid=$1 - _proc=$2 - - for _ret in `ps -e $PSOPTS | grep "$_proc" | sed -e 's/^ *//' -e 's/ .*//'`; do - if [ -n "$_ret" ] && [ "$_ret" = "$_pid" ]; then - return 0 - fi - done - return 1 -} - -_pid_from_pidfile() { - pidfile=$1 - procname=$2 - pid= - - if [ -f "$pidfile" ];then - pid=`head -1 $pidfile 2> /dev/null` - if [ $? -ne 0 ]; then - # on slow machines (or ones under high load) the pidfile could be - # erased between -f and `head` ... - return 3 - fi - if _checkpid $pid $procname; then - return 0 - fi - return 1 # pidfile exist, but proc not running - fi - - return 3 # proc not running -} - -pidofproc() { - proc= - pidfile= - - if [ "$1" = "-p" ];then - pidfile=$2 - shift - shift - fi - - if [ -z "$1" ];then - echo "Usage: pidofproc [-p pidfile] {program}" - return 1 - fi - proc=$1 - shift - - base=`basename ${proc}` - if [ -z "${pidfile}" ]; then - pidfile=/var/run/${base}.pid - fi - - if [ -f ${pidfile} ];then - _pid_from_pidfile "${pidfile}" "${base}" - _ret=$? - - if [ $_ret -eq 0 ]; then - if kill -0 ${pid} 2> /dev/null; then - echo "$pid" - return 0 - fi - else - return $_ret - fi - fi - - return 4 -} - -start_daemon() { - proc= - pidfile= - force= - nice= - - if [ "$1" = "-f" ]; then - force="force" - shift - fi - - if [ "$1" = "-n" ];then - nice="nice $2" - shift - shift - fi - - if [ "$1" = "-p" ];then - pidfile=$2 - shift - shift - fi - - if [ -z "$1" ];then - echo "Usage: start_daemon [-f] [-n nicelevel] [-p pidfile] {program} [args]" - return 1 - fi - proc=$1 - shift - - base=`basename ${proc}` - if [ -z "${pidfile}" ]; then - pidfile=/var/run/${base}.pid - fi - _pid_from_pidfile "${pidfile}" "${base}" - if [ -n "$pid" ] && [ -z "$force" ];then - return - fi - - $nice $proc $* - return $? -} - -killproc() { - proc= - signal=-15 - pidfile= - - if [ "$1" = "-p" ];then - pidfile=$2 - shift - shift - fi - - if [ -z "$1" ];then - echo "Usage: killproc [-p pidfile] {program}" - return 1 - fi - proc=$1 - shift - - if [ -n "$1" ];then - signal=$1 - echo "${signal}" | grep '^-' >/dev/null 2>&1 - if [ $? -ne 0 ]; then - signal="-${signal}" - fi - fi - - base=`basename $proc` - if [ -z "${pidfile}" ]; then - pidfile=/var/run/${base}.pid - fi - - _pid_from_pidfile "${pidfile}" "${base}"; - _ret=$? - if [ $_ret -ne 0 ];then - rm -f ${pidfile} - return $_ret - fi - - if [ -n "$pid" ]; then - kill $signal $pid - _status="$?" - if [ $_status -eq 0 ];then - pidofproc -p "${pidfile}" "$proc" >/dev/null || rm -f "${pidfile}" - fi - fi - return $_retval -} - -# vim: ft=sh ts=2 expandtab - diff --git a/contrib/balabit-initscripts/init.d b/contrib/balabit-initscripts/init.d deleted file mode 100644 index 8f5cc2cd81..0000000000 --- a/contrib/balabit-initscripts/init.d +++ /dev/null @@ -1,336 +0,0 @@ -#!/bin/sh - -# syslog-ng This starts and stops syslog-ng -# -# chkconfig: - 12 88 -# processname: /opt/syslog-ng/sbin/syslog-ng -# config: /opt/syslog-ng/etc/syslog-ng.conf -# config: /etc/sysconfig/syslog-ng -# pidfile: /var/run/syslog-ng.pid - -### BEGIN INIT INFO -# Provides: syslog -# Description: reads and logs messages to the system console, log \ -# files, other machines and/or users as specified by \ -# its configuration file. -# Short-Description: Next-generation syslog server. -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -### END INIT INFO - -OS=`uname -s` - -DEFAULTFILE=/etc/default/syslog-ng -[ -f ${DEFAULTFILE} ] && . ${DEFAULTFILE} - -SYSLOGNG_PREFIX=${SYSLOGNG_PE_PREFIX:-/opt/syslog-ng} -export SYSLOGNG_PREFIX -SYSLOGNG="$SYSLOGNG_PREFIX/sbin/syslog-ng" -CONFFILE=$SYSLOGNG_PREFIX/etc/syslog-ng.conf -PIDFILE=$SYSLOGNG_PREFIX/var/run/syslog-ng.pid -SYSLOGPIDFILE="/var/run/syslog.pid" - -SLNG_INIT_FUNCTIONS=$SYSLOGNG_PREFIX/lib/init-functions -MAXWAIT=30 - -# for RedHat... -SUBSYSDIR=/var/lock/subsys - -retval=0 - -# in HPUX, PATH for init scripts does not contain standard dirs for binaries -if [ "$OS" = "HP-UX" ]; then - PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin -fi - - -# OS specific I-didn't-do-anything exit function. -exit_noop() { - case $OS in - HP-UX) exit 2 - ;; - *) exit 0 - ;; - esac -} - -# Platform specific echo -n implementation. -echo_n() { - case "$OS" in - SunOS) echo "$@\c " - ;; - HP-UX) echo " $@\c " - ;; - *) echo -n "$@" - ;; - esac -} - -test -x ${SYSLOGNG} || exit_noop -test -r ${CONFFILE} || exit_noop - -if [ -f /etc/lsb-release ]; then - . /etc/lsb-release -fi - -if [ -f "/etc/redhat-release" ];then - # redhat uses a different syslogd pidfile... - SYSLOGPIDFILE="/var/run/syslogd.pid" -fi - -if [ "$OS" = "SunOS" ] || [ "$OS" = "Solaris" ];then - if [ "`uname -r`" = "5.8" ];then - SYSLOGPIDFILE="/etc/syslog.pid" - fi -fi - -. $SLNG_INIT_FUNCTIONS - -case "$OS" in - Linux) - SYSLOGNG_OPTIONS="--no-caps" - ;; -esac - -#we source /etc/default/syslog-ng if exists -[ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng - -# Source config on RPM systems -[ -r /etc/sysconfig/syslog-ng ] && . /etc/sysconfig/syslog-ng - -#we source /etc/default/syslog-ng if exists -[ -r $SYSLOGNG_PREFIX/etc/default/syslog-ng ] && \ - . $SYSLOGNG_PREFIX/etc/default/syslog-ng - -create_xconsole() { - if grep -v '^#' $CONFFILE | grep /dev/xconsole >/dev/null 2>&1; then - if [ ! -e /dev/xconsole ]; then - mknod -m 640 /dev/xconsole p - fi - fi -} - -check_syntax() { - ${SYSLOGNG} --no-caps --syntax-only - _rval=$? - [ $_rval -eq 0 ] || exit $_rval -} - -slng_waitforpid() { - _pid=$1 - _process=$2 - _cnt=$MAXWAIT - - # no pid, return... - [ -z "$_pid" ] && return 0 - - _procname=`basename $_process` - - while [ $_cnt -gt 0 ]; do - _numproc=`ps -p $_pid $PSOPTS | grep $_procname | wc -l` - if [ $_numproc -eq 0 ]; then - return 0 - fi - _cnt=`expr $_cnt - 1` - sleep 1 - done - return 1 -} - -returnmessage() { - _rval=$1 - is_debian=0 - case "$OS" in - Linux) - res=`cat /etc/issue | grep Debian` - is_debian=$? - ;; - esac - if [ $_rval -ne 0 ];then - if [ $is_debian -eq 0 ];then - log_failure_msg "failed" - else - log_failure_msg - fi - else - if [ $is_debian -eq 0 ];then - log_success_msg "OK" - else - log_success_msg - fi - fi -} - -syslogng_start() { - echo_n "Starting syslog-ng: " - PID=`pidofproc -p ${PIDFILE} ${SYSLOGNG} | head -1` - if [ -n "$PID" ] && [ $PID -gt 0 ] ;then - log_success_msg "already running: $PID" - return $retval - fi - rm -f ${PIDFILE} - start_daemon -f -p ${PIDFILE} ${SYSLOGNG} ${SYSLOGNG_OPTIONS} - retval=$? - returnmessage $retval - if [ $retval -eq 0 ];then - if [ "$OS" = "Linux" ] && [ -d $SUBSYSDIR ];then - touch $SUBSYSDIR/syslog-ng - fi - # remove symlinks - if [ -h $SYSLOGPIDFILE ];then - rm -f $SYSLOGPIDFILE - fi - if [ ! -f $SYSLOGPIDFILE ];then - ln -s $PIDFILE $SYSLOGPIDFILE - fi - fi - return $retval -} - -# Can't name the function stop, because HP-UX has a default alias named stop... -syslogng_stop() { - echo_n "Stopping syslog-ng: " - PID=`pidofproc -p ${PIDFILE} ${SYSLOGNG} | head -1` - retval=$? - if [ $retval -ne 0 ] || [ -z "$PID" ];then - return $retval - fi - killproc -p ${PIDFILE} ${SYSLOGNG} - retval=$? - if [ $retval -eq 0 ];then - slng_waitforpid "$PID" ${SYSLOGNG} - if [ $? -ne 0 ]; then - retval=$? - log_failure_msg " Timeout" - killproc -p ${PIDFILE} ${SYSLOGNG} -KILL - else - returnmessage $retval - fi - fi - if [ $retval -eq 0 ];then - rm -f $SUBSYSDIR/syslog-ng ${PIDFILE} - if [ -h $SYSLOGPIDFILE ];then - rm -f $SYSLOGPIDFILE - fi - fi - return $retval -} - -syslogng_restart() { - check_syntax - echo_n "Restarting syslog-ng: " - syslogng_stop - syslogng_start - return $retval -} - -syslogng_reload() { - echo_n "Reloading syslog-ng's config file: " - check_syntax - killproc -p ${PIDFILE} ${SYSLOGNG} -HUP - retval=$? - returnmessage $retval - return $retval -} - -syslogng_status() { - echo_n "Checking for syslog-ng service: " - pid=`pidofproc -p ${PIDFILE} ${SYSLOGNG}` - retval=$? - if [ $retval -ne 0 ];then - msg= - case $retval in - 1) msg="dead but pidfile exists." ;; - *) msg="stopped" ;; - esac - log_failure_msg "$msg" - else - log_success_msg "$pid running" - fi - return $retval -} - -syslogng_probe() { - if [ ${CONFFILE} -nt ${PIDFILE} ]; then - echo reload - fi -} - -case $OS in - Linux) - case "x$CONSOLE_LOG_LEVEL" in - x[1-8]) - dmesg -n $CONSOLE_LOG_LEVEL - ;; - x) - ;; - *) - echo "CONSOLE_LOG_LEVEL is of unaccepted value." - ;; - esac - create_xconsole - ;; - SunOS) - # - # Before syslog-ng starts, save any messages from previous - # crash dumps so that messages appear in chronological order. - # - if [ -r /dev/dump ]; then - /usr/bin/savecore -m - fi - if [ -r /etc/dumpadm.conf ]; then - . /etc/dumpadm.conf - if [ -n "$DUMPADM_DEVICE" ] && [ -r "$DUMPADM_DEVICE" ] && \ - [ "x$DUMPADM_DEVICE" != xswap ]; then - /usr/bin/savecore -m -f $DUMPADM_DEVICE - fi - fi - ;; - HP-UX) - # /etc/default/syslog-ng, the HP-UX way. - [ -r /etc/rc.config.d/syslog-ng ] && . /etc/rc.config.d/syslog-ng - ;; -esac - - -case "$1" in - start_msg) - echo "Start syslog-ng system message logging daemon" - ;; - stop_msg) - echo "Stop syslog-ng system message logging daemon" - ;; - start|stop|restart|reload|probe) - syslogng_$1 - ;; - force-reload) - syslogng_restart - ;; - reload-or-restart) - PID=`pidofproc -p ${PIDFILE} ${SYSLOGNG} | head -1` - if [ -n "$PID" ] && [ $PID -gt 0 ] ;then - syslogng_reload - else - syslogng_start - fi - ;; - status) - syslogng_status - ;; - condrestart|try-restart) - [ ! -f $lockfile ] || syslogng_restart - ;; - rotate) - syslogng_reload - ;; - *) - echo "Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload|probe}" - exit 2 - ;; -esac - -exit $retval - -# vim: ts=2 ft=sh noexpandtab diff --git a/contrib/balabit-initscripts/init.d.freebsd b/contrib/balabit-initscripts/init.d.freebsd deleted file mode 100644 index d2a929a385..0000000000 --- a/contrib/balabit-initscripts/init.d.freebsd +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh - -# startup script for FreeBSD 6.x. -# Written by Tamas Pal - -# PROVIDE: syslogd -# REQUIRE: mountcritremote cleanvar newsyslog -# BEFORE: SERVERS - -# Enabling syslog-ng: -# * copy this script to /etc/rc.d or /usr/local/etc/rc.d -# * Edit /etc/rc.conf and add the following lines: -# ----- CUT HERE ----- -# syslogd_enable="NO" -# syslogng_enable="YES" -# syslogng_flags="" -# ----- CUT HERE ----- -# * Add your extra flags to syslogng_flags EXCEPT the -p and -f -# flags. These are added automatically by this script. To set -# their value, change the value of the conf_file and pidfile variables below - -# BalaBit's platform independent variables. Please do not modify. -SYSLOGNG_PREFIX=/opt/syslog-ng - -. "/etc/rc.subr" - - -# FreeBSD rc specific variables. Please do not modify. -name="syslogng" -rcvar=`set_rcvar` -pidfile="$SYSLOGNG_PREFIX/var/run/syslog-ng.pid" -command="$SYSLOGNG_PREFIX/sbin/syslog-ng" -required_files="$SYSLOGNG_PREFIX/etc/syslog-ng.conf" - -start_precmd="syslog_ng_start_precmd" -start_postcmd="syslog_ng_start_postcmd" -stop_postcmd="syslog_ng_stop_postcmd" -reload_precmd="syslog_ng_reload_precmd" -extra_commands="reload" - -# get original syslog pidfile from initscript. -_syslogd_pidfile=`sed -n -e 's/^pidfile="\([^"]*\)"/\1/p' /etc/rc.d/syslogd 2> /dev/null` -syslog_ng_start_precmd() { - if [ ! -L /dev/log ]; then - ln -s /var/run/log /dev/log - fi -} - -syslog_ng_reload_precmd() { - $command --syntax-only - _rval=$? - if [ $_rval -ne 0 ];then - exit $_rval - fi -} - -syslog_ng_start_postcmd() { - if [ -n "$_syslogd_pidfile" ]; then - # remove symlinks - if [ -h $_syslogd_pidfile ]; then - rm -f $_syslogd_pidfile - fi - if [ ! -f $_syslogd_pidfile ]; then - ln -s "$pidfile" "$_syslogd_pidfile" - fi - fi -} - -syslog_ng_stop_postcmd() { - if [ -n "$_syslogd_pidfile" ]; then - if [ -h $_syslogd_pidfile ]; then - rm -f "$_syslogd_pidfile" - fi - fi -} - -load_rc_config "$name" - -case $1 in - start) - # Reportedly needed on 7.x. - PATH=$PATH:$SYSLOGNG_PREFIX/sbin - export PATH - syslogng_flags="${syslog_ng_flags}" - ;; -esac - -run_rc_command "$1" - -# vim: ft=sh diff --git a/lib/Makefile.am b/lib/Makefile.am index acecebb3e3..4a552ba080 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -186,7 +186,6 @@ pkginclude_HEADERS += \ lib/ringbuffer.h \ lib/host-id.h \ lib/resolved-configurable-paths.h \ - lib/pe-versioning.h \ lib/window-size-counter.h # this is intentionally formatted so conflicts are less likely to arise. one name in every line. diff --git a/lib/cfg.c b/lib/cfg.c index 2f9241703b..980c9e9a2a 100644 --- a/lib/cfg.c +++ b/lib/cfg.c @@ -149,32 +149,6 @@ cfg_load_module(GlobalConfig *cfg, const gchar *module_name) return cfg_load_module_with_args(cfg, module_name, NULL); } -void -cfg_load_forced_modules(GlobalConfig *self) -{ - static const gchar *module_list[] = - { -#if (!SYSLOG_NG_ENABLE_FORCED_SERVER_MODE) - "license" -#endif - }; - - if (!self->enable_forced_modules) - return; - - int i; - for (i=0; itree, self); plugin_context_init_instance(&self->plugin_context); self->use_plugin_discovery = TRUE; - self->enable_forced_modules = TRUE; cfg_register_builtin_plugins(self); return self; @@ -510,7 +483,6 @@ cfg_new_snippet(void) GlobalConfig *self = cfg_new(VERSION_VALUE_CURRENT); self->use_plugin_discovery = FALSE; - self->enable_forced_modules = FALSE; return self; } @@ -670,7 +642,6 @@ cfg_read_config(GlobalConfig *self, const gchar *fname, gchar *preprocess_into) gint res; cfg_discover_candidate_modules(self); - cfg_load_forced_modules(self); self->filename = fname; @@ -729,8 +700,6 @@ cfg_free(GlobalConfig *self) if (self->bad_hostname_compiled) regfree(&self->bad_hostname); g_free(self->recv_time_zone); - if (self->source_mangle_callback_list) - g_list_free(self->source_mangle_callback_list); g_free(self->bad_hostname_re); dns_cache_options_destroy(&self->dns_cache_options); g_free(self->custom_domain); @@ -795,22 +764,6 @@ cfg_get_user_version(const GlobalConfig *cfg) return cfg->user_version; } -void register_source_mangle_callback(GlobalConfig *src, mangle_callback cb) -{ - src->source_mangle_callback_list = g_list_append(src->source_mangle_callback_list, cb); -} - -gboolean -is_source_mangle_callback_registered(GlobalConfig *src, mangle_callback cb) -{ - return !!g_list_find(src->source_mangle_callback_list, cb); -} - -void uregister_source_mangle_callback(GlobalConfig *src, mangle_callback cb) -{ - src->source_mangle_callback_list = g_list_remove(src->source_mangle_callback_list, cb); -} - const gchar * cfg_get_filename(const GlobalConfig *cfg) { diff --git a/lib/cfg.h b/lib/cfg.h index 97ac576cc7..6a563d725d 100644 --- a/lib/cfg.h +++ b/lib/cfg.h @@ -69,7 +69,6 @@ struct _GlobalConfig const gchar *filename; PluginContext plugin_context; gboolean use_plugin_discovery; - gboolean enable_forced_modules; CfgLexer *lexer; CfgArgs *globals; @@ -100,7 +99,6 @@ struct _GlobalConfig gboolean create_dirs; FilePermOptions file_perm_options; - GList *source_mangle_callback_list; gboolean use_uniqid; gboolean keep_timestamp; @@ -163,7 +161,6 @@ gboolean cfg_run_parser(GlobalConfig *self, CfgLexer *lexer, CfgParser *parser, gboolean cfg_run_parser_with_main_context(GlobalConfig *self, CfgLexer *lexer, CfgParser *parser, gpointer *result, gpointer arg, const gchar *desc); gboolean cfg_read_config(GlobalConfig *cfg, const gchar *fname, gchar *preprocess_into); -void cfg_load_forced_modules(GlobalConfig *self); void cfg_shutdown(GlobalConfig *self); gboolean cfg_is_shutting_down(GlobalConfig *cfg); void cfg_free(GlobalConfig *self); @@ -176,12 +173,6 @@ void cfg_persist_config_move(GlobalConfig *src, GlobalConfig *dest); void cfg_persist_config_add(GlobalConfig *cfg, const gchar *name, gpointer value, GDestroyNotify destroy); gpointer cfg_persist_config_fetch(GlobalConfig *cfg, const gchar *name); -typedef gboolean(* mangle_callback)(GlobalConfig *cfg, LogMessage *msg, gpointer user_data); - -void register_source_mangle_callback(GlobalConfig *src, mangle_callback cb); -gboolean is_source_mangle_callback_registered(GlobalConfig *src, mangle_callback cb); -void uregister_source_mangle_callback(GlobalConfig *src, mangle_callback cb); - static inline gboolean __cfg_is_config_version_older(GlobalConfig *cfg, gint req) { diff --git a/lib/logsource.c b/lib/logsource.c index 336efae0ae..1366f647e5 100644 --- a/lib/logsource.c +++ b/lib/logsource.c @@ -594,27 +594,6 @@ log_source_post(LogSource *self, LogMessage *msg) scratch_buffers_reclaim_marked(mark); } -static gboolean -_invoke_mangle_callbacks(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options) -{ - LogSource *self = (LogSource *) s; - GList *next_item = g_list_first(self->options->source_queue_callbacks); - - while(next_item) - { - if(next_item->data) - { - if(!((mangle_callback) (next_item->data))(log_pipe_get_config(s), msg, self)) - { - log_msg_drop(msg, path_options, AT_PROCESSED); - return FALSE; - } - } - next_item = next_item->next; - } - return TRUE; -} - static void log_source_override_host(LogSource *self, LogMessage *msg) { @@ -679,10 +658,6 @@ log_source_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options log_msg_set_tag_by_id(msg, self->options->source_group_tag); - - if (!_invoke_mangle_callbacks(s, msg, path_options)) - return; - if (self->options->host_override) log_source_override_host(self, msg); @@ -862,8 +837,6 @@ log_source_options_init(LogSourceOptions *options, GlobalConfig *cfg, const gcha { gchar *source_group_name; - options->source_queue_callbacks = cfg->source_mangle_callback_list; - if (options->init_window_size == -1) options->init_window_size = 100; if (options->keep_hostname == -1) diff --git a/lib/logsource.h b/lib/logsource.h index 561904f698..8d67ebedb1 100644 --- a/lib/logsource.h +++ b/lib/logsource.h @@ -48,7 +48,6 @@ typedef struct _LogSourceOptions gboolean read_old_records; gboolean use_syslogng_pid; GArray *tags; - GList *source_queue_callbacks; gint stats_level; gint stats_source; } LogSourceOptions; diff --git a/lib/mainloop.c b/lib/mainloop.c index 1869f33f65..405625ff39 100644 --- a/lib/mainloop.c +++ b/lib/mainloop.c @@ -186,18 +186,6 @@ main_loop_get_instance(void) return &main_loop; } -void -main_loop_set_server_mode(MainLoop *self, gboolean server_mode) -{ - self->options->server_mode = server_mode; -} - -gboolean -main_loop_is_server_mode(MainLoop *self) -{ - return self->options->server_mode; -} - /* called when syslog-ng first starts up */ gboolean main_loop_initialize_state(GlobalConfig *cfg, const gchar *persist_filename) diff --git a/lib/mainloop.h b/lib/mainloop.h index 2eebb1b51e..5b5ed6ae2b 100644 --- a/lib/mainloop.h +++ b/lib/mainloop.h @@ -38,7 +38,6 @@ typedef struct _MainLoopOptions gboolean check_startup; gboolean config_id; gboolean interactive_mode; - gboolean server_mode; gboolean disable_module_discovery; } MainLoopOptions; @@ -80,8 +79,6 @@ void main_loop_init(MainLoop *self, MainLoopOptions *options); void main_loop_deinit(MainLoop *self); void main_loop_add_options(GOptionContext *ctx); -gboolean main_loop_is_server_mode(MainLoop *self); -void main_loop_set_server_mode(MainLoop *self, gboolean server_mode); gboolean main_loop_initialize_state(GlobalConfig *cfg, const gchar *persist_filename); diff --git a/lib/pe-versioning.h b/lib/pe-versioning.h deleted file mode 100644 index 0974752338..0000000000 --- a/lib/pe-versioning.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2017 Balabit - * Copyright (c) 2017 Laszlo Budai - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * As an additional exemption you are allowed to compile & link against the - * OpenSSL libraries as published by the OpenSSL project. See the file - * COPYING for details. - * - */ - diff --git a/lib/plugin.c b/lib/plugin.c index 168bd9fa3a..5e383abcdf 100644 --- a/lib/plugin.c +++ b/lib/plugin.c @@ -57,7 +57,6 @@ plugin_candidate_new(gint plugin_type, const gchar *name, const gchar *module_na self->super.type = plugin_type; self->super.name = g_strdup(name); self->module_name = g_strdup(module_name); - self->super.failure_info.aux_data = NULL; return self; } @@ -119,8 +118,6 @@ plugin_construct_from_config(Plugin *self, CfgLexer *lexer, gpointer arg) { LogPipe *p = (LogPipe *)instance; p->plugin_name = g_strdup(self->name); - if (self->failure_info.aux_data != NULL) - p->init = self->failure_info.aux_data; } return instance; @@ -340,7 +337,6 @@ plugin_find(PluginContext *context, gint plugin_type, const gchar *plugin_name) p = _find_plugin_in_list(context->plugins, plugin_type, plugin_name); if (p) { - p->failure_info.aux_data = candidate->super.failure_info.aux_data; return p; } else diff --git a/lib/plugin.h b/lib/plugin.h index 3953b7fff4..0ea4e76bf0 100644 --- a/lib/plugin.h +++ b/lib/plugin.h @@ -27,18 +27,12 @@ #include "cfg-parser.h" -typedef struct _PluginFailureInfo -{ - gconstpointer aux_data; -} PluginFailureInfo; - typedef struct _PluginBase { /* NOTE: the start of this structure must match the Plugin struct, thus it has to be changed together with Plugin */ gint type; gchar *name; - PluginFailureInfo failure_info; } PluginBase; typedef struct _PluginCandidate @@ -65,7 +59,6 @@ struct _Plugin gint type; const gchar *name; - PluginFailureInfo failure_info; CfgParser *parser; gpointer (*construct)(Plugin *self); void (*free_fn)(Plugin *s); diff --git a/lib/tests/test_logsource.c b/lib/tests/test_logsource.c index 1b52de4156..51f31f76de 100644 --- a/lib/tests/test_logsource.c +++ b/lib/tests/test_logsource.c @@ -352,65 +352,6 @@ Test(log_source, test_forced_suspend_and_wakeup) test_source_destroy(source); } - -static gboolean -test_mangle_callback_forbidden(GlobalConfig *config, LogMessage *msg, gpointer user_data) -{ - return strstr(log_msg_get_value(msg, LM_V_MESSAGE, NULL), "forbidden") == NULL; -} - -static gboolean -test_mangle_callback_tag(GlobalConfig *config, LogMessage *msg, gpointer user_data) -{ - log_msg_set_tag_by_name(msg, "tagged"); - return TRUE; -} - -static void -expect_forbidden_message_dropped(LogSource *source) -{ - LogMessage *msg = log_msg_new_internal(LOG_INFO | LOG_SYSLOG, "This is a forbidden message"); - log_msg_ref(msg); - log_source_post(source, msg); - - cr_expect_not(log_msg_is_tag_by_name(msg, "tagged"), - "Message should not be tagged, the message should have been dropped in test_mangle_callback_forbidden"); - log_msg_unref(msg); -} - -static void -expect_regular_message_forwarded(LogSource *source) -{ - LogMessage *msg = log_msg_new_internal(LOG_INFO | LOG_SYSLOG, "Message"); - log_msg_ref(msg); - log_source_post(source, msg); - - cr_expect(log_msg_is_tag_by_name(msg, "tagged")); - log_msg_unref(msg); -} - -Test(log_source, test_mangle_callback) -{ - register_source_mangle_callback(cfg, test_mangle_callback_forbidden); - register_source_mangle_callback(cfg, test_mangle_callback_tag); - - LogSource *source = test_source_init(&source_options); - TestPipe *next_pipe = test_pipe_init(); - log_pipe_append(&source->super, &next_pipe->super); - - expect_forbidden_message_dropped(source); - cr_assert_eq(next_pipe->messages_count, 0); - - expect_regular_message_forwarded(source); - cr_assert_eq(next_pipe->messages_count, 1); - - test_pipe_ack_messages(next_pipe, 1); - - test_pipe_destroy(next_pipe); - test_source_destroy(source); -} - - static DynamicWindowPool * test_dynamic_window_pool_init(gsize pool_size) { diff --git a/lib/versioning.h b/lib/versioning.h index 23709bbfcd..35e0f9428c 100644 --- a/lib/versioning.h +++ b/lib/versioning.h @@ -218,5 +218,4 @@ #define FEATURE_TYPING_MIN_VERSION 0 #define FEATURE_TYPING_VERSION "syslog-ng 4.0" -#include "pe-versioning.h" #endif diff --git a/modules/affile/CMakeLists.txt b/modules/affile/CMakeLists.txt index fd355f2ce7..d235c48669 100644 --- a/modules/affile/CMakeLists.txt +++ b/modules/affile/CMakeLists.txt @@ -1,6 +1,5 @@ set(AFFILE_SOURCES "affile-dest.h" - "affile-dest-internal-queue-filter.h" "affile-parser.h" "affile-source.h" "collection-comparator.h" diff --git a/modules/affile/Makefile.am b/modules/affile/Makefile.am index 47a0d6d777..3f4827d575 100644 --- a/modules/affile/Makefile.am +++ b/modules/affile/Makefile.am @@ -44,8 +44,7 @@ modules_affile_libaffile_la_SOURCES = \ modules/affile/affile-parser.h \ modules/affile/affile-plugin.c \ modules/affile/file-list.h \ - modules/affile/file-list.c \ - modules/affile/affile-dest-internal-queue-filter.h + modules/affile/file-list.c if HAVE_INOTIFY modules_affile_libaffile_la_SOURCES += \ diff --git a/modules/affile/affile-dest-internal-queue-filter.h b/modules/affile/affile-dest-internal-queue-filter.h deleted file mode 100644 index 74dc62612b..0000000000 --- a/modules/affile/affile-dest-internal-queue-filter.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002-2017 Balabit - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation, 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 St, Fifth Floor, Boston, MA 02110-1301 USA - * - * As an additional exemption you are allowed to compile & link against the - * OpenSSL libraries as published by the OpenSSL project. See the file - * COPYING for details. - * - */ - -#ifndef AFFILE_DEST_INTERNAL_QUEUE_FILTER_H_INCLUDED -#define AFFILE_DEST_INTERNAL_QUEUE_FILTER_H_INCLUDED - -#include "syslog-ng.h" - -static inline gboolean -affile_dw_queue_enabled_for_msg(LogMessage *msg) -{ - return TRUE; -} - -#endif - diff --git a/modules/affile/affile-dest.c b/modules/affile/affile-dest.c index 4999b88213..5a3672890e 100644 --- a/modules/affile/affile-dest.c +++ b/modules/affile/affile-dest.c @@ -33,7 +33,6 @@ #include "transport/transport-file.h" #include "transport/transport-pipe.h" #include "logwriter.h" -#include "affile-dest-internal-queue-filter.h" #include "file-specializations.h" #include "apphook.h" #include "timeutils/cache.h" @@ -282,12 +281,6 @@ affile_dw_deinit(LogPipe *s) static void affile_dw_queue(LogPipe *s, LogMessage *lm, const LogPathOptions *path_options) { - if (!affile_dw_queue_enabled_for_msg(lm)) - { - log_msg_drop(lm, path_options, AT_PROCESSED); - return; - } - AFFileDestWriter *self = (AFFileDestWriter *) s; g_mutex_lock(&self->lock); diff --git a/syslog-ng/main.c b/syslog-ng/main.c index 6f3fbbe217..f0f8d2425f 100644 --- a/syslog-ng/main.c +++ b/syslog-ng/main.c @@ -315,7 +315,6 @@ main(int argc, char *argv[]) g_process_start(); app_startup(); - main_loop_options.server_mode = ((SYSLOG_NG_ENABLE_FORCED_SERVER_MODE) == 1 ? TRUE : FALSE); main_loop_init(main_loop, &main_loop_options); rc = main_loop_read_and_init_config(main_loop);