nmap: fix hardcoded paths
This commit is contained in:
parent
18c14e17db
commit
8529943f84
@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://nmap.org/
|
||||
TERMUX_PKG_DESCRIPTION="Utility for network discovery and security auditing"
|
||||
TERMUX_PKG_LICENSE="GPL-2.0"
|
||||
TERMUX_PKG_VERSION=7.70
|
||||
TERMUX_PKG_REVISION=3
|
||||
TERMUX_PKG_REVISION=4
|
||||
TERMUX_PKG_SHA256=847b068955f792f4cc247593aca6dc3dc4aae12976169873247488de147a6e18
|
||||
TERMUX_PKG_SRCURL=https://nmap.org/dist/nmap-${TERMUX_PKG_VERSION}.tar.bz2
|
||||
# Depend on netcat so that it gets installed automatically when installing
|
||||
|
90
packages/nmap/fix-paths.patch
Normal file
90
packages/nmap/fix-paths.patch
Normal file
@ -0,0 +1,90 @@
|
||||
diff -uNr nmap-7.70/ncat/ncat_connect.c nmap-7.70.mod/ncat/ncat_connect.c
|
||||
--- nmap-7.70/ncat/ncat_connect.c 2018-01-28 23:18:17.000000000 +0200
|
||||
+++ nmap-7.70.mod/ncat/ncat_connect.c 2019-03-02 01:35:44.977992954 +0200
|
||||
@@ -1005,7 +1005,7 @@
|
||||
char *tmpdir = getenv("TMPDIR");
|
||||
size_t size=0, offset=0;
|
||||
strbuf_sprintf(&tmp_name, &size, &offset, "%s/ncat.XXXXXX",
|
||||
- tmpdir ? tmpdir : "/tmp");
|
||||
+ tmpdir ? tmpdir : "@TERMUX_PREFIX@/tmp");
|
||||
if (mkstemp(tmp_name) == -1) {
|
||||
bye("Failed to create name for temporary DGRAM source Unix domain socket (mkstemp).");
|
||||
}
|
||||
diff -uNr nmap-7.70/ncat/ncat_main.c nmap-7.70.mod/ncat/ncat_main.c
|
||||
--- nmap-7.70/ncat/ncat_main.c 2018-03-05 03:53:34.000000000 +0200
|
||||
+++ nmap-7.70.mod/ncat/ncat_main.c 2019-03-02 01:35:44.977992954 +0200
|
||||
@@ -999,8 +999,8 @@
|
||||
|
||||
#ifndef WIN32
|
||||
/* See if the shell is executable before we get deep into this */
|
||||
- if (o.execmode == EXEC_SHELL && access("/bin/sh", X_OK) == -1)
|
||||
- bye("/bin/sh is not executable, so `-c' won't work.");
|
||||
+ if (o.execmode == EXEC_SHELL && access("@TERMUX_PREFIX@/bin/sh", X_OK) == -1)
|
||||
+ bye("@TERMUX_PREFIX@/bin/sh is not executable, so `-c' won't work.");
|
||||
#endif
|
||||
|
||||
if (targetaddrs->addr.storage.ss_family != AF_UNSPEC) {
|
||||
diff -uNr nmap-7.70/ncat/ncat_posix.c nmap-7.70.mod/ncat/ncat_posix.c
|
||||
--- nmap-7.70/ncat/ncat_posix.c 2018-01-28 23:18:17.000000000 +0200
|
||||
+++ nmap-7.70.mod/ncat/ncat_posix.c 2019-03-02 01:35:44.981326300 +0200
|
||||
@@ -239,7 +239,7 @@
|
||||
char **cmdargs;
|
||||
|
||||
case EXEC_SHELL:
|
||||
- execl("/bin/sh", "sh", "-c", cmdexec, (void *) NULL);
|
||||
+ execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", cmdexec, (void *) NULL);
|
||||
break;
|
||||
#ifdef HAVE_LUA
|
||||
case EXEC_LUA:
|
||||
diff -uNr nmap-7.70/nmap_dns.cc nmap-7.70.mod/nmap_dns.cc
|
||||
--- nmap-7.70/nmap_dns.cc 2018-01-28 23:18:17.000000000 +0200
|
||||
+++ nmap-7.70.mod/nmap_dns.cc 2019-03-02 01:35:44.981326300 +0200
|
||||
@@ -1016,9 +1016,9 @@
|
||||
char fmt[32];
|
||||
char ipaddr[INET6_ADDRSTRLEN+1];
|
||||
|
||||
- fp = fopen("/etc/resolv.conf", "r");
|
||||
+ fp = fopen("@TERMUX_PREFIX@/etc/resolv.conf", "r");
|
||||
if (fp == NULL) {
|
||||
- if (firstrun) error("mass_dns: warning: Unable to open /etc/resolv.conf. Try using --system-dns or specify valid servers with --dns-servers");
|
||||
+ if (firstrun) error("mass_dns: warning: Unable to open $PREFIX/etc/resolv.conf. Try using --system-dns or specify valid servers with --dns-servers");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@
|
||||
parse_etchosts(tpbuf);
|
||||
|
||||
#else
|
||||
- parse_etchosts("/etc/hosts");
|
||||
+ parse_etchosts("@TERMUX_PREFIX@/etc/hosts");
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
diff -uNr nmap-7.70/protocols.cc nmap-7.70.mod/protocols.cc
|
||||
--- nmap-7.70/protocols.cc 2018-01-28 23:18:17.000000000 +0200
|
||||
+++ nmap-7.70.mod/protocols.cc 2019-03-02 01:37:23.878379187 +0200
|
||||
@@ -156,8 +156,8 @@
|
||||
int res;
|
||||
|
||||
if (nmap_fetchfile(filename, sizeof(filename), "nmap-protocols") != 1) {
|
||||
- error("Unable to find nmap-protocols! Resorting to /etc/protocols");
|
||||
- strcpy(filename, "/etc/protocols");
|
||||
+ error("Unable to find nmap-protocols! Resorting to @TERMUX_PREFIX@/etc/protocols");
|
||||
+ strcpy(filename, "@TERMUX_PREFIX@/etc/protocols");
|
||||
}
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
diff -uNr nmap-7.70/services.cc nmap-7.70.mod/services.cc
|
||||
--- nmap-7.70/services.cc 2018-01-28 23:18:17.000000000 +0200
|
||||
+++ nmap-7.70.mod/services.cc 2019-03-02 01:36:46.291565552 +0200
|
||||
@@ -202,8 +202,8 @@
|
||||
|
||||
if (nmap_fetchfile(filename, sizeof(filename), "nmap-services") != 1) {
|
||||
#ifndef WIN32
|
||||
- error("Unable to find nmap-services! Resorting to /etc/services");
|
||||
- strcpy(filename, "/etc/services");
|
||||
+ error("Unable to find nmap-services! Resorting to @TERMUX_PREFIX@/etc/services");
|
||||
+ strcpy(filename, "@TERMUX_PREFIX@/etc/services");
|
||||
#else
|
||||
int len, wnt = GetVersion() < 0x80000000;
|
||||
error("Unable to find nmap-services! Resorting to /etc/services");
|
@ -1,26 +0,0 @@
|
||||
diff -u -r ../nmap-7.40/ncat/ncat_main.c ./ncat/ncat_main.c
|
||||
--- ../nmap-7.40/ncat/ncat_main.c 2016-12-14 01:12:23.000000000 +0100
|
||||
+++ ./ncat/ncat_main.c 2017-02-17 11:46:27.468844181 +0100
|
||||
@@ -965,8 +965,8 @@
|
||||
|
||||
#ifndef WIN32
|
||||
/* See if the shell is executable before we get deep into this */
|
||||
- if (o.execmode == EXEC_SHELL && access("/bin/sh", X_OK) == -1)
|
||||
- bye("/bin/sh is not executable, so `-c' won't work.");
|
||||
+ if (o.execmode == EXEC_SHELL && access("@TERMUX_PREFIX@/bin/sh", X_OK) == -1)
|
||||
+ bye("@TERMUX_PREFIX@/bin/sh is not executable, so `-c' won't work.");
|
||||
#endif
|
||||
|
||||
if (targetss.storage.ss_family != AF_UNSPEC) {
|
||||
diff -u -r ../nmap-7.40/ncat/ncat_posix.c ./ncat/ncat_posix.c
|
||||
--- ../nmap-7.40/ncat/ncat_posix.c 2016-12-14 01:12:23.000000000 +0100
|
||||
+++ ./ncat/ncat_posix.c 2017-02-17 11:47:09.716313620 +0100
|
||||
@@ -239,7 +239,7 @@
|
||||
char **cmdargs;
|
||||
|
||||
case EXEC_SHELL:
|
||||
- execl("/bin/sh", "sh", "-c", cmdexec, (void *) NULL);
|
||||
+ execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", cmdexec, (void *) NULL);
|
||||
break;
|
||||
#ifdef HAVE_LUA
|
||||
case EXEC_LUA:
|
@ -1,15 +0,0 @@
|
||||
diff -u -r ../nmap-7.01/nmap_dns.cc ./nmap_dns.cc
|
||||
--- ../nmap-7.01/nmap_dns.cc 2015-10-07 13:49:24.000000000 -0400
|
||||
+++ ./nmap_dns.cc 2015-12-15 18:49:27.994641597 -0500
|
||||
@@ -959,9 +959,9 @@
|
||||
char fmt[32];
|
||||
char ipaddr[INET6_ADDRSTRLEN+1];
|
||||
|
||||
- fp = fopen("/etc/resolv.conf", "r");
|
||||
+ fp = fopen("@TERMUX_PREFIX@/etc/resolv.conf", "r");
|
||||
if (fp == NULL) {
|
||||
- if (firstrun) error("mass_dns: warning: Unable to open /etc/resolv.conf. Try using --system-dns or specify valid servers with --dns-servers");
|
||||
+ if (firstrun) error("mass_dns: warning: Unable to open $PREFIX/etc/resolv.conf. Try using --system-dns or specify valid servers with --dns-servers");
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user