Blame SOURCES/nmap-6.40-ncat_default_proxy_port.patch

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