From 1efd3774286e57f2faeaf37d66291a94c6aaab67 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 12 Dec 2006 20:23:17 +0000 Subject: [PATCH] Fix a bug in 0.1.2.2-alpha that prevented clients from asking to resolve an address at a given exit node even when they ask for it by name. svn:r9095 --- ChangeLog | 3 +++ src/or/circuituse.c | 2 +- src/or/or.h | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cdc07f7579..e7529b41cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,9 @@ Changes in version 0.1.2.5-xxxx - 200?-??-?? - Fix a bug on the Windows implementation of tor_mmap_file that would prevent the cached-routers file from ever loading. (reported by John Kimble.) + - Fix a bug in 0.1.2.2-alpha that prevented clients from asking + to resolve an address at a given exit node even when they ask for + it by name. o Security bugfixes: - Do not log introduction points for hidden services if SafeLogging diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 73e72f3e1e..42d220f1d5 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1182,7 +1182,7 @@ connection_ap_handshake_attach_circuit(edge_connection_t *conn) } return -1; } - if (conn->_base.purpose != EXIT_PURPOSE_RESOLVE && + if (!SOCKS_COMMAND_IS_RESOLVE(conn->socks_request->command) && !connection_ap_can_use_exit(conn, router)) { log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP, "Requested exit point '%s' would refuse request. %s.", diff --git a/src/or/or.h b/src/or/or.h index 080c7f4ff0..22f9e15e33 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1712,6 +1712,10 @@ static INLINE void or_state_mark_dirty(or_state_t *state, time_t when) #define SOCKS_COMMAND_CONNECT 0x01 #define SOCKS_COMMAND_RESOLVE 0xF0 #define SOCKS_COMMAND_RESOLVE_PTR 0xF1 + +#define SOCKS_COMMAND_IS_RESOLVE(c) ((c)==SOCKS_COMMAND_RESOLVE || \ + (c)==SOCKS_COMMAND_RESOLVE_PTR) + /** State of a SOCKS request from a user to an OP */ struct socks_request_t { char socks_version; /**< Which version of SOCKS did the client use? */