Explorar el Código

sslh: disable libpcre probe support

Backport upstream commit 3aefaf3 which allows sslh to be built without
libpcre support. This was brought about by the move to musl which
doesn't support the non-POSIX REG_STARTEND regexec eflag.

Fixes: #1506

Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
Jonathan McCrohan hace 9 años
padre
commit
998c8468d3
Se han modificado 2 ficheros con 91 adiciones y 0 borrados
  1. 1
    0
      net/sslh/Makefile
  2. 90
    0
      net/sslh/patches/002-no_regex_probes.patch

+ 1
- 0
net/sslh/Makefile Ver fichero

@@ -38,6 +38,7 @@ define Build/Compile
38 38
 		CFLAGS="$(TARGET_CFLAGS)" \
39 39
 		USELIBCONFIG= \
40 40
 		USELIBWRAP= \
41
+		USELIBPCRE= \
41 42
 		all
42 43
 endef
43 44
 

+ 90
- 0
net/sslh/patches/002-no_regex_probes.patch Ver fichero

@@ -0,0 +1,90 @@
1
+From 3aefaf300478cd6fbc4892d5baaf70521ed323af Mon Sep 17 00:00:00 2001
2
+From: Yves Rutschle <git1@rutschle.net>
3
+Date: Thu, 9 Jul 2015 15:31:42 +0200
4
+Subject: [PATCH] Added Makefile option to build without libpcre
5
+
6
+---
7
+--- a/Makefile
8
++++ b/Makefile
9
+@@ -2,6 +2,7 @@
10
+ 
11
+ VERSION=$(shell ./genver.sh -r)
12
+ USELIBCONFIG=1	# Use libconfig? (necessary to use configuration files)
13
++USELIBPCRE=1	# Use libpcre? (necessary to use regex probe)
14
+ USELIBWRAP?=	# Use libwrap?
15
+ USELIBCAP=	# Use libcap?
16
+ COV_TEST= 	# Perform test coverage?
17
+@@ -27,6 +28,10 @@ ifneq ($(strip $(USELIBWRAP)),)
18
+ 	CPPFLAGS+=-DLIBWRAP
19
+ endif
20
+ 
21
++ifneq ($(strip $(USELIBPCRE)),)
22
++	CPPFLAGS+=-DLIBPCRE
23
++endif
24
++
25
+ ifneq ($(strip $(USELIBCONFIG)),)
26
+ 	LIBS:=$(LIBS) -lconfig
27
+ 	CPPFLAGS+=-DLIBCONFIG
28
+--- a/probe.c
29
++++ b/probe.c
30
+@@ -21,7 +21,9 @@
31
+ 
32
+ #define _GNU_SOURCE
33
+ #include <stdio.h>
34
++#ifdef LIBPCRE
35
+ #include <regex.h>
36
++#endif
37
+ #include <ctype.h>
38
+ #include "probe.h"
39
+ 
40
+@@ -226,6 +228,7 @@ static int is_tls_protocol(const char *p
41
+ 
42
+ static int regex_probe(const char *p, int len, struct proto *proto)
43
+ {
44
++#ifdef LIBPCRE
45
+     regex_t **probe = proto->data;
46
+     regmatch_t pos = { 0, len };
47
+ 
48
+@@ -233,6 +236,11 @@ static int regex_probe(const char *p, in
49
+         /* try them all */;
50
+ 
51
+     return (*probe != NULL);
52
++#else
53
++    /* Should never happen as we check when loading config file */
54
++    fprintf(stderr, "FATAL: regex probe called but not built in\n");
55
++    exit(5);
56
++#endif
57
+ }
58
+ 
59
+ /* 
60
+--- a/sslh-main.c
61
++++ b/sslh-main.c
62
+@@ -25,7 +25,9 @@
63
+ #ifdef LIBCONFIG
64
+ #include <libconfig.h>
65
+ #endif
66
++#ifdef LIBPCRE
67
+ #include <regex.h>
68
++#endif
69
+ 
70
+ #include "common.h"
71
+ #include "probe.h"
72
+@@ -174,6 +176,7 @@ static int config_listen(config_t *confi
73
+ #ifdef LIBCONFIG
74
+ static void setup_regex_probe(struct proto *p, config_setting_t* probes)
75
+ {
76
++#ifdef LIBPCRE
77
+     int num_probes, errsize, i, res;
78
+     char *err;
79
+     const char * expr;
80
+@@ -201,6 +204,10 @@ static void setup_regex_probe(struct pro
81
+             exit(1);
82
+         }
83
+     }
84
++#else
85
++    fprintf(stderr, "line %d: regex probe specified but not compiled in\n", config_setting_source_line(probes));
86
++    exit(5);
87
++#endif
88
+ }
89
+ #endif
90
+