diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-03-20 16:17:06 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-03-20 16:17:06 -0400 |
commit | fa3c23773944788125db2f67bcb048376c17fec9 (patch) | |
tree | 93d89b2871e52c95ba5a9e5ae25817d44b0232ee /src/or/buffers.c | |
parent | a264c4fedab87ce7c8cbb94632657a90e95e7a4e (diff) | |
download | tor-fa3c23773944788125db2f67bcb048376c17fec9.tar.gz tor-fa3c23773944788125db2f67bcb048376c17fec9.zip |
Per-SOCKSPort configuration for bug 8117 fix.
This might be necessary if the bug8117 fix confuses any applications.
Also add a changes file.
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r-- | src/or/buffers.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 4554a02d69..c0868f479f 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -1773,6 +1773,7 @@ parse_socks(const char *data, size_t datalen, socks_request_t *req, if (req->socks_version != 5) { /* we need to negotiate a method */ unsigned char nummethods = (unsigned char)*(data+1); + int have_user_pass, have_no_auth; int r=0; tor_assert(!req->socks_version); if (datalen < 2u+nummethods) { @@ -1783,14 +1784,16 @@ parse_socks(const char *data, size_t datalen, socks_request_t *req, return -1; req->replylen = 2; /* 2 bytes of response */ req->reply[0] = 5; /* socks5 reply */ - if (memchr(data+2, SOCKS_USER_PASS, nummethods)) { + have_user_pass = (memchr(data+2, SOCKS_USER_PASS, nummethods) !=NULL); + have_no_auth = (memchr(data+2, SOCKS_NO_AUTH, nummethods) !=NULL); + if (have_user_pass && !(have_no_auth && req->socks_prefer_no_auth)) { req->auth_type = SOCKS_USER_PASS; req->reply[1] = SOCKS_USER_PASS; /* tell client to use "user/pass" auth method */ req->socks_version = 5; /* remember we've already negotiated auth */ log_debug(LD_APP,"socks5: accepted method 2 (username/password)"); r=0; - } else if (memchr(data+2, SOCKS_NO_AUTH, nummethods)) { + } else if (have_no_auth) { req->reply[1] = SOCKS_NO_AUTH; /* tell client to use "none" auth method */ req->socks_version = 5; /* remember we've already negotiated auth */ |