diff options
author | Khem Raj <raj.khem@gmail.com> | 2019-01-20 23:28:40 -0800 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2019-02-04 21:55:51 -0800 |
commit | 2ae6aaf9e734022b40d23f12099b1cb9c4934ca2 (patch) | |
tree | e05a28ae4ff8c44bcb60ec186d080ba596471a45 | |
parent | 99eafb535da88a4de61cc75f581c9f805505186c (diff) | |
download | meta-openembedded-2ae6aaf9e734022b40d23f12099b1cb9c4934ca2.tar.gz |
nmap: Fix build with clang8/musl/libc++
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
3 files changed, 157 insertions, 1 deletions
diff --git a/meta-oe/recipes-security/nmap/files/0001-include-time.h-for-time-structure-definition.patch b/meta-oe/recipes-security/nmap/files/0001-include-time.h-for-time-structure-definition.patch new file mode 100644 index 000000000..561c8c82c --- /dev/null +++ b/meta-oe/recipes-security/nmap/files/0001-include-time.h-for-time-structure-definition.patch | |||
@@ -0,0 +1,78 @@ | |||
1 | From c774f2b129fd5acd5647d92c57a2079ae638a62b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 20 Jan 2019 23:07:39 -0800 | ||
4 | Subject: [PATCH] include time.h for time structure definition | ||
5 | |||
6 | Exposed by musl/clang | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | nmap_error.cc | 1 + | ||
13 | nping/EchoServer.cc | 1 + | ||
14 | osscan.cc | 1 + | ||
15 | osscan2.cc | 1 + | ||
16 | service_scan.cc | 1 + | ||
17 | 5 files changed, 5 insertions(+) | ||
18 | |||
19 | diff --git a/nmap_error.cc b/nmap_error.cc | ||
20 | index 19beafb..ea14e08 100644 | ||
21 | --- a/nmap_error.cc | ||
22 | +++ b/nmap_error.cc | ||
23 | @@ -135,6 +135,7 @@ | ||
24 | #include "xml.h" | ||
25 | |||
26 | #include <errno.h> | ||
27 | +#include <time.h> | ||
28 | |||
29 | extern NmapOps o; | ||
30 | |||
31 | diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc | ||
32 | index 70f39b0..40cd4d6 100644 | ||
33 | --- a/nping/EchoServer.cc | ||
34 | +++ b/nping/EchoServer.cc | ||
35 | @@ -137,6 +137,7 @@ | ||
36 | #include "NpingOps.h" | ||
37 | #include "ProbeMode.h" | ||
38 | #include <signal.h> | ||
39 | +#include <time.h> | ||
40 | |||
41 | extern NpingOps o; | ||
42 | extern EchoServer es; | ||
43 | diff --git a/osscan.cc b/osscan.cc | ||
44 | index f851f60..6ae0c83 100644 | ||
45 | --- a/osscan.cc | ||
46 | +++ b/osscan.cc | ||
47 | @@ -149,6 +149,7 @@ | ||
48 | # include <time.h> | ||
49 | # endif | ||
50 | #endif | ||
51 | +#include <time.h> | ||
52 | |||
53 | #include <algorithm> | ||
54 | #include <list> | ||
55 | diff --git a/osscan2.cc b/osscan2.cc | ||
56 | index e341947..887fbd2 100644 | ||
57 | --- a/osscan2.cc | ||
58 | +++ b/osscan2.cc | ||
59 | @@ -147,6 +147,7 @@ | ||
60 | |||
61 | #include <list> | ||
62 | #include <math.h> | ||
63 | +#include <time.h> | ||
64 | |||
65 | extern NmapOps o; | ||
66 | #ifdef WIN32 | ||
67 | diff --git a/service_scan.cc b/service_scan.cc | ||
68 | index 9780ae3..e07b940 100644 | ||
69 | --- a/service_scan.cc | ||
70 | +++ b/service_scan.cc | ||
71 | @@ -145,6 +145,7 @@ | ||
72 | #include "nmap_tty.h" | ||
73 | |||
74 | #include <errno.h> | ||
75 | +#include <time.h> | ||
76 | |||
77 | #if HAVE_OPENSSL | ||
78 | /* OpenSSL 1.0.0 needs _WINSOCKAPI_ to be defined, otherwise it loads | ||
diff --git a/meta-oe/recipes-security/nmap/files/0002-Fix-building-with-libc.patch b/meta-oe/recipes-security/nmap/files/0002-Fix-building-with-libc.patch new file mode 100644 index 000000000..064be8ff8 --- /dev/null +++ b/meta-oe/recipes-security/nmap/files/0002-Fix-building-with-libc.patch | |||
@@ -0,0 +1,76 @@ | |||
1 | From 2a361989b5f84ec23ba7ccb6e527a5590ff55deb Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 20 Jan 2019 23:11:56 -0800 | ||
4 | Subject: [PATCH] Fix building with libc++ | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | nping/EchoServer.cc | 16 ++++++++-------- | ||
11 | 1 file changed, 8 insertions(+), 8 deletions(-) | ||
12 | |||
13 | diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc | ||
14 | index 40cd4d6..04433e1 100644 | ||
15 | --- a/nping/EchoServer.cc | ||
16 | +++ b/nping/EchoServer.cc | ||
17 | @@ -282,14 +282,14 @@ int EchoServer::nep_listen_socket(){ | ||
18 | server_addr6.sin6_len = sizeof(struct sockaddr_in6); | ||
19 | #endif | ||
20 | /* Bind to local address and the specified port */ | ||
21 | - if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | ||
22 | + if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | ||
23 | nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr6.sin6_addr), port); | ||
24 | /* If the bind failed for the supplied address, just try again with in6addr_any */ | ||
25 | if( o.spoofSource() ){ | ||
26 | server_addr6.sin6_addr = in6addr_any; | ||
27 | - if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | ||
28 | + if( ::bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){ | ||
29 | nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno)); | ||
30 | - }else{ | ||
31 | + }else{ | ||
32 | nping_print(VB_1, "Server bound to port %d", port); | ||
33 | } | ||
34 | } | ||
35 | @@ -320,12 +320,12 @@ int EchoServer::nep_listen_socket(){ | ||
36 | #endif | ||
37 | |||
38 | /* Bind to local address and the specified port */ | ||
39 | - if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | ||
40 | + if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | ||
41 | nping_warning(QT_3, "Failed to bind to source address %s. Trying to bind to port %d...", IPtoa(server_addr4.sin_addr), port); | ||
42 | /* If the bind failed for the supplied address, just try again with in6addr_any */ | ||
43 | if( o.spoofSource() ){ | ||
44 | server_addr4.sin_addr.s_addr=INADDR_ANY; | ||
45 | - if( bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | ||
46 | + if( ::bind(master_sd, (struct sockaddr *)&server_addr4, sizeof(server_addr4)) != 0 ){ | ||
47 | nping_fatal(QT_3, "Could not bind to port %d (%s).", port, strerror(errno)); | ||
48 | }else{ | ||
49 | nping_print(VB_1, "Server bound to port %d", port); | ||
50 | @@ -561,7 +561,7 @@ clientid_t EchoServer::nep_match_headers(IPv4Header *ip4, IPv6Header *ip6, TCPHe | ||
51 | nping_print(DBG_3, ";"); | ||
52 | /* The payload magic may affect the score only between | ||
53 | * zero and 4 bytes. This is done to prevent long | ||
54 | - * common strings like "GET / HTTP/1.1\r\n" | ||
55 | + * common strings like "GET / HTTP/1.1\r\n" | ||
56 | * increasing the score a lot and cause problems for | ||
57 | * the matching logic. */ | ||
58 | current_score+= MIN(4, fspec->len)*FACTOR_PAYLOAD_MAGIC; | ||
59 | @@ -571,7 +571,7 @@ clientid_t EchoServer::nep_match_headers(IPv4Header *ip4, IPv6Header *ip6, TCPHe | ||
60 | default: | ||
61 | nping_warning(QT_2, "Bogus field specifier found in client #%d context. Please report a bug", ctx->getIdentifier()); | ||
62 | break; | ||
63 | - } | ||
64 | + } | ||
65 | } /* End of field specifiers loop */ | ||
66 | |||
67 | nping_print(DBG_3, "%s() current_score=%.02f candidate_score=%.02f", __func__, current_score, candidate_score); | ||
68 | @@ -650,7 +650,7 @@ clientid_t EchoServer::nep_match_packet(const u8 *pkt, size_t pktlen){ | ||
69 | }else{ | ||
70 | if( (tcplen=tcp.validate())==OP_FAILURE){ | ||
71 | return CLIENT_NOT_FOUND; | ||
72 | - }else{ | ||
73 | + }else{ | ||
74 | if( (int)pktlen > (iplen+tcplen) ){ | ||
75 | if( payload.storeRecvData(pkt+iplen+tcplen, pktlen-iplen-tcplen)!=OP_FAILURE) | ||
76 | payload_included=true; | ||
diff --git a/meta-oe/recipes-security/nmap/nmap_7.70.bb b/meta-oe/recipes-security/nmap/nmap_7.70.bb index 01be1515b..b28b6a252 100644 --- a/meta-oe/recipes-security/nmap/nmap_7.70.bb +++ b/meta-oe/recipes-security/nmap/nmap_7.70.bb | |||
@@ -8,7 +8,9 @@ LIC_FILES_CHKSUM = "file://COPYING;beginline=7;endline=12;md5=1489288f46af415fad | |||
8 | SRC_URI = "http://nmap.org/dist/${BP}.tar.bz2 \ | 8 | SRC_URI = "http://nmap.org/dist/${BP}.tar.bz2 \ |
9 | file://nmap-redefine-the-python-library-dir.patch \ | 9 | file://nmap-redefine-the-python-library-dir.patch \ |
10 | file://nmap-replace-shtool-mkdir-with-coreutils-mkdir-command.patch \ | 10 | file://nmap-replace-shtool-mkdir-with-coreutils-mkdir-command.patch \ |
11 | " | 11 | file://0001-include-time.h-for-time-structure-definition.patch \ |
12 | file://0002-Fix-building-with-libc.patch \ | ||
13 | " | ||
12 | 14 | ||
13 | SRC_URI[md5sum] = "84eb6fbe788e0d4918c2b1e39421bf79" | 15 | SRC_URI[md5sum] = "84eb6fbe788e0d4918c2b1e39421bf79" |
14 | SRC_URI[sha256sum] = "847b068955f792f4cc247593aca6dc3dc4aae12976169873247488de147a6e18" | 16 | SRC_URI[sha256sum] = "847b068955f792f4cc247593aca6dc3dc4aae12976169873247488de147a6e18" |