
commit 7556933537b5777a9bef21230bb91a08aa70d60e Merge: 0317eb143 ba3121191 Author: Nick Mathewson <nickm@torproject.org> Date: Thu Jul 12 11:47:25 2018 -0400 Merge branch 'socks_trunnel4_squashed' into socks_trunnel4_squashed_merged changes/ticket3569_part1 | 6 + src/core/or/socks_request_st.h | 2 + src/core/proto/proto_socks.c | 1124 ++++++++---- src/test/test_socks.c | 11 +- src/trunnel/include.am | 9 +- src/trunnel/socks5.c | 3978 ++++++++++++++++++++++++++++++++++++++++ src/trunnel/socks5.h | 995 ++++++++++ src/trunnel/socks5.trunnel | 94 + 8 files changed, 5854 insertions(+), 365 deletions(-) diff --cc src/core/proto/proto_socks.c index 691244147,998fd72ba..530436c41 --- a/src/core/proto/proto_socks.c +++ b/src/core/proto/proto_socks.c @@@ -4,19 -4,30 +4,32 @@@ * Copyright (c) 2007-2018, The Tor Project, Inc. */ /* See LICENSE for licensing information */ -#include "or/or.h" -#include "or/addressmap.h" -#include "common/buffers.h" -#include "or/control.h" -#include "or/config.h" +#include "core/or/or.h" +#include "feature/client/addressmap.h" +#include "lib/container/buffers.h" +#include "core/mainloop/connection.h" +#include "feature/control/control.h" +#include "app/config/config.h" #include "lib/crypt_ops/crypto_util.h" -#include "or/ext_orport.h" -#include "or/proto_socks.h" -#include "or/reasons.h" +#include "feature/relay/ext_orport.h" +#include "core/proto/proto_socks.h" +#include "core/or/reasons.h" + +#include "core/or/socks_request_st.h" + #include "trunnel/socks5.h" -#include "or/socks_request_st.h" + + #define SOCKS_VER_5 0x05 /* First octet of non-auth SOCKS5 messages */ + #define SOCKS_VER_4 0x04 /* SOCKS4 messages */ + #define SOCKS_AUTH 0x01 /* SOCKS5 auth messages */ + + typedef enum { + SOCKS_RESULT_INVALID = -1, /* Message invalid. */ + SOCKS_RESULT_TRUNCATED = 0, /* Message incomplete/truncated. */ + SOCKS_RESULT_DONE = 1, /* OK, we're done. */ + SOCKS_RESULT_MORE_EXPECTED = 2, /* OK, more messages expected. */ + } socks_result_t; + static void socks_request_set_socks5_error(socks_request_t *req, socks5_reply_status_t reason);