diff options
author | George Kadianakis <desnacked@riseup.net> | 2013-02-09 18:46:10 +0000 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2013-02-09 18:46:10 +0000 |
commit | b5dceab1751dfa12b27b3042a49d90e0b02c2e0c (patch) | |
tree | d5ccc5d775d7ac6833a2b4d3ae5fe59dc91b9203 /src/or/connection.c | |
parent | d54efda869ee522d81bc0ccb80820f46c4f1439e (diff) | |
download | tor-b5dceab1751dfa12b27b3042a49d90e0b02c2e0c.tar.gz tor-b5dceab1751dfa12b27b3042a49d90e0b02c2e0c.zip |
Fix various issues pointed out by Nick and Andrea.
- Document the key=value format.
- Constify equal_sign_pos.
- Pass some strings that are about to be logged to escape().
- Update documentation and fix some bugs in tor_escape_str_for_socks_arg().
- Use string_is_key_value() in parse_bridge_line().
- Parenthesize a forgotten #define
- Add some more comments.
- Add some more unit test cases.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 6bac59b20c..b0fbe520b2 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1585,7 +1585,7 @@ get_proxy_type(void) /* One byte for the version, one for the command, two for the port, and four for the addr... and, one more for the username NUL: */ -#define SOCKS4_STANDARD_BUFFER_SIZE 1 + 1 + 2 + 4 + 1 +#define SOCKS4_STANDARD_BUFFER_SIZE (1 + 1 + 2 + 4 + 1) /** Write a proxy request of <b>type</b> (socks4, socks5, https) to conn * for conn->addr:conn->port, authenticating with the auth details given @@ -1688,6 +1688,9 @@ connection_proxy_connect(connection_t *conn, int type) memcpy(buf + 2, &portn, 2); /* port */ memcpy(buf + 4, &ip4addr, 4); /* addr */ + /* Next packet field is the userid. If we have pluggable + transport SOCKS arguments, we have to embed them + there. Otherwise, we use an empty userid. */ if (socks_args_string) { /* place the SOCKS args string: */ tor_assert(strlen(socks_args_string) > 0); tor_assert(buf_size >= @@ -1951,6 +1954,8 @@ connection_read_proxy_handshake(connection_t *conn) break; } + /* Username and password lengths should have been checked + above and during torrc parsing. */ tor_assert(usize <= MAX_SOCKS5_AUTH_FIELD_SIZE && psize <= MAX_SOCKS5_AUTH_FIELD_SIZE); reqsize = 3 + usize + psize; |