From 338daafe870e53227b77ea9b0b0301ca54d401ad Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Sun, 18 Jun 2017 09:47:34 +0100 Subject: [PATCH 1/3] Use REG_EXTENDED for regex matching The "7 regex" manual page called 'Basic' regular expressions "Obsolete". It also matches the pcre expressions slightly better. --- sslh-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sslh-main.c b/sslh-main.c index e2a4e34..433ed86 100644 --- a/sslh-main.c +++ b/sslh-main.c @@ -212,7 +212,7 @@ static void setup_regex_probe(struct proto *p, config_setting_t* probes) for (i = 0; i < num_probes; i++) { probe_list[i] = malloc(sizeof(*(probe_list[i]))); expr = config_setting_get_string_elem(probes, i); - res = regcomp(probe_list[i], expr, 0); + res = regcomp(probe_list[i], expr, REG_EXTENDED); if (res) { err = malloc(errsize = regerror(res, probe_list[i], NULL, 0)); regerror(res, probe_list[i], err, errsize); From cb90cc97ae64a445242e517847c6e44b7003eda4 Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Thu, 23 Nov 2017 20:38:56 +0000 Subject: [PATCH 2/3] Default to using libpcre and actually use it as libpcre has to better binary support. Note, just linking libpcre only has no effect, the posix functions are provided by libpcreposix. Use "make USELIBPCRE=" to turn libpcre off and link POSIX library. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7ebec92..c408a1c 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ VERSION=$(shell ./genver.sh -r) ENABLE_REGEX=1 # Enable regex probes USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files) -USELIBPCRE= # Use libpcre? (needed for regex on musl) +USELIBPCRE=1 # Use libpcre? (needed for regex on musl) USELIBWRAP?= # Use libwrap? USELIBCAP= # Use libcap? USESYSTEMD= # Make use of systemd socket activation @@ -38,7 +38,7 @@ endif ifneq ($(strip $(USELIBPCRE)),) CPPFLAGS+=-DLIBPCRE - LIBS:=$(LIBS) -lpcre + LIBS:=$(LIBS) -lpcreposix endif ifneq ($(strip $(USELIBCONFIG)),) From 021eb836e4984b718480bfc6c9ce20ae4a1194bf Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Thu, 23 Nov 2017 20:40:47 +0000 Subject: [PATCH 3/3] Adjust linking so that wrapper libraries are static. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c408a1c..08ed962 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ endif CC ?= gcc CFLAGS ?=-Wall -g $(CFLAGS_COV) -LIBS= +LIBS=-Wl,--as-needed OBJS=common.o sslh-main.o probe.o tls.o ifneq ($(strip $(USELIBWRAP)),) @@ -38,7 +38,7 @@ endif ifneq ($(strip $(USELIBPCRE)),) CPPFLAGS+=-DLIBPCRE - LIBS:=$(LIBS) -lpcreposix + LIBS:=$(LIBS) -Wl,-Bstatic -lpcreposix -Wl,-Bdynamic -lpcre endif ifneq ($(strip $(USELIBCONFIG)),) @@ -52,7 +52,7 @@ ifneq ($(strip $(USELIBCAP)),) endif ifneq ($(strip $(USESYSTEMD)),) - LIBS:=$(LIBS) -lsystemd + LIBS:=$(LIBS) -Wl,-Bstatic -lsystemd -Wl,-Bdynamic CPPFLAGS+=-DSYSTEMD endif