[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torsocks/master] Fix: check SOCKS5 user/pass before setting them in config
commit 647bb224055fa5667f70b388ad0d8df6ced83c4b
Author: David Goulet <dgoulet@xxxxxxxxx>
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@xxxxxxxxx>
---
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 mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits