Blame SOURCES/nmap-6.40-ncat_default_proxy_port.patch

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