]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
socks: Add SocksPort flag ExtendedErrors
authorDavid Goulet <dgoulet@torproject.org>
Thu, 17 Oct 2019 12:52:21 +0000 (08:52 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Thu, 17 Oct 2019 12:52:21 +0000 (08:52 -0400)
This new flag tells tor that it can send back the SOCKS5 extended error code
detailed in prop304.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/app/config/config.c
src/core/or/entry_port_cfg_st.h

index deda2448b639f4067079d3442eddd0377881fffc..ba4a3f2cfce030e3fc7fe03bd93b7628ae77dfe7 100644 (file)
@@ -6919,7 +6919,7 @@ parse_port_config(smartlist_t *out,
       cache_ipv6 = 0, use_cached_ipv6 = 0,
       prefer_ipv6_automap = 1, world_writable = 0, group_writable = 0,
       relax_dirmode_check = 0,
-      has_used_unix_socket_only_option = 0;
+      has_used_unix_socket_only_option = 0, extended_errors = 0;
 
     int is_unix_tagged_addr = 0;
     const char *rest_of_line = NULL;
@@ -7158,6 +7158,9 @@ parse_port_config(smartlist_t *out,
         } else if (!strcasecmp(elt, "KeepAliveIsolateSOCKSAuth")) {
           socks_iso_keep_alive = ! no;
           continue;
+        } else if (!strcasecmp(elt, "ExtendedErrors")) {
+          extended_errors = ! no;
+          continue;
         }
 
         if (!strcasecmpend(elt, "s"))
@@ -7270,6 +7273,7 @@ parse_port_config(smartlist_t *out,
       if (! (isolation & ISO_SOCKSAUTH))
         cfg->entry_cfg.socks_prefer_no_auth = 1;
       cfg->entry_cfg.socks_iso_keep_alive = socks_iso_keep_alive;
+      cfg->entry_cfg.extended_socks5_codes = extended_errors;
 
       smartlist_add(out, cfg);
     }
index b84838d44fa96e2b5044652b9496ee64da4c6cc7..9ee86763679aa7742fd156ab1c26500d2445d22e 100644 (file)
@@ -48,6 +48,9 @@ struct entry_port_cfg_t {
    * do we prefer IPv6? */
   unsigned int prefer_ipv6_virtaddr : 1;
 
+  /** For socks listeners: can we send back the extended SOCKS5 error code? */
+  unsigned int extended_socks5_codes : 1;
+
 };
 
 #endif /* !defined(ENTRY_PORT_CFG_ST_H) */