From 70a776fb9a793629dcca4ccb7464bbb20c5af1db Mon Sep 17 00:00:00 2001 From: Yves Rutschle Date: Wed, 4 Mar 2026 22:35:56 +0100 Subject: [PATCH] -V now outputs compile-time configuration (fix #519) --- ChangeLog | 6 ++++++ Makefile.in | 4 ++-- sslh-main.c | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b330a52..87732a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,12 @@ vNEXT: inherit the listen sockets and block a new main process from starting. + More configuration sanity checks (e.g. using regex + or proxyprotocol options if libraries are not compiled in) + + -V now outputs compile-time options so it is + possible to know what is compiled in. + v2.3.0: Added `max_connections` setting to `listen` and `protocol` configuration; see the diff --git a/Makefile.in b/Makefile.in index dcd6012..c085f40 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,11 +22,11 @@ MAN=sslh.8.gz # man page name # itself ifneq ($(strip $(ENABLE_SANITIZER)),) - CFLAGS_SAN=-fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize=alignment + CFLAGS_SAN=-DENABLE_SANITIZER -fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize=alignment endif ifneq ($(strip $(COV_TEST)),) - CFLAGS_COV=-fprofile-arcs -ftest-coverage + CFLAGS_COV=-DCOV_TEST -fprofile-arcs -ftest-coverage endif CC ?= gcc diff --git a/sslh-main.c b/sslh-main.c index ef8836c..d54c5d0 100644 --- a/sslh-main.c +++ b/sslh-main.c @@ -348,6 +348,41 @@ void close_std(void) } } +static void print_version(void) +{ + printf("%s %s\n", server_type, VERSION); +#ifdef ENABLE_SANITIZER + printf("ENABLE_SANITIZER\n"); +#endif +#ifdef ENABLE_REGEX + printf("ENABLE_REGEX\n"); +#endif +#ifdef LIBCONFIG + printf("LIBCONFIG\n"); +#endif +#ifdef SYSTEMD + printf("SYSTEMD\n"); +#endif +#ifdef COV_TEST + printf("COV_TEST\n"); +#endif +#ifdef HAVE_LIBWRAP + printf("HAVE_LIBWRAP\n"); +#endif +#ifdef HAVE_LANDLOCK + printf("HAVE_LANDLOCK\n"); +#endif +#ifdef HAVE_PROXYPROTOCOL + printf("HAVE_PROXYPROTOCOL\n"); +#endif +#ifdef HAVE_LIBCAP + printf("HAVE_LIBCAP\n"); +#endif +#ifdef HAVE_LIBBSD + printf("HAVE_LIBBSD\n"); +#endif +} + int main(int argc, char *argv[], char* envp[]) { int res, num_addr_listen; @@ -363,7 +398,7 @@ int main(int argc, char *argv[], char* envp[]) config_finish(&cfg); if (cfg.version) { - printf("%s %s\n", server_type, VERSION); + print_version(); exit(0); }