Record username/password data in socks_request_t

This change also requires us to add and use a pair of
allocator/deallocator functions for socks_request_t, instead of
using tor_malloc_zero/tor_free directly.
This commit is contained in:
Nick Mathewson
2011-06-29 12:31:17 -04:00
parent 204bce7e3c
commit 2e6604f42e
5 changed files with 66 additions and 19 deletions
+10 -10
View File
@@ -627,54 +627,54 @@ test_buffers(void)
/* Test fetch_from_buf_socks() */
buf = buf_new_with_capacity(256);
socks = tor_malloc_zero(sizeof(socks_request_t));;
socks = socks_request_new();
config_register_addressmaps(get_options());
/* Sending auth credentials before we've negotiated a method */
test_buffers_socks5_auth_before_negotiation_helper(cp, buf, socks);
tor_free(socks);
socks_request_free(socks);
buf_free(buf);
buf = NULL;
buf = buf_new_with_capacity(256);
socks = tor_malloc_zero(sizeof(socks_request_t));;
socks = socks_request_new();
/* A SOCKS 5 client that only supports authentication */
test_buffers_socks5_authenticate_helper(cp, buf, socks);
test_buffers_socks5_supported_commands_helper(cp, buf, socks);
test_buffers_socks5_unsupported_commands_helper(cp, buf, socks);
tor_free(socks);
socks_request_free(socks);
buf_free(buf);
buf = NULL;
buf = buf_new_with_capacity(256);
socks = tor_malloc_zero(sizeof(socks_request_t));;
socks = socks_request_new();
/* A SOCKS 5 client that sends credentials and data in one go */
test_buffers_socks5_authenticate_with_data_helper(cp, buf, socks);
tor_free(socks);
socks_request_free(socks);
buf_free(buf);
buf = NULL;
buf = buf_new_with_capacity(256);
socks = tor_malloc_zero(sizeof(socks_request_t));;
socks = socks_request_new();
/* A SOCKS 5 client that doesn't want authentication */
test_buffers_socks5_no_authenticate_helper(cp, buf, socks);
test_buffers_socks5_supported_commands_helper(cp, buf, socks);
test_buffers_socks5_unsupported_commands_helper(cp, buf, socks);
tor_free(socks);
socks_request_free(socks);
buf_free(buf);
buf = NULL;
buf = buf_new_with_capacity(256);
socks = tor_malloc_zero(sizeof(socks_request_t));;
socks = socks_request_new();
/* A SOCKS 4(a) client */
test_buffers_socks4_supported_commands_helper(cp, buf, socks);
test_buffers_socks4_unsupported_commands_helper(cp, buf, socks);
tor_free(socks);
socks_request_free(socks);
buf_free(buf);
buf = NULL;