commit 647bb224055fa5667f70b388ad0d8df6ced83c4b Author: David Goulet dgoulet@ev0ke.net Date: Mon Mar 3 15:04:36 2014 -0500
Fix: check SOCKS5 user/pass before setting them in config
Signed-off-by: David Goulet dgoulet@ev0ke.net --- src/lib/torsocks.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/lib/torsocks.c b/src/lib/torsocks.c index b8f38fb..a20e94f 100644 --- a/src/lib/torsocks.c +++ b/src/lib/torsocks.c @@ -84,14 +84,23 @@ static void read_user_pass_env(void) goto end; }
- ret = conf_file_set_socks5_user(username, &tsocks_config); - if (ret < 0) { - goto error; + /* + * Only set the values if they were provided. It's possible that a user + * wants to only set one of the values through an env. variable and the + * other through the configuration file. + */ + if (username) { + ret = conf_file_set_socks5_user(username, &tsocks_config); + if (ret < 0) { + goto error; + } }
- ret = conf_file_set_socks5_pass(password, &tsocks_config); - if (ret < 0) { - goto error; + if (password) { + ret = conf_file_set_socks5_pass(password, &tsocks_config); + if (ret < 0) { + goto error; + } }
end:
tor-commits@lists.torproject.org