diff --git a/Makefile b/Makefile index 146d29d..2c71550 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ # Configuration VERSION=$(shell ./genver.sh -r) +ENABLE_REGEX=1 # Enable regex probes USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files) -USELIBPCRE=1 # Use libpcre? (necessary to use regex probe) +USELIBPCRE=1 # Use libpcre? (needed for regex on musl) USELIBWRAP?= # Use libwrap? USELIBCAP= # Use libcap? COV_TEST= # Perform test coverage? @@ -30,8 +31,13 @@ ifneq ($(strip $(USELIBWRAP)),) CPPFLAGS+=-DLIBWRAP endif +ifneq ($(strip $(ENABLE_REGEX)),) + CPPFLAGS+=-DENABLE_REGEX +endif + ifneq ($(strip $(USELIBPCRE)),) CPPFLAGS+=-DLIBPCRE + LIBS:=$(LIBS) -lpcre endif ifneq ($(strip $(USELIBCONFIG)),) diff --git a/probe.c b/probe.c index 27120c4..3514a48 100644 --- a/probe.c +++ b/probe.c @@ -21,9 +21,13 @@ #define _GNU_SOURCE #include +#ifdef ENABLE_REGEX #ifdef LIBPCRE +#include +#else #include #endif +#endif #include #include "probe.h" @@ -275,7 +279,7 @@ static int is_adb_protocol(const char *p, int len, struct proto *proto) static int regex_probe(const char *p, int len, struct proto *proto) { -#ifdef LIBPCRE +#ifdef ENABLE_REGEX regex_t **probe = proto->data; regmatch_t pos = { 0, len }; diff --git a/sslh-main.c b/sslh-main.c index 0025017..e5043b5 100644 --- a/sslh-main.c +++ b/sslh-main.c @@ -25,9 +25,13 @@ #ifdef LIBCONFIG #include #endif +#ifdef ENABLE_REGEX #ifdef LIBPCRE +#include +#else #include #endif +#endif #include "common.h" #include "probe.h" @@ -176,7 +180,7 @@ static int config_listen(config_t *config, struct addrinfo **listen) #ifdef LIBCONFIG static void setup_regex_probe(struct proto *p, config_setting_t* probes) { -#ifdef LIBPCRE +#ifdef ENABLE_REGEX int num_probes, errsize, i, res; char *err; const char * expr;