summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-security/nmap/nmap-7.92/0001-redefine-the-python-library-install-dir.patch31
-rw-r--r--meta-oe/recipes-security/nmap/nmap-7.92/0002-replace-.-shtool-mkdir-with-coreutils-mkdir-command.patch38
-rw-r--r--meta-oe/recipes-security/nmap/nmap-7.92/0003-Include-time.h-header-to-pass-clang-compilation.patch76
-rw-r--r--meta-oe/recipes-security/nmap/nmap-7.92/0004-Fix-building-with-libc.patch79
-rw-r--r--meta-oe/recipes-security/nmap/nmap-7.92/0005-fix-racing-between-build-ncat-and-build-lua.patch55
-rw-r--r--meta-oe/recipes-security/nmap/nmap-7.92/0006-Fix-build-with-libpcap-1.10.5.patch47
-rw-r--r--meta-oe/recipes-security/nmap/nmap_7.92.bb66
7 files changed, 392 insertions, 0 deletions
diff --git a/meta-oe/recipes-security/nmap/nmap-7.92/0001-redefine-the-python-library-install-dir.patch b/meta-oe/recipes-security/nmap/nmap-7.92/0001-redefine-the-python-library-install-dir.patch
new file mode 100644
index 0000000000..6298f7ea26
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/nmap-7.92/0001-redefine-the-python-library-install-dir.patch
@@ -0,0 +1,31 @@
1From 67b4614ea529460dca9326bfe5d355bad6f9bdee Mon Sep 17 00:00:00 2001
2From: Roy Li <rongqing.li@windriver.com>
3Date: Sun, 27 Apr 2025 16:33:08 +0800
4Subject: [PATCH] redefine the python library install dir
5
6If install-lib is not defined, it is always /usr/lib/, but it
7maybe /usr/lib64 for multilib
8
9Upstream-Status: Pending
10
11Signed-off-by: Roy Li <rongqing.li@windriver.com>
12---
13 Makefile.in | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/Makefile.in b/Makefile.in
17index ccfceda..6b25d27 100644
18--- a/Makefile.in
19+++ b/Makefile.in
20@@ -387,7 +387,7 @@ build-nping: $(NPINGDIR)/Makefile build-nbase build-nsock build-netutil $(NPINGD
21 @cd $(NPINGDIR) && $(MAKE)
22
23 install-ndiff:
24- cd $(NDIFFDIR) && $(PYTHON) setup.py install --prefix "$(prefix)" $(if $(DESTDIR),--root "$(DESTDIR)")
25+ cd $(NDIFFDIR) && $(PYTHON) setup.py install --prefix "$(prefix)" --install-lib="${PYTHON_SITEPACKAGES_DIR}" $(if $(DESTDIR),--root "$(DESTDIR)")
26
27 NSE_FILES = scripts/script.db scripts/*.nse
28 NSE_LIB_LUA_FILES = nselib/*.lua nselib/*.luadoc
29--
302.34.1
31
diff --git a/meta-oe/recipes-security/nmap/nmap-7.92/0002-replace-.-shtool-mkdir-with-coreutils-mkdir-command.patch b/meta-oe/recipes-security/nmap/nmap-7.92/0002-replace-.-shtool-mkdir-with-coreutils-mkdir-command.patch
new file mode 100644
index 0000000000..f81e230b28
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/nmap-7.92/0002-replace-.-shtool-mkdir-with-coreutils-mkdir-command.patch
@@ -0,0 +1,38 @@
1From 783333de42b06020f5c0852c415cd34972a773fb Mon Sep 17 00:00:00 2001
2From: Roy Li <rongqing.li@windriver.com>
3Date: Sun, 27 Apr 2025 16:35:11 +0800
4Subject: [PATCH] replace "./shtool mkdir" with coreutils mkdir command
5
6"./shtool mkdir" is used when mkdir has not -p parameter, but mkdir in
7today most release has supportted the -p parameter, not need to use
8shtool, and it can not fix the race if two process are running mkdir to
9create same dir
10
11Upstream-Status: Pending
12
13Signed-off-by: Roy Li <rongqing.li@windriver.com>
14---
15 ncat/Makefile.in | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/ncat/Makefile.in b/ncat/Makefile.in
19index 4632a78..11a5e7c 100644
20--- a/ncat/Makefile.in
21+++ b/ncat/Makefile.in
22@@ -166,11 +166,11 @@ $(NSOCKDIR)/libnsock.a: $(NSOCKDIR)/Makefile
23
24 install: $(TARGET)
25 @echo Installing Ncat;
26- $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
27+ mkdir -p -m 755 $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
28 $(INSTALL) -c -m 755 ncat $(DESTDIR)$(bindir)/ncat
29 $(STRIP) -x $(DESTDIR)$(bindir)/ncat
30 if [ -n "$(DATAFILES)" ]; then \
31- $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(pkgdatadir); \
32+ mkdir -p -m 755 $(DESTDIR)$(pkgdatadir); \
33 $(INSTALL) -c -m 644 $(DATAFILES) $(DESTDIR)$(pkgdatadir)/; \
34 fi
35 $(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/$(TARGET).1
36--
372.34.1
38
diff --git a/meta-oe/recipes-security/nmap/nmap-7.92/0003-Include-time.h-header-to-pass-clang-compilation.patch b/meta-oe/recipes-security/nmap/nmap-7.92/0003-Include-time.h-header-to-pass-clang-compilation.patch
new file mode 100644
index 0000000000..b940124f98
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/nmap-7.92/0003-Include-time.h-header-to-pass-clang-compilation.patch
@@ -0,0 +1,76 @@
1From e9d876bedc8a7bc96856ecf38bbeeafee2d5b206 Mon Sep 17 00:00:00 2001
2From: Peiran Hong <peiran.hong@windriver.com>
3Date: Fri, 20 Sep 2019 15:02:45 -0400
4Subject: [PATCH] Include time.h header to pass clang compilation
5
6Upstream-Status: Pending
7
8Signed-off-by: Peiran Hong <peiran.hong@windriver.com>
9---
10 nmap_error.cc | 11 +----------
11 nping/EchoServer.cc | 1 +
12 osscan2.cc | 1 +
13 service_scan.cc | 1 +
14 4 files changed, 4 insertions(+), 10 deletions(-)
15
16diff --git a/nmap_error.cc b/nmap_error.cc
17index 5ec938f..83ba6cc 100644
18--- a/nmap_error.cc
19+++ b/nmap_error.cc
20@@ -67,16 +67,7 @@
21 #include "xml.h"
22
23 #include <errno.h>
24-#if TIME_WITH_SYS_TIME
25-# include <sys/time.h>
26-# include <time.h>
27-#else
28-# if HAVE_SYS_TIME_H
29-# include <sys/time.h>
30-# else
31-# include <time.h>
32-# endif
33-#endif
34+#include <time.h>
35
36 extern NmapOps o;
37
38diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc
39index dea2851..c80efb4 100644
40--- a/nping/EchoServer.cc
41+++ b/nping/EchoServer.cc
42@@ -69,6 +69,7 @@
43 #include "NpingOps.h"
44 #include "ProbeMode.h"
45 #include <signal.h>
46+#include <time.h>
47
48 extern NpingOps o;
49 extern EchoServer es;
50diff --git a/osscan2.cc b/osscan2.cc
51index efe6da0..392c65f 100644
52--- a/osscan2.cc
53+++ b/osscan2.cc
54@@ -80,6 +80,7 @@
55
56 #include <list>
57 #include <math.h>
58+#include <time.h>
59
60 extern NmapOps o;
61 #ifdef WIN32
62diff --git a/service_scan.cc b/service_scan.cc
63index 66e0d92..161f2a1 100644
64--- a/service_scan.cc
65+++ b/service_scan.cc
66@@ -77,6 +77,7 @@
67 #include "nmap_tty.h"
68
69 #include <errno.h>
70+#include <time.h>
71
72 #if HAVE_OPENSSL
73 /* OpenSSL 1.0.0 needs _WINSOCKAPI_ to be defined, otherwise it loads
74--
752.34.1
76
diff --git a/meta-oe/recipes-security/nmap/nmap-7.92/0004-Fix-building-with-libc.patch b/meta-oe/recipes-security/nmap/nmap-7.92/0004-Fix-building-with-libc.patch
new file mode 100644
index 0000000000..295abe6d50
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/nmap-7.92/0004-Fix-building-with-libc.patch
@@ -0,0 +1,79 @@
1From 4c54b00e6f3749924532c2636eae01daff9e4bcd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 20 Jan 2019 23:11:56 -0800
4Subject: [PATCH] Fix building with libc++
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 nping/EchoServer.cc | 16 ++++++++--------
11 1 file changed, 8 insertions(+), 8 deletions(-)
12
13diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc
14index c80efb4..914bd54 100644
15--- a/nping/EchoServer.cc
16+++ b/nping/EchoServer.cc
17@@ -214,14 +214,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@@ -252,12 +252,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@@ -493,7 +493,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@@ -503,7 +503,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@@ -582,7 +582,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;
77--
782.34.1
79
diff --git a/meta-oe/recipes-security/nmap/nmap-7.92/0005-fix-racing-between-build-ncat-and-build-lua.patch b/meta-oe/recipes-security/nmap/nmap-7.92/0005-fix-racing-between-build-ncat-and-build-lua.patch
new file mode 100644
index 0000000000..f660719640
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/nmap-7.92/0005-fix-racing-between-build-ncat-and-build-lua.patch
@@ -0,0 +1,55 @@
1From c1b436da46a7e3089b657f3f92308defc0ebb735 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Sun, 9 Feb 2025 00:45:36 +0000
4Subject: [PATCH] fix racing between build-ncat and build-lua
5
6There are two build-lua rules, one in Makefile.in, another in
7ncat/Makefile.in which is required by build-ncat
8
9Build them may cause potential racing
10
11$ bitbake lib32-nmap
12$ grep -e "Compiling liblua" -e 'nmap-7.95/liblua' -e ": error" -n patch-to/temp/log.do_compile
13Compiling liblua
14make[1]: Entering directory 'path-to/build/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
15Compiling liblua
16make[2]: Entering directory 'path-to/build/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
17make[2]: Leaving directory 'path-to/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
18path-to/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/recipe-sysroot-native/usr/bin/i686-wrsmllib32-linux/../../libexec/i686-wrsmllib32-linux/gcc/i686-wrsmllib32-linux/14.2.0/ld: ./../liblua/liblua.a: error adding symbols: no more archived files
19collect2: error: ld returned 1 exit status
20make[1]: Leaving directory 'path-to/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
21
22Explicitly make build-ncat depends on build-lua to avoid racing,
23after applying the patch
24...
25Compiling liblua
26make[1]: Entering directory 'path-to/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
27make[1]: Leaving directory 'path-to/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
28Compiling liblua
29make[2]: Entering directory 'path-to/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
30make[2]: Leaving directory 'path-to/tmp/work/corei7-32-wrsmllib32-linux/lib32-nmap/7.95/nmap-7.95/liblua'
31...
32
33Upstream-Status: Submitted [https://github.com/nmap/nmap/pull/3025]
34
35Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
36---
37 Makefile.in | 2 +-
38 1 file changed, 1 insertion(+), 1 deletion(-)
39
40diff --git a/Makefile.in b/Makefile.in
41index 6b25d27..b0a2719 100644
42--- a/Makefile.in
43+++ b/Makefile.in
44@@ -159,7 +159,7 @@ build-netutil: libnetutil/Makefile
45 @echo Compiling libnetutil;
46 cd libnetutil && $(MAKE)
47
48-build-ncat: $(NCATDIR)/Makefile build-nbase build-nsock $(NCATDIR)/ncat.h @PCAP_BUILD@
49+build-ncat: $(NCATDIR)/Makefile build-nbase build-nsock build-lua $(NCATDIR)/ncat.h @PCAP_BUILD@
50 cd $(NCATDIR) && $(MAKE)
51
52 build-lua: $(LIBLUADIR)/Makefile
53--
542.34.1
55
diff --git a/meta-oe/recipes-security/nmap/nmap-7.92/0006-Fix-build-with-libpcap-1.10.5.patch b/meta-oe/recipes-security/nmap/nmap-7.92/0006-Fix-build-with-libpcap-1.10.5.patch
new file mode 100644
index 0000000000..4ee4a7295e
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/nmap-7.92/0006-Fix-build-with-libpcap-1.10.5.patch
@@ -0,0 +1,47 @@
1From ba7b4a8cc570f0ce154f186fbe840f0ac23b2b96 Mon Sep 17 00:00:00 2001
2From: Yi Zhao <yi.zhao@windriver.com>
3Date: Mon, 28 Apr 2025 10:04:46 +0800
4Subject: [PATCH] Fix build with libpcap 1.10.5
5
6Fixes:
7In file included from /build/tmp/work/core2-64-poky-linux/nmap/7.92/recipe-sysroot/usr/include/pcap/pcap.h:130,
8 from /build/tmp/work/core2-64-poky-linux/nmap/7.92/recipe-sysroot/usr/include/pcap.h:43,
9 from tcpip.h:72,
10 from nse_nsock.cc:4:
11nse_nsock.cc:36:3: error: expected identifier before 'int'
12 36 | PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
13 | ^~~~~~~~~~~
14nse_nsock.cc:36:3: error: expected '}' before 'int'
15nse_nsock.cc:33:6: note: to match this '{'
16 33 | enum {
17 | ^
18nse_nsock.cc:36:15: error: expected unqualified-id before '=' token
19 36 | PCAP_SOCKET = lua_upvalueindex(3), /* pcap socket metatable */
20 | ^
21nse_nsock.cc:40:1: error: expected declaration before '}' token
22 40 | };
23 | ^
24
25Upstream-Status: Pending
26
27Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
28---
29 nse_nsock.cc | 2 ++
30 1 file changed, 2 insertions(+)
31
32diff --git a/nse_nsock.cc b/nse_nsock.cc
33index 75ddeb6..a3c5186 100644
34--- a/nse_nsock.cc
35+++ b/nse_nsock.cc
36@@ -29,6 +29,8 @@
37
38 #define DEFAULT_TIMEOUT 30000
39
40+#undef PCAP_SOCKET
41+
42 /* Upvalues for library variables */
43 enum {
44 NSOCK_POOL = lua_upvalueindex(1),
45--
462.34.1
47
diff --git a/meta-oe/recipes-security/nmap/nmap_7.92.bb b/meta-oe/recipes-security/nmap/nmap_7.92.bb
new file mode 100644
index 0000000000..98969fe001
--- /dev/null
+++ b/meta-oe/recipes-security/nmap/nmap_7.92.bb
@@ -0,0 +1,66 @@
1SUMMARY = "network auditing tool"
2DESCRIPTION = "Nmap (Network Mapper) is a free and open source (license) utility for network discovery and security auditing.\nGui support via appending to IMAGE_FEATURES x11-base in local.conf"
3SECTION = "security"
4LICENSE = "GPL-2.0-only"
5
6LIC_FILES_CHKSUM = "file://LICENSE;md5=b8823a06822788010eae05b4f5e921b3"
7
8SRC_URI = "http://nmap.org/dist/${BP}.tar.bz2 \
9 file://0001-redefine-the-python-library-install-dir.patch \
10 file://0002-replace-.-shtool-mkdir-with-coreutils-mkdir-command.patch \
11 file://0003-Include-time.h-header-to-pass-clang-compilation.patch \
12 file://0004-Fix-building-with-libc.patch \
13 file://0005-fix-racing-between-build-ncat-and-build-lua.patch \
14 file://0006-Fix-build-with-libpcap-1.10.5.patch \
15 "
16SRC_URI[sha256sum] = "a5479f2f8a6b0b2516767d2f7189c386c1dc858d997167d7ec5cfc798c7571a1"
17
18UPSTREAM_CHECK_REGEX = "nmap-(?P<pver>\d+(\.\d+)+)\.tar"
19
20inherit autotools-brokensep pkgconfig python3native
21
22PACKAGECONFIG ?= "pcre ncat nping pcap"
23
24PACKAGECONFIG[pcap] = "--with-pcap=linux, --without-pcap, libpcap, libpcap"
25PACKAGECONFIG[pcre] = "--with-libpcre=${STAGING_LIBDIR}/.., --with-libpcre=included, libpcre"
26PACKAGECONFIG[ssl] = "--with-openssl=${STAGING_LIBDIR}/.., --without-openssl, openssl, openssl"
27PACKAGECONFIG[ssh2] = "--with-openssh2=${STAGING_LIBDIR}/.., --without-openssh2, libssh2, libssh2"
28PACKAGECONFIG[libz] = "--with-libz=${STAGING_LIBDIR}/.., --without-libz, zlib, zlib"
29
30# disable/enable packages
31PACKAGECONFIG[nping] = ",--without-nping,"
32PACKAGECONFIG[ncat] = ",--without-ncat,"
33PACKAGECONFIG[ndiff] = "--with-ndiff=yes,--without-ndiff,python3 python3-setuptools-native"
34PACKAGECONFIG[update] = ",--without-nmap-update,"
35
36EXTRA_OECONF = "--with-libdnet=included --with-liblinear=included --without-subversion --with-liblua=included"
37
38# zenmap needs python-pygtk which has been removed
39# it also only works with python2
40# disable for now until py3 is supported
41EXTRA_OECONF += "--without-zenmap"
42
43export PYTHON_SITEPACKAGES_DIR
44
45do_configure() {
46 autoconf
47 install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.guess ${S}
48 install -m 0755 ${STAGING_DATADIR_NATIVE}/gnu-config/config.sub ${S}
49 oe_runconf
50}
51
52do_install:append() {
53 for f in ndiff uninstall_ndiff; do
54 if [ -f ${D}${bindir}/$f ]; then
55 sed -i 's@^#!.*$@#!/usr/bin/env python3@g' ${D}${bindir}/$f
56 fi
57 done
58}
59
60FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR} ${datadir}/ncat"
61
62RDEPENDS:${PN} += " \
63 python3-difflib \
64 python3-asyncio \
65 python3-xml \
66"