Commit 3aefaf300478cd6fbc4892d5baaf70521ed323af
Added Makefile option to build without libpcre
Yves Rutschle committed on 7/9/2015, 1:31:42 PMParent: ba945f1a8f77d414f5e48f9c4166f5759ca7ece4
Files changed
ChangeLog | changed |
Makefile | changed |
probe.c | changed |
sslh-main.c | changed |
ChangeLog | ||
---|---|---|
@@ -1,4 +1,8 @@ | ||
1 | +vNEXT: | |
2 | + Added USELIBPCRE to make use of regex engine | |
3 | + optional. | |
4 | + | |
1 | 5 | v1.17: 09MAR2015 |
2 | 6 | Support RFC5952-style IPv6 addresses, e.g. [::]:443. |
3 | 7 | |
4 | 8 | Transparant proxy support for FreeBSD. |
Makefile | ||
---|---|---|
@@ -1,8 +1,9 @@ | ||
1 | 1 | # Configuration |
2 | 2 | |
3 | 3 | VERSION=$(shell ./genver.sh -r) |
4 | 4 | USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files) |
5 | +USELIBPCRE=1 # Use libpcre? (necessary to use regex probe) | |
5 | 6 | USELIBWRAP?= # Use libwrap? |
6 | 7 | USELIBCAP= # Use libcap? |
7 | 8 | COV_TEST= # Perform test coverage? |
8 | 9 | PREFIX?=/usr |
@@ -28,8 +29,12 @@ | ||
28 | 29 | LIBS:=$(LIBS) -lwrap |
29 | 30 | CPPFLAGS+=-DLIBWRAP |
30 | 31 | endif |
31 | 32 | |
33 | +ifneq ($(strip $(USELIBPCRE)),) | |
34 | + CPPFLAGS+=-DLIBPCRE | |
35 | +endif | |
36 | + | |
32 | 37 | ifneq ($(strip $(USELIBCONFIG)),) |
33 | 38 | LIBS:=$(LIBS) -lconfig |
34 | 39 | CPPFLAGS+=-DLIBCONFIG |
35 | 40 | endif |
probe.c | ||
---|---|---|
@@ -20,9 +20,11 @@ | ||
20 | 20 | */ |
21 | 21 | |
22 | 22 | |
23 | 23 | |
24 | + | |
24 | 25 | |
26 | + | |
25 | 27 | |
26 | 28 | |
27 | 29 | |
28 | 30 | |
@@ -243,15 +245,21 @@ | ||
243 | 245 | } |
244 | 246 | |
245 | 247 | static int regex_probe(const char *p, int len, struct proto *proto) |
246 | 248 | { |
249 | + | |
247 | 250 | regex_t **probe = proto->data; |
248 | 251 | regmatch_t pos = { 0, len }; |
249 | 252 | |
250 | 253 | for (; *probe && regexec(*probe, p, 0, &pos, REG_STARTEND); probe++) |
251 | 254 | /* try them all */; |
252 | 255 | |
253 | 256 | return (*probe != NULL); |
257 | + | |
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 | + | |
254 | 262 | } |
255 | 263 | |
256 | 264 | /* |
257 | 265 | * Read the beginning of data coming from the client connection and check if |
sslh-main.c | ||
---|---|---|
@@ -24,9 +24,11 @@ | ||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | + | |
28 | 29 | |
30 | + | |
29 | 31 | |
30 | 32 | |
31 | 33 | |
32 | 34 | |
@@ -173,8 +175,9 @@ | ||
173 | 175 | |
174 | 176 | |
175 | 177 | static void setup_regex_probe(struct proto *p, config_setting_t* probes) |
176 | 178 | { |
179 | + | |
177 | 180 | int num_probes, errsize, i, res; |
178 | 181 | char *err; |
179 | 182 | const char * expr; |
180 | 183 | regex_t** probe_list; |
@@ -200,8 +203,12 @@ | ||
200 | 203 | free(err); |
201 | 204 | exit(1); |
202 | 205 | } |
203 | 206 | } |
207 | + | |
208 | + fprintf(stderr, "line %d: regex probe specified but not compiled in\n", config_setting_source_line(probes)); | |
209 | + exit(5); | |
210 | + | |
204 | 211 | } |
205 | 212 | |
206 | 213 | |
207 | 214 | /* Extract configuration for protocols to connect to. |
Built with git-ssb-web