git ssb

0+

cel / sslh



Commit ab3324be477b2663196e0cc73d96aa38d59da65a

Enable PCRE as RegEx Library

John Regan committed on 8/13/2015, 6:28:17 PM
Parent: 4cbaf447b5a634f703bc571bf0e12f3ae1514d8a

Files changed

Makefilechanged
probe.cchanged
sslh-main.cchanged
MakefileView
@@ -1,9 +1,10 @@
11 # Configuration
22
33 VERSION=$(shell ./genver.sh -r)
4+ENABLE_REGEX=1 # Enable regex probes
45 USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files)
5-USELIBPCRE=1 # Use libpcre? (necessary to use regex probe)
6+USELIBPCRE=1 # Use libpcre? (needed for regex on musl)
67 USELIBWRAP?= # Use libwrap?
78 USELIBCAP= # Use libcap?
89 COV_TEST= # Perform test coverage?
910 PREFIX?=/usr
@@ -29,10 +30,15 @@
2930 LIBS:=$(LIBS) -lwrap
3031 CPPFLAGS+=-DLIBWRAP
3132 endif
3233
34+ifneq ($(strip $(ENABLE_REGEX)),)
35+ CPPFLAGS+=-DENABLE_REGEX
36+endif
37+
3338 ifneq ($(strip $(USELIBPCRE)),)
3439 CPPFLAGS+=-DLIBPCRE
40+ LIBS:=$(LIBS) -lpcre
3541 endif
3642
3743 ifneq ($(strip $(USELIBCONFIG)),)
3844 LIBS:=$(LIBS) -lconfig
probe.cView
@@ -20,11 +20,15 @@
2020 */
2121
2222 #define _GNU_SOURCE
2323 #include <stdio.h>
24+#ifdef ENABLE_REGEX
2425 #ifdef LIBPCRE
26+#include <pcreposix.h>
27+#else
2528 #include <regex.h>
2629 #endif
30+#endif
2731 #include <ctype.h>
2832 #include "probe.h"
2933
3034
@@ -274,9 +278,9 @@
274278 }
275279
276280 static int regex_probe(const char *p, int len, struct proto *proto)
277281 {
278-#ifdef LIBPCRE
282+#ifdef ENABLE_REGEX
279283 regex_t **probe = proto->data;
280284 regmatch_t pos = { 0, len };
281285
282286 for (; *probe && regexec(*probe, p, 0, &pos, REG_STARTEND); probe++)
sslh-main.cView
@@ -24,11 +24,15 @@
2424 #define _GNU_SOURCE
2525 #ifdef LIBCONFIG
2626 #include <libconfig.h>
2727 #endif
28+#ifdef ENABLE_REGEX
2829 #ifdef LIBPCRE
30+#include <pcreposix.h>
31+#else
2932 #include <regex.h>
3033 #endif
34+#endif
3135
3236 #include "common.h"
3337 #include "probe.h"
3438
@@ -175,9 +179,9 @@
175179
176180 #ifdef LIBCONFIG
177181 static void setup_regex_probe(struct proto *p, config_setting_t* probes)
178182 {
179-#ifdef LIBPCRE
183+#ifdef ENABLE_REGEX
180184 int num_probes, errsize, i, res;
181185 char *err;
182186 const char * expr;
183187 regex_t** probe_list;

Built with git-ssb-web