Skip to content

Commit

Permalink
Implement SOCKS5 IPv6 support, username/password auth (#263)
Browse files Browse the repository at this point in the history
* Implement SOCKS5 IPv6 support, username/password, cleanup

* Fix SOCKS5, add proxy trace debugging messages

* Fix handling of SOCKS4 reply codes

* Don't allow sockets to generate SIGPIPE
  • Loading branch information
AliceLR committed Sep 13, 2020
1 parent 2819c5c commit 9c8c2b8
Show file tree
Hide file tree
Showing 8 changed files with 328 additions and 35 deletions.
7 changes: 7 additions & 0 deletions config.txt
Expand Up @@ -717,6 +717,13 @@
# socks_host = localhost
# socks_port = 1080

# For SOCKS5 proxies, a username and password can optionally be provided.
# Note that if your socks host is remote, these will be sent unencrypted over
# your network connection.

# socks_username = your_username
# socks_password = your_password

# The update host is an HTTP server containing all data and metadata
# associated with updates for MegaZeux. You normally won't want to
# change this, but it may be useful if you are a third party distributing
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.txt
Expand Up @@ -50,6 +50,7 @@ USERS
accidentally "decrypting" a corrupted file and prevents MZX
from attempting to decrypt MZX 1.x files (which store the
password differently).
+ Added SOCKS5 IPv6 and username/password support.

DEVELOPERS

Expand Down
16 changes: 16 additions & 0 deletions src/configure.c
Expand Up @@ -232,6 +232,8 @@ static const struct config_info user_conf_default =
#ifdef CONFIG_NETWORK
true, // network_enabled
"", // socks_host
"", // socks_username
"", // socks_password
1080, // socks_port
#endif
#if defined(CONFIG_UPDATER)
Expand Down Expand Up @@ -444,6 +446,18 @@ static void config_set_socks_port(struct config_info *conf, char *name,
conf->socks_port = result;
}

static void config_set_socks_username(struct config_info *conf, char *name,
char *value, char *extended_data)
{
config_string(conf->socks_username, value);
}

static void config_set_socks_password(struct config_info *conf, char *name,
char *value, char *extended_data)
{
config_string(conf->socks_password, value);
}

#endif // CONFIG_NETWORK

#ifdef CONFIG_UPDATER
Expand Down Expand Up @@ -1072,7 +1086,9 @@ static const struct config_entry config_options[] =
{ "save_slots_name", config_save_slots_name, false },
#ifdef CONFIG_NETWORK
{ "socks_host", config_set_socks_host, false },
{ "socks_password", config_set_socks_password, false },
{ "socks_port", config_set_socks_port, false },
{ "socks_username", config_set_socks_username, false },
#endif
{ "standalone_mode", config_standalone_mode, false },
{ "startup_editor", config_startup_editor, false },
Expand Down
2 changes: 2 additions & 0 deletions src/configure.h
Expand Up @@ -140,6 +140,8 @@ struct config_info
#ifdef CONFIG_NETWORK
boolean network_enabled;
char socks_host[256];
char socks_username[256];
char socks_password[256];
int socks_port;
#endif

Expand Down

0 comments on commit 9c8c2b8

Please sign in to comment.