diff options
author | Gergely Nagy <algernon@balabit.hu> | 2012-04-02 11:14:56 +0200 |
---|---|---|
committer | Gergely Nagy <algernon@balabit.hu> | 2012-04-02 11:14:56 +0200 |
commit | c6eb232af549691d915edc86c5c7a5259a4fbff3 (patch) | |
tree | 880924a01850a1d8635bedef57c7a45b83d02a31 | |
parent | e57c65470ead6f876d470fa8f47f41c16d8a0fa5 (diff) | |
download | libumberlog-c6eb232af549691d915edc86c5c7a5259a4fbff3.tar.gz libumberlog-c6eb232af549691d915edc86c5c7a5259a4fbff3.tar.xz libumberlog-c6eb232af549691d915edc86c5c7a5259a4fbff3.zip |
Override __syslog_chk if present, always.
Always override __syslog_chk if it is supported by the system, instead
of only overriding it if using fortification.
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lib/umberlog.c | 22 |
2 files changed, 3 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index 6879c3a..ec8af3b 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ AC_CHECK_HEADERS([syslog.h dlfcn.h limits.h]) dnl *************************************************************************** dnl Checks for libraries -AC_CHECK_FUNCS([gethostname strdup clock_gettime]) +AC_CHECK_FUNCS([gethostname strdup __syslog_chk]) dnl The dlopen() function is in the C library for *BSD and in dnl libdl on GLIBC-based systems diff --git a/lib/umberlog.c b/lib/umberlog.c index ae9ebaf..ac810f8 100644 --- a/lib/umberlog.c +++ b/lib/umberlog.c @@ -41,16 +41,11 @@ #include <time.h> #include <errno.h> +#include "config.h" #include "umberlog.h" -#if __USE_FORTIFY_LEVEL > 0 -static void (*old_syslog_chk) (); -static void (*old_vsyslog_chk) (); -#else static void (*old_syslog) (); static void (*old_vsyslog) (); -#endif - static void (*old_openlog) (); static int (*old_setlogmask) (); @@ -74,13 +69,8 @@ static __thread int ul_recurse; static void ul_init (void) { -#if __USE_FORTIFY_LEVEL > 0 - old_syslog_chk = dlsym (RTLD_NEXT, "__syslog_chk"); - old_vsyslog_chk = dlsym (RTLD_NEXT, "__vsyslog_chk"); -#else old_syslog = dlsym (RTLD_NEXT, "syslog"); old_vsyslog = dlsym (RTLD_NEXT, "vsyslog"); -#endif old_openlog = dlsym (RTLD_NEXT, "openlog"); old_setlogmask = dlsym (RTLD_NEXT, "setlogmask"); } @@ -361,11 +351,7 @@ _ul_vsyslog (int format_version, int priority, return -1; } -#if __USE_FORTIFY_LEVEL > 0 - old_syslog_chk (priority, __USE_FORTIFY_LEVEL - 1, "@cee:%s", msg); -#else old_syslog (priority, "@cee:%s", msg); -#endif json_object_put (jo); @@ -396,11 +382,7 @@ ul_legacy_vsyslog (int priority, const char *msg_format, va_list ap) { if (ul_recurse) { -#if __USE_FORTIFY_LEVEL > 0 - old_vsyslog_chk (priority, __USE_FORTIFY_LEVEL - 1, msg_format, ap); -#else old_vsyslog (priority, msg_format, ap); -#endif } else { @@ -428,7 +410,7 @@ ul_setlogmask (int mask) return old_setlogmask (mask); } -#if __USE_FORTIFY_LEVEL > 0 +#if HAVE___SYSLOG_CHK void __syslog_chk (int __pri, int __flag, __const char *__fmt, ...) { |