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@torproject.org>
This commit is contained in:
David Goulet 2019-10-17 08:52:21 -04:00
parent 5c09230b45
commit 78a9158bf0
2 changed files with 8 additions and 1 deletions

View 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);
}

View 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) */