git ssb

0+

cel / sslh



Commit 3aefaf300478cd6fbc4892d5baaf70521ed323af

Added Makefile option to build without libpcre

Yves Rutschle committed on 7/9/2015, 1:31:42 PM
Parent: ba945f1a8f77d414f5e48f9c4166f5759ca7ece4

Files changed

ChangeLogchanged
Makefilechanged
probe.cchanged
sslh-main.cchanged
ChangeLogView
@@ -1,4 +1,8 @@
1+vNEXT:
2+ Added USELIBPCRE to make use of regex engine
3+ optional.
4+
15 v1.17: 09MAR2015
26 Support RFC5952-style IPv6 addresses, e.g. [::]:443.
37
48 Transparant proxy support for FreeBSD.
MakefileView
@@ -1,8 +1,9 @@
11 # Configuration
22
33 VERSION=$(shell ./genver.sh -r)
44 USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files)
5+USELIBPCRE=1 # Use libpcre? (necessary to use regex probe)
56 USELIBWRAP?= # Use libwrap?
67 USELIBCAP= # Use libcap?
78 COV_TEST= # Perform test coverage?
89 PREFIX?=/usr
@@ -28,8 +29,12 @@
2829 LIBS:=$(LIBS) -lwrap
2930 CPPFLAGS+=-DLIBWRAP
3031 endif
3132
33+ifneq ($(strip $(USELIBPCRE)),)
34+ CPPFLAGS+=-DLIBPCRE
35+endif
36+
3237 ifneq ($(strip $(USELIBCONFIG)),)
3338 LIBS:=$(LIBS) -lconfig
3439 CPPFLAGS+=-DLIBCONFIG
3540 endif
probe.cView
@@ -20,9 +20,11 @@
2020 */
2121
2222 #define _GNU_SOURCE
2323 #include <stdio.h>
24+#ifdef LIBPCRE
2425 #include <regex.h>
26+#endif
2527 #include <ctype.h>
2628 #include "probe.h"
2729
2830
@@ -243,15 +245,21 @@
243245 }
244246
245247 static int regex_probe(const char *p, int len, struct proto *proto)
246248 {
249+#ifdef LIBPCRE
247250 regex_t **probe = proto->data;
248251 regmatch_t pos = { 0, len };
249252
250253 for (; *probe && regexec(*probe, p, 0, &pos, REG_STARTEND); probe++)
251254 /* try them all */;
252255
253256 return (*probe != NULL);
257+#else
258+ /* Should never happen as we check when loading config file */
259+ fprintf(stderr, "FATAL: regex probe called but not built in\n");
260+ exit(5);
261+#endif
254262 }
255263
256264 /*
257265 * Read the beginning of data coming from the client connection and check if
sslh-main.cView
@@ -24,9 +24,11 @@
2424 #define _GNU_SOURCE
2525 #ifdef LIBCONFIG
2626 #include <libconfig.h>
2727 #endif
28+#ifdef LIBPCRE
2829 #include <regex.h>
30+#endif
2931
3032 #include "common.h"
3133 #include "probe.h"
3234
@@ -173,8 +175,9 @@
173175
174176 #ifdef LIBCONFIG
175177 static void setup_regex_probe(struct proto *p, config_setting_t* probes)
176178 {
179+#ifdef LIBPCRE
177180 int num_probes, errsize, i, res;
178181 char *err;
179182 const char * expr;
180183 regex_t** probe_list;
@@ -200,8 +203,12 @@
200203 free(err);
201204 exit(1);
202205 }
203206 }
207+#else
208+ fprintf(stderr, "line %d: regex probe specified but not compiled in\n", config_setting_source_line(probes));
209+ exit(5);
210+#endif
204211 }
205212 #endif
206213
207214 /* Extract configuration for protocols to connect to.

Built with git-ssb-web