Skip to content

Commit

Permalink
- Fix #72: configure --with-syslog-facility=LOCAL0-7 with default
Browse files Browse the repository at this point in the history
  LOG_DAEMON (as before) can set the syslog facility that the server
  uses to log messages.
  • Loading branch information
wcawijngaards committed Sep 9, 2019
1 parent 05b9f4f commit e45e9f1
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,9 @@
/* Use win32 resources and API */
#undef UB_ON_WINDOWS

/* the SYSLOG_FACILITY to use, default LOG_DAEMON */
#undef UB_SYSLOG_FACILITY

/* default username */
#undef UB_USERNAME

Expand Down
23 changes: 23 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ enable_alloc_lite
enable_alloc_nonregional
with_pthreads
with_solaris_threads
with_syslog_facility
with_pyunbound
with_pythonmodule
enable_swig_version_check
Expand Down Expand Up @@ -1604,6 +1605,8 @@ Optional Packages:
--with-pthreads use pthreads library, or --without-pthreads to
disable threading support.
--with-solaris-threads use solaris native thread library.
--with-syslog-facility=LOCAL0 - LOCAL7
set SYSLOG_FACILITY, default DAEMON
--with-pyunbound build PyUnbound, or --without-pyunbound to skip it.
(default=no)
--with-pythonmodule build Python module, or --without-pythonmodule to
Expand Down Expand Up @@ -17099,6 +17102,26 @@ fi

fi # end of non-mingw check of thread libraries

# Check for SYSLOG_FACILITY

# Check whether --with-syslog-facility was given.
if test "${with_syslog_facility+set}" = set; then :
withval=$with_syslog_facility; UNBOUND_SYSLOG_FACILITY="$withval"
fi

case "${UNBOUND_SYSLOG_FACILITY}" in

LOCAL[0-7]) UNBOUND_SYSLOG_FACILITY="LOG_${UNBOUND_SYSLOG_FACILITY}" ;;

*) UNBOUND_SYSLOG_FACILITY="LOG_DAEMON" ;;

esac

cat >>confdefs.h <<_ACEOF
#define UB_SYSLOG_FACILITY ${UNBOUND_SYSLOG_FACILITY}
_ACEOF


# Check for PyUnbound

# Check whether --with-pyunbound was given.
Expand Down
12 changes: 12 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,18 @@ fi

fi # end of non-mingw check of thread libraries

# Check for SYSLOG_FACILITY
AC_ARG_WITH(syslog-facility, AC_HELP_STRING([--with-syslog-facility=LOCAL0 - LOCAL7], [ set SYSLOG_FACILITY, default DAEMON ]),
[ UNBOUND_SYSLOG_FACILITY="$withval" ], [])
case "${UNBOUND_SYSLOG_FACILITY}" in

LOCAL[[0-7]]) UNBOUND_SYSLOG_FACILITY="LOG_${UNBOUND_SYSLOG_FACILITY}" ;;

*) UNBOUND_SYSLOG_FACILITY="LOG_DAEMON" ;;

esac
AC_DEFINE_UNQUOTED(UB_SYSLOG_FACILITY,${UNBOUND_SYSLOG_FACILITY},[the SYSLOG_FACILITY to use, default LOG_DAEMON])

# Check for PyUnbound
AC_ARG_WITH(pyunbound,
AC_HELP_STRING([--with-pyunbound],
Expand Down
5 changes: 5 additions & 0 deletions doc/Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
9 September 2019: Wouter
- Fix #72: configure --with-syslog-facility=LOCAL0-7 with default
LOG_DAEMON (as before) can set the syslog facility that the server
uses to log messages.

4 September 2019: Wouter
- Fix #71: fix openssl error squelch commit compilation error.

Expand Down
4 changes: 3 additions & 1 deletion util/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
if(use_syslog) {
/* do not delay opening until first write, because we may
* chroot and no longer be able to access dev/log and so on */
openlog(ident, LOG_NDELAY, LOG_DAEMON);
/* the facility is LOG_DAEMON by default, but
* --with-syslog-facility=LOCAL[0-7] can override it */
openlog(ident, LOG_NDELAY, UB_SYSLOG_FACILITY);
logging_to_syslog = 1;
lock_quick_unlock(&log_lock);
return;
Expand Down

0 comments on commit e45e9f1

Please sign in to comment.