summaryrefslogtreecommitdiff
path: root/app-admin/rsyslog/files/8-stable/rsyslog-8.32.0-fix-building-without-curl-r3.patch
blob: 534183a8ca2927135558eea6b805cbd5383bb547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
https://github.com/rsyslog/rsyslog/commit/d9475f133e3c79875a7c4ccd92038b7123c1f155
https://github.com/rsyslog/rsyslog/commit/468eeb79b8da91fb71dfef6bfb25476b2a37f446
https://github.com/rsyslog/rsyslog/commit/50205ced0fc22e74f26f2a07b557b69c5d30e168

--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -1935,6 +1935,7 @@ num2ipv4(struct svar *__restrict__ const sourceVal) {
 	return(estr);
 }
 
+#ifdef HAVE_LIBCURL
 /* curl callback for doFunc_http_request */
 static size_t
 curlResult(void *ptr, size_t size, size_t nmemb, void *userdata)
@@ -2010,6 +2011,7 @@ doFunc_http_request(struct cnffunc *__restrict__ const func,
 	}
 	RETiRet;
 }
+#endif
 
 static int ATTR_NONNULL(1,3,4)
 doFunc_is_time(const char *__restrict__ const str,
@@ -2513,11 +2515,16 @@ doFuncCall(struct cnffunc *__restrict__ const func, struct svar *__restrict__ co
 		if(bMustFree2) free(str2);
 		break;
 	case CNFFUNC_HTTP_REQUEST:
+#ifdef HAVE_LIBCURL
 		cnfexprEval(func->expr[0], &r[0], usrptr, pWti);
 		str = (char*) var2CString(&r[0], &bMustFree);
 		doFunc_http_request(func, ret, str);
 		if(bMustFree) free(str);
 		varFreeMembers(&r[0]);
+#else
+		LogError(0, RS_RET_INTERNAL_ERROR,
+			"rainerscript: internal error: HTTP_Fetch not supported, not built with libcurl support");
+#endif
 		break;
 	default:
 		if(Debug) {

--- a/configure.ac
+++ b/configure.ac
@@ -454,6 +454,8 @@ if test "$enable_libcurl" = "yes"; then
 	)
 fi
 
+AM_CONDITIONAL(ENABLE_LIBCURL, test "x${enable_libcurl}" = "xyes")
+
 # klog
 AC_ARG_ENABLE(klog,
         [AS_HELP_STRING([--enable-klog],[Integrated klog functionality @<:@default=yes@:>@])],

--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -226,7 +226,6 @@ TESTS +=  \
 	rscript_contains.sh \
 	rscript_bare_var_root.sh \
 	rscript_bare_var_root-empty.sh \
-	rscript_http_request.sh \
 	rscript_ipv42num.sh \
 	rscript_field.sh \
 	rscript_stop.sh \
@@ -305,7 +304,11 @@ TESTS +=  \
 	lookup_table_rscript_reload.sh \
 	lookup_table_rscript_reload_without_stub.sh \
 	multiple_lookup_tables.sh
-endif
+if ENABLE_LIBCURL
+TESTS +=  \
+	rscript_http_request.sh
+endif # ENABLE_LIBCURL
+endif # ENABLE_TESTBENCH2
 
 if HAVE_VALGRIND
 TESTS +=  \
@@ -313,7 +316,6 @@ TESTS +=  \
 	mmexternal-InvldProg-vg.sh \
 	internal-errmsg-memleak-vg.sh \
 	rscript_set_memleak-vg.sh \
-	rscript_http_request-vg.sh \
 	no-parser-vg.sh \
 	discard-rptdmsg-vg.sh \
 	discard-allmark-vg.sh \
@@ -338,6 +340,10 @@ TESTS +=  \
 	multiple_lookup_tables-vg.sh \
 	fac_local0-vg.sh \
 	rscript_trim-vg.sh
+if ENABLE_LIBCURL
+TESTS +=  \
+	rscript_http_request-vg.sh
+endif # ENABLE_LIBCURL
 endif # HAVE_VALGRIND
 
 if ENABLE_ROOT_TESTS

--- a/grammar/Makefile.am
+++ b/grammar/Makefile.am
@@ -12,8 +12,11 @@ libgrammar_la_SOURCES = \
 	parserif.h \
 	grammar.h
 libgrammar_la_CPPFLAGS =  $(RSRT_CFLAGS) $(LIBLOGGING_STDLOG_CFLAGS)
-#libgrammar_la_LIBADD = $(CURL_LIBS) $(RSRT_LIBS) $(SOL_LIBS)
-libgrammar_la_LIBADD = $(CURL_LIBS)
+libgrammar_la_LIBADD =
+if ENABLE_LIBCURL
+libgrammar_la_CPPFLAGS += $(CURL_CFLAGS)
+libgrammar_la_LIBADD += $(CURL_LIBS)
+endif
 
 #testdriver_SOURCES = testdriver.c libgrammar.la
 #testdriver_CPPFLAGS =  $(RSRT_CFLAGS)

--- a/plugins/omelasticsearch/Makefile.am
+++ b/plugins/omelasticsearch/Makefile.am
@@ -1,7 +1,7 @@
 pkglib_LTLIBRARIES = omelasticsearch.la
 
 omelasticsearch_la_SOURCES = omelasticsearch.c
-omelasticsearch_la_CPPFLAGS =  $(RSRT_CFLAGS) $(PTHREADS_CFLAGS)
+omelasticsearch_la_CPPFLAGS = $(RSRT_CFLAGS) $(PTHREADS_CFLAGS) $(CURL_CFLAGS)
 omelasticsearch_la_LDFLAGS = -module -avoid-version
 omelasticsearch_la_LIBADD =  $(CURL_LIBS) $(LIBM)
 
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -36,7 +36,11 @@
 #include <sys/types.h>
 #include <libestr.h>
 #include <time.h>
+
+#ifdef HAVE_LIBCURL
 #include <curl/curl.h>
+#endif
+
 #include "rsyslog.h"
 #include "rainerscript.h"
 #include "conf.h"