[tor-commits] [tor/master] socks: Add SocksPort flag ExtendedErrors

asn at torproject.org asn at torproject.org
Mon Nov 18 17:12:15 UTC 2019


commit 78a9158bf00e771dcfc41d7e992692b915f27689
Author: David Goulet <dgoulet at torproject.org>
Date:   Thu Oct 17 08:52:21 2019 -0400

    socks: Add SocksPort flag ExtendedErrors
    
    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 at torproject.org>
---
 src/app/config/config.c         | 6 +++++-
 src/core/or/entry_port_cfg_st.h | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/app/config/config.c b/src/app/config/config.c
index deda2448b..ba4a3f2cf 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -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);
     }
diff --git a/src/core/or/entry_port_cfg_st.h b/src/core/or/entry_port_cfg_st.h
index b84838d44..9ee867636 100644
--- a/src/core/or/entry_port_cfg_st.h
+++ b/src/core/or/entry_port_cfg_st.h
@@ -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) */





More information about the tor-commits mailing list