syslog-ng.h: remove unused GSource priorities

These were not used since syslog-ng 3.3, get rid of them.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
GlobalConfig: cfg_read_config() filename arg const

This has some viral effect, which is also followed up by the patch. It
needs to be const as the relocatable binaries work declare some of the
paths to be const which were not such before and it's nicer anyway.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-ng.h: remove non-core PATH macros

These should be defined in the respective plugin and not the core.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
syslog-ng.h: remove unused default_modules variable declaration
gprocess: setsid() does not depend on isatty()

On HPUX, during boot the console does not considered as a tty, so syslog-ng does not
call setsid, the tty is not detached and the supervisor is killed at the end of the boot.
setsid() does not and should not depend on isatty(), and anyways setsid() is considered
more unix way than ioctl().

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
Signed-off-by: Viktor Tusa <tusa@balabit.hu>
logmatcher: better warning message

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
logqueue-fifo: print persist name on error and debug messages

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
logqueue-fifo: use after free in function log_queue_fifo_ack_backlog

Signed-off-by: Daniel Gados <gdani@balabit.hu>
logqueue-fifo: do not drop the queue if there are messages in the backlog

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
persist-state: fix memory leak in persist_state_rename_entry

The old key was leaked when renaming a persist-state key. This patch fixes
that leak.

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
persist-state: free the SerializeArchive used for loading the state in persist_state_load_v4

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
persist-state: close fd and munmap current_map in persist_state_free()

This patch fixes a potential fd and mmap leak, as persist_state_free()
has not freed them. These leaks could only happen once per syslog-ng
invocation as only a single instance of PersistState is created and
is freed right before exiting.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
serialize: remove unused include

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
contrib/selinux: added syslog_ng.if and syslog_ng.sh files
mainloop: remove unneeded cfg_deinit() call from main_loop_run().

cfg_deinit() is called by main_loop_exit_finish() already, no need to call
it again.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
dnscache.c: use strtok_r() instead of strtok while parsing hosts file

To avoid data races between strtok() invocations.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
dnscache: introduce global and per thread init/deinit functions

This patch splits the DNS cache initialization functions to a global
init/deinit to be called at startup time and a per-thread init/deinit
to be called at thread startup/shutdown time.

The DNS cache API should be refactored in a future point as it uses
a number of global variables where it should be using a GlobalConfig
specific state.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
dnscache: use per-thread state in the mtime validation of the hosts file

Instead of using global variables in multithreaded code, use per-thread
variables to detect whether the hosts file has changed.

Signed-off-by: Juhasz Viktor <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
dnscache: check thread_init()/deinit() pairing with assert calls

This patch adds asserts to make sure that thread_init/deinit calls are
properly paired.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
test_dnscache: remove inet_ntop() benchmark

This is not needed anymore, it was used to determine whether it makes
sense to store negative matches in the DNS cache. As inet_ntop()
proved about 5x slower it did make sense. But we are doing that and
no need to validate this decision at every unit test invocation. I don't
expect this to change dramatically.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>