mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-12 15:17:14 +03:00
move libbsd support to autoconf detection
This commit is contained in:
parent
dcfa3fa2db
commit
22a8ba9ef5
@ -11,7 +11,6 @@ ENABLE_REGEX=1 # Enable regex probes
|
|||||||
USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files)
|
USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files)
|
||||||
USELIBEV=1 # Use libev?
|
USELIBEV=1 # Use libev?
|
||||||
USESYSTEMD= # Make use of systemd socket activation
|
USESYSTEMD= # Make use of systemd socket activation
|
||||||
USELIBBSD?= # Use libbsd (needed to update process name in `ps`)
|
|
||||||
COV_TEST= # Perform test coverage?
|
COV_TEST= # Perform test coverage?
|
||||||
PREFIX?=/usr
|
PREFIX?=/usr
|
||||||
BINDIR?=$(PREFIX)/sbin
|
BINDIR?=$(PREFIX)/sbin
|
||||||
@ -59,11 +58,6 @@ ifneq ($(strip $(USESYSTEMD)),)
|
|||||||
CONDITIONAL_TARGETS+=systemd-sslh-generator
|
CONDITIONAL_TARGETS+=systemd-sslh-generator
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(strip $(USELIBBSD)),)
|
|
||||||
LIBS:=$(LIBS) -lbsd
|
|
||||||
CPPFLAGS+=-DLIBBSD
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(strip $(USELIBEV)),)
|
ifneq ($(strip $(USELIBEV)),)
|
||||||
CONDITIONAL_TARGETS+=sslh-ev
|
CONDITIONAL_TARGETS+=sslh-ev
|
||||||
endif
|
endif
|
||||||
|
4
common.c
4
common.c
@ -36,7 +36,7 @@
|
|||||||
#include <systemd/sd-daemon.h>
|
#include <systemd/sd-daemon.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LIBBSD
|
#ifdef HAVE_LIBBSD
|
||||||
#include <bsd/unistd.h>
|
#include <bsd/unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -755,7 +755,7 @@ int get_connection_desc(struct connection_desc* desc, const struct connection *c
|
|||||||
|
|
||||||
void set_proctitle_shovel(struct connection_desc* desc, const struct connection *cnx)
|
void set_proctitle_shovel(struct connection_desc* desc, const struct connection *cnx)
|
||||||
{
|
{
|
||||||
#ifdef LIBBSD
|
#ifdef HAVE_LIBBSD
|
||||||
struct connection_desc d;
|
struct connection_desc d;
|
||||||
|
|
||||||
if (!desc) {
|
if (!desc) {
|
||||||
|
@ -12,4 +12,7 @@
|
|||||||
/* libcap support, to use Linux capabilities */
|
/* libcap support, to use Linux capabilities */
|
||||||
#undef HAVE_LIBCAP
|
#undef HAVE_LIBCAP
|
||||||
|
|
||||||
|
/* libbsd, to change process name */
|
||||||
|
#undef HAVE_LIBBSD
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
41
configure
vendored
41
configure
vendored
@ -3288,6 +3288,47 @@ then :
|
|||||||
LIBS="$LIBS -lcap"
|
LIBS="$LIBS -lcap"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for setproctitle in -lbsd" >&5
|
||||||
|
printf %s "checking for setproctitle in -lbsd... " >&6; }
|
||||||
|
if test ${ac_cv_lib_bsd_setproctitle+y}
|
||||||
|
then :
|
||||||
|
printf %s "(cached) " >&6
|
||||||
|
else $as_nop
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-lbsd $LIBS"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
Use char because int might match the return type of a GCC
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char setproctitle ();
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
return setproctitle ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"
|
||||||
|
then :
|
||||||
|
ac_cv_lib_bsd_setproctitle=yes
|
||||||
|
else $as_nop
|
||||||
|
ac_cv_lib_bsd_setproctitle=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_setproctitle" >&5
|
||||||
|
printf "%s\n" "$ac_cv_lib_bsd_setproctitle" >&6; }
|
||||||
|
if test "x$ac_cv_lib_bsd_setproctitle" = xyes
|
||||||
|
then :
|
||||||
|
printf "%s\n" "#define HAVE_LIBBSD 1" >>confdefs.h
|
||||||
|
LIBS="$LIBS -lbsd"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
ac_header= ac_cache=
|
ac_header= ac_cache=
|
||||||
for ac_item in $ac_header_c_list
|
for ac_item in $ac_header_c_list
|
||||||
|
@ -7,6 +7,7 @@ AC_CONFIG_FILES([Makefile])
|
|||||||
|
|
||||||
AC_CHECK_LIB([wrap], [hosts_ctl], [AC_DEFINE(HAVE_LIBWRAP) LIBS="$LIBS -lwrap" ], [])
|
AC_CHECK_LIB([wrap], [hosts_ctl], [AC_DEFINE(HAVE_LIBWRAP) LIBS="$LIBS -lwrap" ], [])
|
||||||
AC_CHECK_LIB([cap], [cap_get_proc], [AC_DEFINE(HAVE_LIBCAP) LIBS="$LIBS -lcap" ], [])
|
AC_CHECK_LIB([cap], [cap_get_proc], [AC_DEFINE(HAVE_LIBCAP) LIBS="$LIBS -lcap" ], [])
|
||||||
|
AC_CHECK_LIB([bsd], [setproctitle], [AC_DEFINE(HAVE_LIBBSD) LIBS="$LIBS -lbsd" ], [])
|
||||||
|
|
||||||
AC_CHECK_HEADERS(linux/landlock.h, AC_DEFINE(HAVE_LANDLOCK), [])
|
AC_CHECK_HEADERS(linux/landlock.h, AC_DEFINE(HAVE_LANDLOCK), [])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "tcp-probe.h"
|
#include "tcp-probe.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#ifdef LIBBSD
|
#if HAVE_LIBBSD
|
||||||
#include <bsd/unistd.h>
|
#include <bsd/unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ void stop_listeners(int sig)
|
|||||||
|
|
||||||
void set_listen_procname(struct listen_endpoint *listen_socket)
|
void set_listen_procname(struct listen_endpoint *listen_socket)
|
||||||
{
|
{
|
||||||
#ifdef LIBBSD
|
#if HAVE_LIBBSD
|
||||||
int res;
|
int res;
|
||||||
struct addrinfo addr;
|
struct addrinfo addr;
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
|
10
sslh-main.c
10
sslh-main.c
@ -30,15 +30,15 @@
|
|||||||
#include <pcre2.h>
|
#include <pcre2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LIBBSD
|
|
||||||
#include <bsd/unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "probe.h"
|
#include "probe.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "tcp-probe.h"
|
#include "tcp-probe.h"
|
||||||
|
|
||||||
|
#if HAVE_LIBBSD
|
||||||
|
#include <bsd/unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HAVE_LIBCAP
|
#if HAVE_LIBCAP
|
||||||
#include <sys/capability.h>
|
#include <sys/capability.h>
|
||||||
#endif
|
#endif
|
||||||
@ -286,7 +286,7 @@ int main(int argc, char *argv[], char* envp[])
|
|||||||
int res, num_addr_listen;
|
int res, num_addr_listen;
|
||||||
struct listen_endpoint *listen_sockets;
|
struct listen_endpoint *listen_sockets;
|
||||||
|
|
||||||
#ifdef LIBBSD
|
#if HAVE_LIBBSD
|
||||||
setproctitle_init(argc, argv, envp);
|
setproctitle_init(argc, argv, envp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user