1 |
commit: cc3444458dded272e5f8313f7ec2762af2f11f6c |
2 |
Author: Ralph Seichter <github <AT> seichter <DOT> de> |
3 |
AuthorDate: Sun May 24 15:02:32 2020 +0000 |
4 |
Commit: Aaron Bauman <bman <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 4 17:05:32 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cc344445 |
7 |
|
8 |
net-analyzer/ossec-hids: Add GCC -fno-common fix |
9 |
|
10 |
Add an upstream-provided fix for the impending GCC-10 change regarding |
11 |
the -fno-common flag. |
12 |
|
13 |
Bugs: https://bugs.gentoo.org/720088 |
14 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
15 |
Signed-off-by: Ralph Seichter <gentoo <AT> seichter.de> |
16 |
Closes: https://github.com/gentoo/gentoo/pull/15953 |
17 |
Signed-off-by: Aaron Bauman <bman <AT> gentoo.org> |
18 |
|
19 |
.../ossec-hids/files/gcc-fno-common-3.6.0.patch | 402 +++++++++++++++++++++ |
20 |
net-analyzer/ossec-hids/ossec-hids-3.6.0.ebuild | 9 +- |
21 |
2 files changed, 410 insertions(+), 1 deletion(-) |
22 |
|
23 |
diff --git a/net-analyzer/ossec-hids/files/gcc-fno-common-3.6.0.patch b/net-analyzer/ossec-hids/files/gcc-fno-common-3.6.0.patch |
24 |
new file mode 100644 |
25 |
index 00000000000..e8ed3c66dd9 |
26 |
--- /dev/null |
27 |
+++ b/net-analyzer/ossec-hids/files/gcc-fno-common-3.6.0.patch |
28 |
@@ -0,0 +1,402 @@ |
29 |
+diff --git a/src/addagent/main.c b/src/addagent/main.c |
30 |
+index 587a8a3d8..ab12f0326 100644 |
31 |
+--- a/src/addagent/main.c |
32 |
++++ b/src/addagent/main.c |
33 |
+@@ -17,6 +17,7 @@ static void print_banner(void); |
34 |
+ static void manage_shutdown(int sig) __attribute__((noreturn)); |
35 |
+ #endif |
36 |
+ |
37 |
++int willchroot; |
38 |
+ |
39 |
+ #if defined(__MINGW32__) |
40 |
+ static int setenv(const char *name, const char *val, __attribute__((unused)) int overwrite) |
41 |
+diff --git a/src/addagent/manage_agents.c b/src/addagent/manage_agents.c |
42 |
+index ac39c1e66..4f9c266ff 100644 |
43 |
+--- a/src/addagent/manage_agents.c |
44 |
++++ b/src/addagent/manage_agents.c |
45 |
+@@ -85,6 +85,8 @@ int add_agent(int json_output) |
46 |
+ |
47 |
+ char authfile[257]; |
48 |
+ |
49 |
++ extern int willchroot; |
50 |
++ |
51 |
+ if(willchroot > 0) { |
52 |
+ snprintf(authfile, 256, "%s", AUTH_FILE); //XXX |
53 |
+ } else { |
54 |
+diff --git a/src/addagent/manage_agents.h b/src/addagent/manage_agents.h |
55 |
+index 4812dba43..f2962e80b 100644 |
56 |
+--- a/src/addagent/manage_agents.h |
57 |
++++ b/src/addagent/manage_agents.h |
58 |
+@@ -147,4 +147,4 @@ extern fpos_t fp_pos; |
59 |
+ #define GMF_UNKN_ERROR ARGV0 ": Could not run GetModuleFileName which returned (%ld).\n" |
60 |
+ |
61 |
+ |
62 |
+-int willchroot; |
63 |
++//int willchroot; |
64 |
+diff --git a/src/addagent/manage_keys.c b/src/addagent/manage_keys.c |
65 |
+index 146b48326..ffb9a1f21 100644 |
66 |
+--- a/src/addagent/manage_keys.c |
67 |
++++ b/src/addagent/manage_keys.c |
68 |
+@@ -336,6 +336,8 @@ int k_bulkload(const char *cmdbulk) |
69 |
+ char delims[] = ","; |
70 |
+ char *token = NULL; |
71 |
+ |
72 |
++ extern int willchroot; |
73 |
++ |
74 |
+ /* Check if we can open the input file */ |
75 |
+ printf("Opening: [%s]\n", cmdbulk); |
76 |
+ infp = fopen(cmdbulk, "r"); |
77 |
+diff --git a/src/analysisd/analysisd.c b/src/analysisd/analysisd.c |
78 |
+index a220f4421..0a81971de 100644 |
79 |
+--- a/src/analysisd/analysisd.c |
80 |
++++ b/src/analysisd/analysisd.c |
81 |
+@@ -42,7 +42,12 @@ |
82 |
+ #endif |
83 |
+ |
84 |
+ #ifdef SQLITE_ENABLED |
85 |
+-#include "syscheck-sqlite.h" |
86 |
++#include <sqlite3.h> |
87 |
++sqlite3 *conn; |
88 |
++#endif |
89 |
++ |
90 |
++#ifdef LIBGEOIP_ENABLED |
91 |
++GeoIP *geoipdb; |
92 |
+ #endif |
93 |
+ |
94 |
+ /** Prototypes **/ |
95 |
+diff --git a/src/analysisd/config.h b/src/analysisd/config.h |
96 |
+index 8d74c756e..976d1942e 100644 |
97 |
+--- a/src/analysisd/config.h |
98 |
++++ b/src/analysisd/config.h |
99 |
+@@ -12,6 +12,7 @@ |
100 |
+ |
101 |
+ #include "config/config.h" |
102 |
+ #include "config/global-config.h" |
103 |
++ |
104 |
+ #ifdef LIBGEOIP_ENABLED |
105 |
+ #include "GeoIP.h" |
106 |
+ #endif |
107 |
+@@ -20,9 +21,11 @@ |
108 |
+ extern long int __crt_ftell; /* Global ftell pointer */ |
109 |
+ extern _Config Config; /* Global Config structure */ |
110 |
+ |
111 |
++/* |
112 |
+ #ifdef LIBGEOIP_ENABLED |
113 |
+ GeoIP *geoipdb; |
114 |
+ #endif |
115 |
++*/ |
116 |
+ |
117 |
+ int GlobalConf(const char *cfgfile); |
118 |
+ |
119 |
+diff --git a/src/analysisd/decoders/geoip.c b/src/analysisd/decoders/geoip.c |
120 |
+index 464e4bb71..9816b4c81 100644 |
121 |
+--- a/src/analysisd/decoders/geoip.c |
122 |
++++ b/src/analysisd/decoders/geoip.c |
123 |
+@@ -30,6 +30,7 @@ char *GetGeoInfobyIP(char *ip_addr) |
124 |
+ GeoIPRecord *geoiprecord; |
125 |
+ char *geodata = NULL; |
126 |
+ char geobuffer[256 +1]; |
127 |
++ extern GeoIP *geoipdb; |
128 |
+ |
129 |
+ if(!geoipdb) |
130 |
+ { |
131 |
+diff --git a/src/analysisd/decoders/syscheck.c b/src/analysisd/decoders/syscheck.c |
132 |
+index a6d675892..30339a00d 100644 |
133 |
+--- a/src/analysisd/decoders/syscheck.c |
134 |
++++ b/src/analysisd/decoders/syscheck.c |
135 |
+@@ -16,7 +16,7 @@ |
136 |
+ #include "decoder.h" |
137 |
+ |
138 |
+ #ifdef SQLITE_ENABLED |
139 |
+-#include "syscheck-sqlite.h" |
140 |
++#include <sqlite3.h> |
141 |
+ #endif |
142 |
+ |
143 |
+ typedef struct __sdb { |
144 |
+diff --git a/src/analysisd/makelists.c b/src/analysisd/makelists.c |
145 |
+index 06c90db70..dfbe6a4a3 100644 |
146 |
+--- a/src/analysisd/makelists.c |
147 |
++++ b/src/analysisd/makelists.c |
148 |
+@@ -32,6 +32,10 @@ time_t c_time; |
149 |
+ char __shost[512]; |
150 |
+ OSDecoderInfo *NULL_Decoder; |
151 |
+ |
152 |
++#ifdef LIBGEOIP_ENABLED |
153 |
++GeoIP *geoipdb; |
154 |
++#endif |
155 |
++ |
156 |
+ /* print help statement */ |
157 |
+ __attribute__((noreturn)) |
158 |
+ static void help_makelists(void) |
159 |
+diff --git a/src/analysisd/syscheck-sqlite.h b/src/analysisd/syscheck-sqlite.h |
160 |
+deleted file mode 100644 |
161 |
+index 526cab26e..000000000 |
162 |
+--- a/src/analysisd/syscheck-sqlite.h |
163 |
++++ /dev/null |
164 |
+@@ -1,5 +0,0 @@ |
165 |
+-#ifdef SQLITE_ENABLED |
166 |
+-#include <sqlite3.h> |
167 |
+- |
168 |
+-sqlite3 *conn; |
169 |
+-#endif |
170 |
+diff --git a/src/analysisd/testrule.c b/src/analysisd/testrule.c |
171 |
+index c08fb4885..b1aa928f7 100644 |
172 |
+--- a/src/analysisd/testrule.c |
173 |
++++ b/src/analysisd/testrule.c |
174 |
+@@ -83,6 +83,7 @@ int main(int argc, char **argv) |
175 |
+ memset(prev_month, '\0', 4); |
176 |
+ |
177 |
+ #ifdef LIBGEOIP_ENABLED |
178 |
++ extern GeoIP *geoipdb; |
179 |
+ geoipdb = NULL; |
180 |
+ #endif |
181 |
+ |
182 |
+diff --git a/src/client-agent/agentd.c b/src/client-agent/agentd.c |
183 |
+index c09cf87d3..67828e79c 100644 |
184 |
+--- a/src/client-agent/agentd.c |
185 |
++++ b/src/client-agent/agentd.c |
186 |
+@@ -23,6 +23,8 @@ void AgentdStart(const char *dir, int uid, int gid, const char *user, const char |
187 |
+ fd_set fdset; |
188 |
+ struct timeval fdtimeout; |
189 |
+ |
190 |
++ extern agent *agt; |
191 |
++ |
192 |
+ available_server = 0; |
193 |
+ |
194 |
+ /* Initial random numbers must happen before chroot */ |
195 |
+diff --git a/src/client-agent/agentd.h b/src/client-agent/agentd.h |
196 |
+index 0246a5457..a362ff9a3 100644 |
197 |
+--- a/src/client-agent/agentd.h |
198 |
++++ b/src/client-agent/agentd.h |
199 |
+@@ -81,9 +81,9 @@ void os_agent_cb(int fd, short ev, void *arg); |
200 |
+ extern time_t available_server; |
201 |
+ extern int run_foreground; |
202 |
+ extern keystore keys; |
203 |
+-extern agent *agt; |
204 |
++//extern agent *agt; |
205 |
+ #ifndef WIN32 |
206 |
+-struct imsgbuf server_ibuf; |
207 |
++//struct imsgbuf server_ibuf; |
208 |
+ #endif //WIN32 |
209 |
+ |
210 |
+ #endif /* __AGENTD_H */ |
211 |
+diff --git a/src/client-agent/event-forward.c b/src/client-agent/event-forward.c |
212 |
+index 2e81f0c90..22ed0beb9 100644 |
213 |
+--- a/src/client-agent/event-forward.c |
214 |
++++ b/src/client-agent/event-forward.c |
215 |
+@@ -19,6 +19,9 @@ |
216 |
+ /* Receive a message locally on the agent and forward it to the manager */ |
217 |
+ void *EventForward(void) |
218 |
+ { |
219 |
++ |
220 |
++ extern agent *agt; |
221 |
++ |
222 |
+ ssize_t recv_b; |
223 |
+ char msg[OS_MAXSTR + 1]; |
224 |
+ |
225 |
+diff --git a/src/client-agent/main.c b/src/client-agent/main.c |
226 |
+index 5f85cfb73..01c18970c 100644 |
227 |
+--- a/src/client-agent/main.c |
228 |
++++ b/src/client-agent/main.c |
229 |
+@@ -16,7 +16,8 @@ |
230 |
+ #define ARGV0 "ossec-agentd" |
231 |
+ #endif |
232 |
+ |
233 |
+-extern struct imsgbuf server_ibuf; |
234 |
++//extern struct imsgbuf server_ibuf; |
235 |
++struct imsgbuf server_ibuf; |
236 |
+ |
237 |
+ |
238 |
+ /* Prototypes */ |
239 |
+@@ -112,6 +113,8 @@ int main(int argc, char **argv) |
240 |
+ |
241 |
+ debug1(STARTED_MSG, ARGV0); |
242 |
+ |
243 |
++ extern agent *agt; |
244 |
++ |
245 |
+ agt = (agent *)calloc(1, sizeof(agent)); |
246 |
+ if (!agt) { |
247 |
+ ErrorExit(MEM_ERROR, ARGV0, errno, strerror(errno)); |
248 |
+diff --git a/src/client-agent/notify.c b/src/client-agent/notify.c |
249 |
+index 1b239f26c..93fec325c 100644 |
250 |
+--- a/src/client-agent/notify.c |
251 |
++++ b/src/client-agent/notify.c |
252 |
+@@ -68,6 +68,8 @@ void run_notify() |
253 |
+ os_md5 md5sum; |
254 |
+ time_t curr_time; |
255 |
+ |
256 |
++ extern agent *agt; |
257 |
++ |
258 |
+ keep_alive_random[0] = '\0'; |
259 |
+ curr_time = time(0); |
260 |
+ |
261 |
+diff --git a/src/client-agent/receiver-win.c b/src/client-agent/receiver-win.c |
262 |
+index 859bdf7f9..4ab62ee77 100644 |
263 |
+--- a/src/client-agent/receiver-win.c |
264 |
++++ b/src/client-agent/receiver-win.c |
265 |
+@@ -19,6 +19,7 @@ |
266 |
+ /* Receive events from the server */ |
267 |
+ void *receiver_thread(__attribute__((unused)) void *none) |
268 |
+ { |
269 |
++ extern agent *agt; |
270 |
+ int recv_b; |
271 |
+ |
272 |
+ char file[OS_SIZE_1024 + 1]; |
273 |
+diff --git a/src/client-agent/receiver.c b/src/client-agent/receiver.c |
274 |
+index fde64c282..5286e60dc 100644 |
275 |
+--- a/src/client-agent/receiver.c |
276 |
++++ b/src/client-agent/receiver.c |
277 |
+@@ -29,6 +29,8 @@ void *receive_msg() |
278 |
+ char cleartext[OS_MAXSTR + 1]; |
279 |
+ char *tmp_msg; |
280 |
+ |
281 |
++ extern agent *agt; |
282 |
++ |
283 |
+ memset(cleartext, '\0', OS_MAXSTR + 1); |
284 |
+ memset(buffer, '\0', OS_MAXSTR + 1); |
285 |
+ |
286 |
+diff --git a/src/client-agent/sendmsg.c b/src/client-agent/sendmsg.c |
287 |
+index 454c2e714..3076dfcf9 100644 |
288 |
+--- a/src/client-agent/sendmsg.c |
289 |
++++ b/src/client-agent/sendmsg.c |
290 |
+@@ -15,6 +15,9 @@ |
291 |
+ /* Send a message to the server */ |
292 |
+ int send_msg(int agentid, const char *msg) |
293 |
+ { |
294 |
++ |
295 |
++ extern agent *agt; |
296 |
++ |
297 |
+ size_t msg_size; |
298 |
+ char crypt_msg[OS_MAXSTR + 1]; |
299 |
+ |
300 |
+diff --git a/src/client-agent/start_agent.c b/src/client-agent/start_agent.c |
301 |
+index 51670cee5..f1df43715 100644 |
302 |
+--- a/src/client-agent/start_agent.c |
303 |
++++ b/src/client-agent/start_agent.c |
304 |
+@@ -24,6 +24,9 @@ int connect_server(int initial_id) |
305 |
+ #ifdef WIN32 |
306 |
+ unsigned int attempts = 2; |
307 |
+ #endif //WIN32 |
308 |
++ |
309 |
++ extern agent *agt; |
310 |
++ |
311 |
+ int rc = initial_id; |
312 |
+ |
313 |
+ /* Checking if the initial is zero, meaning we have to |
314 |
+@@ -139,6 +142,8 @@ void start_agent(int is_startup) |
315 |
+ char cleartext[OS_MAXSTR + 1]; |
316 |
+ char fmsg[OS_MAXSTR + 1]; |
317 |
+ |
318 |
++ extern agent *agt; |
319 |
++ |
320 |
+ memset(msg, '\0', OS_MAXSTR + 2); |
321 |
+ memset(buffer, '\0', OS_MAXSTR + 1); |
322 |
+ memset(cleartext, '\0', OS_MAXSTR + 1); |
323 |
+@@ -241,6 +246,8 @@ void os_agent_cb(int fd, short ev, void *arg) { |
324 |
+ struct imsg imsg; |
325 |
+ struct imsgbuf *ibuf = (struct imsgbuf *)arg; |
326 |
+ |
327 |
++ extern agent *agt; |
328 |
++ |
329 |
+ if (ev & EV_READ) { |
330 |
+ if ((n = imsg_read(ibuf) == -1 && errno != EAGAIN)) { |
331 |
+ ErrorExit("%s: ERROR: imsg_read() failed: %s", ARGV0, strerror(errno)); |
332 |
+diff --git a/src/os_net/os_net.c b/src/os_net/os_net.c |
333 |
+index f18e3be77..756e9fac8 100644 |
334 |
+--- a/src/os_net/os_net.c |
335 |
++++ b/src/os_net/os_net.c |
336 |
+@@ -14,7 +14,7 @@ |
337 |
+ #include <errno.h> |
338 |
+ #include "shared.h" |
339 |
+ #include "os_net.h" |
340 |
+-agent *agt; |
341 |
++agent *os_net_agt; |
342 |
+ |
343 |
+ /* Prototypes */ |
344 |
+ static OSNetInfo *OS_Bindport(char *_port, unsigned int _proto, const char *_ip); |
345 |
+@@ -346,11 +346,11 @@ int OS_Connect(char *_port, unsigned int protocol, const char *_ip) |
346 |
+ return(OS_INVALID); |
347 |
+ } |
348 |
+ |
349 |
+- if (agt) { |
350 |
+- if (agt->lip) { |
351 |
++ if (os_net_agt) { |
352 |
++ if (os_net_agt->lip) { |
353 |
+ memset(&hints, 0, sizeof(struct addrinfo)); |
354 |
+ hints.ai_flags = AI_NUMERICHOST; |
355 |
+- s = getaddrinfo(agt->lip, NULL, &hints, &result); |
356 |
++ s = getaddrinfo(os_net_agt->lip, NULL, &hints, &result); |
357 |
+ if (s != 0) { |
358 |
+ verbose("getaddrinfo: %s", gai_strerror(s)); |
359 |
+ } |
360 |
+@@ -363,8 +363,8 @@ int OS_Connect(char *_port, unsigned int protocol, const char *_ip) |
361 |
+ memset(&hints, 0, sizeof(struct addrinfo)); |
362 |
+ /* Allow IPv4 or IPv6 if local_ip isn't specified */ |
363 |
+ hints.ai_family = AF_UNSPEC; |
364 |
+- if (agt) { |
365 |
+- if (agt->lip) { |
366 |
++ if (os_net_agt) { |
367 |
++ if (os_net_agt->lip) { |
368 |
+ hints.ai_family = local_ai->ai_family; |
369 |
+ } |
370 |
+ } |
371 |
+@@ -398,13 +398,13 @@ int OS_Connect(char *_port, unsigned int protocol, const char *_ip) |
372 |
+ continue; |
373 |
+ } |
374 |
+ |
375 |
+- if (agt) { |
376 |
+- if (agt->lip) { |
377 |
++ if (os_net_agt) { |
378 |
++ if (os_net_agt->lip) { |
379 |
+ if (bind(ossock, local_ai->ai_addr, local_ai->ai_addrlen)) { |
380 |
+ verbose("Unable to bind to local address %s. Ignoring. (%s)", |
381 |
+- agt->lip, strerror(errno)); |
382 |
++ os_net_agt->lip, strerror(errno)); |
383 |
+ } |
384 |
+- else verbose("Connecting from local address %s", agt->lip); |
385 |
++ else verbose("Connecting from local address %s", os_net_agt->lip); |
386 |
+ } |
387 |
+ } |
388 |
+ |
389 |
+diff --git a/src/os_net/os_net.h b/src/os_net/os_net.h |
390 |
+index 9b7250928..3aaf00429 100644 |
391 |
+--- a/src/os_net/os_net.h |
392 |
++++ b/src/os_net/os_net.h |
393 |
+@@ -13,7 +13,7 @@ |
394 |
+ |
395 |
+ #include "headers/shared.h" |
396 |
+ #include "config/client-config.h" |
397 |
+-extern agent *agt; |
398 |
++extern agent *os_net_agt; |
399 |
+ #ifdef WIN32 |
400 |
+ #ifndef AI_ADDRCONFIG |
401 |
+ #define AI_ADDRCONFIG 0x0400 |
402 |
+diff --git a/src/win32/win_agent.c b/src/win32/win_agent.c |
403 |
+index 40a37e621..a2ec784f2 100644 |
404 |
+--- a/src/win32/win_agent.c |
405 |
++++ b/src/win32/win_agent.c |
406 |
+@@ -124,6 +124,7 @@ int local_start() |
407 |
+ WSADATA wsaData; |
408 |
+ DWORD threadID; |
409 |
+ DWORD threadID2; |
410 |
++ extern agent *agt; |
411 |
+ |
412 |
+ /* Start agent */ |
413 |
+ agt = (agent *)calloc(1, sizeof(agent)); |
414 |
+@@ -271,6 +272,7 @@ int SendMSG(__attribute__((unused)) int queue, const char *message, const char * |
415 |
+ char tmpstr[OS_MAXSTR + 2]; |
416 |
+ char crypt_msg[OS_MAXSTR + 2]; |
417 |
+ DWORD dwWaitResult; |
418 |
++ extern agent *agt; |
419 |
+ |
420 |
+ tmpstr[OS_MAXSTR + 1] = '\0'; |
421 |
+ crypt_msg[OS_MAXSTR + 1] = '\0'; |
422 |
+@@ -468,6 +470,8 @@ void send_win32_info(time_t curr_time) |
423 |
+ tmp_msg[OS_MAXSTR + 1] = '\0'; |
424 |
+ crypt_msg[OS_MAXSTR + 1] = '\0'; |
425 |
+ |
426 |
++ extern agent *agt; |
427 |
++ |
428 |
+ debug1("%s: DEBUG: Sending keep alive message.", ARGV0); |
429 |
+ |
430 |
+ /* Fix time */ |
431 |
|
432 |
diff --git a/net-analyzer/ossec-hids/ossec-hids-3.6.0.ebuild b/net-analyzer/ossec-hids/ossec-hids-3.6.0.ebuild |
433 |
index 7c416ed9c25..d305e7ce418 100644 |
434 |
--- a/net-analyzer/ossec-hids/ossec-hids-3.6.0.ebuild |
435 |
+++ b/net-analyzer/ossec-hids/ossec-hids-3.6.0.ebuild |
436 |
@@ -29,10 +29,17 @@ DEPEND="${RDEPEND} |
437 |
dev-python/subunit |
438 |
)" |
439 |
S="${WORKDIR}/${P}/src" |
440 |
-PATCHES=( "${FILESDIR}/makefile-${PV}.patch" ) |
441 |
|
442 |
declare -a MY_OPT |
443 |
|
444 |
+src_prepare() { |
445 |
+ # Patch for the GCC version 10 -fno-common change. See |
446 |
+ # https://github.com/ossec/ossec-hids/pull/1875 |
447 |
+ eapply -p2 "${FILESDIR}/gcc-fno-common-${PV}.patch" |
448 |
+ eapply -p1 "${FILESDIR}/makefile-${PV}.patch" |
449 |
+ eapply_user |
450 |
+} |
451 |
+ |
452 |
src_configure() { |
453 |
local target="local" |
454 |
use agent && target="agent" |