diff --git a/NmapOps.cc b/NmapOps.cc index 1aabd19ae..95c29155e 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -136,7 +136,7 @@ NmapOps::~NmapOps() { portlist = NULL; } if (proxy_chain) { - free(proxy_chain); + nsock_proxychain_delete(proxy_chain); proxy_chain = NULL; } if (exclude_spec) { diff --git a/NmapOps.h b/NmapOps.h index 5f72d124f..aa916b868 100644 --- a/NmapOps.h +++ b/NmapOps.h @@ -95,6 +95,7 @@ #include "nmap.h" #include "global_structures.h" #include "output.h" +#include #include class NmapOps { @@ -340,7 +341,7 @@ class NmapOps { FILE *inputfd; char *portlist; /* Ports list specified by user */ - char *proxy_chain; + nsock_proxychain proxy_chain; #ifndef NOLUA int script; diff --git a/nmap.cc b/nmap.cc index 1669aea7b..d5cada256 100644 --- a/nmap.cc +++ b/nmap.cc @@ -935,7 +935,8 @@ void parse_options(int argc, char **argv) { } else if (optcmp(long_options[option_index].name, "nsock-engine") == 0) { nsock_set_default_engine(optarg); } else if (optcmp(long_options[option_index].name, "proxies") == 0) { - o.proxy_chain = strdup(optarg); + if (nsock_proxychain_new(optarg, &o.proxy_chain, NULL) < 0) + fatal("Invalid proxy chain specification"); } else if (optcmp(long_options[option_index].name, "osscan-limit") == 0) { o.osscan_limit = 1; } else if (optcmp(long_options[option_index].name, "osscan-guess") == 0 diff --git a/service_scan.cc b/service_scan.cc index a9aa183f5..1c7400299 100644 --- a/service_scan.cc +++ b/service_scan.cc @@ -2674,7 +2674,7 @@ int service_scan(std::vector &Targets) { nsp_setdevice(nsp, o.device); if (o.proxy_chain) { - nsock_set_proxychain(nsp, o.proxy_chain); + nsp_set_proxychain(nsp, o.proxy_chain); } #if HAVE_OPENSSL