Blame SOURCES/nmap-6.40-ncat_default_proxy_port.patch

5a7ca0
diff --git a/ncat/ncat_main.c b/ncat/ncat_main.c
5a7ca0
index fb8745a..82c8acd 100644
5a7ca0
--- a/ncat/ncat_main.c
5a7ca0
+++ b/ncat/ncat_main.c
5a7ca0
@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
5a7ca0
     struct host_list_node *allow_host_list = NULL;
5a7ca0
     struct host_list_node *deny_host_list = NULL;
5a7ca0
 
5a7ca0
-	unsigned short proxyport = DEFAULT_PROXY_PORT;
5a7ca0
+    unsigned short proxyport;
5a7ca0
     int srcport = -1;
5a7ca0
     char *source = NULL;
5a7ca0
 
5a7ca0
@@ -705,30 +705,33 @@ int main(int argc, char *argv[])
5a7ca0
     }
5a7ca0
 
5a7ca0
     if (o.proxyaddr) {
5a7ca0
-        if (!o.proxytype)
5a7ca0
-            o.proxytype = Strdup("http");
5a7ca0
-
5a7ca0
-        if (!strcmp(o.proxytype, "http") ||
5a7ca0
-            !strcmp(o.proxytype, "socks4") || !strcmp(o.proxytype, "4") ||
5a7ca0
-            !strcmp(o.proxytype, "socks5") || !strcmp(o.proxytype, "5")) {
5a7ca0
-            /* Parse HTTP/SOCKS proxy address and store it in targetss.
5a7ca0
-             * If the proxy server is given as an IPv6 address (not hostname),
5a7ca0
-             * the port number MUST be specified as well or parsing will break
5a7ca0
-             * (due to the colons in the IPv6 address and host:port separator).
5a7ca0
-             */
5a7ca0
-
5a7ca0
-            targetaddrs->addrlen = parseproxy(o.proxyaddr,
5a7ca0
-                &targetaddrs->addr.storage, &targetaddrs->addrlen, &proxyport);
5a7ca0
-            if (o.af == AF_INET) {
5a7ca0
-                targetaddrs->addr.in.sin_port = htons(proxyport);
5a7ca0
-            } else { // might modify to else if and test AF_{INET6|UNIX|UNSPEC}
5a7ca0
-                targetaddrs->addr.in6.sin6_port = htons(proxyport);
5a7ca0
-            }
5a7ca0
-        } else {
5a7ca0
-            bye("Invalid proxy type \"%s\".", o.proxytype);
5a7ca0
-        }
5a7ca0
-
5a7ca0
-        if (o.listen)
5a7ca0
+      if (!o.proxytype){
5a7ca0
+        o.proxytype = Strdup("http");
5a7ca0
+      }
5a7ca0
+
5a7ca0
+      if (!strcmp(o.proxytype, "http")) {
5a7ca0
+        proxyport = DEFAULT_PROXY_PORT;
5a7ca0
+      } else if (!strcmp(o.proxytype, "socks4") || !strcmp(o.proxytype, "4")){
5a7ca0
+        proxyport = DEFAULT_SOCKS4_PORT;
5a7ca0
+      } else if (!strcmp(o.proxytype, "socks5") || !strcmp(o.proxytype, "5")) {
5a7ca0
+        proxyport = DEFAULT_SOCKS5_PORT;
5a7ca0
+      } else {
5a7ca0
+        bye("Invalid proxy type \"%s\".", o.proxytype);
5a7ca0
+      }
5a7ca0
+
5a7ca0
+      /* Parse HTTP/SOCKS proxy address and store it in targetss.
5a7ca0
+       * If the proxy server is given as an IPv6 address (not hostname),
5a7ca0
+       * the port number MUST be specified as well or parsing will break
5a7ca0
+       * (due to the colons in the IPv6 address and host:port separator).
5a7ca0
+       */
5a7ca0
+      targetaddrs->addrlen = parseproxy(o.proxyaddr,
5a7ca0
+                                        &targetaddrs->addr.storage, &targetaddrs->addrlen, &proxyport);
5a7ca0
+      if (o.af == AF_INET) {
5a7ca0
+        targetaddrs->addr.in.sin_port = htons(proxyport);
5a7ca0
+      } else { // might modify to else if and test AF_{INET6|UNIX|UNSPEC}
5a7ca0
+        targetaddrs->addr.in6.sin6_port = htons(proxyport);
5a7ca0
+      }
5a7ca0
+      if (o.listen)
5a7ca0
             bye("Invalid option combination: --proxy and -l.");
5a7ca0
     } else {
5a7ca0
         if (o.proxytype) {