aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-06-25 13:23:07 -0400
committerNick Mathewson <nickm@torproject.org>2012-06-25 13:23:07 -0400
commit7c9f6a994f610b27b43867ebdbe88ecb6492452f (patch)
tree3ff1c9fe1a5c367854c9c5e43989cde11f5b306d /src
parent888d5d08fe4efb52a5923726dcfb75036bf90714 (diff)
parent53e4452f985cad0947cd8ebfa0a1c198b6a7da7d (diff)
downloadtor-7c9f6a994f610b27b43867ebdbe88ecb6492452f.tar
tor-7c9f6a994f610b27b43867ebdbe88ecb6492452f.tar.gz
Merge remote-tracking branch 'origin/maint-0.2.3'
Diffstat (limited to 'src')
-rw-r--r--src/or/transports.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/or/transports.c b/src/or/transports.c
index e43ec6c48..4ba239562 100644
--- a/src/or/transports.c
+++ b/src/or/transports.c
@@ -790,7 +790,8 @@ parse_smethod_line(const char *line, managed_proxy_t *mp)
char *method_name=NULL;
char *addrport=NULL;
- tor_addr_t addr;
+ tor_addr_t tor_addr;
+ char *address=NULL;
uint16_t port = 0;
transport_t *transport=NULL;
@@ -814,7 +815,7 @@ parse_smethod_line(const char *line, managed_proxy_t *mp)
}
addrport = smartlist_get(items, 2);
- if (tor_addr_port_lookup(addrport, &addr, &port)<0) {
+ if (tor_addr_port_split(LOG_PROTOCOL_WARN, addrport, &address, &port)<0) {
log_warn(LD_CONFIG, "Error parsing transport "
"address '%s'", addrport);
goto err;
@@ -826,7 +827,12 @@ parse_smethod_line(const char *line, managed_proxy_t *mp)
goto err;
}
- transport = transport_new(&addr, port, method_name, PROXY_NONE);
+ if (tor_addr_parse(&tor_addr, address) < 0) {
+ log_warn(LD_CONFIG, "Error parsing transport address '%s'", address);
+ goto err;
+ }
+
+ transport = transport_new(&tor_addr, port, method_name, PROXY_NONE);
if (!transport)
goto err;
@@ -835,7 +841,7 @@ parse_smethod_line(const char *line, managed_proxy_t *mp)
/* For now, notify the user so that he knows where the server
transport is listening. */
log_info(LD_CONFIG, "Server transport %s at %s:%d.",
- method_name, fmt_addr(&addr), (int)port);
+ method_name, address, (int)port);
r=0;
goto done;
@@ -846,6 +852,7 @@ parse_smethod_line(const char *line, managed_proxy_t *mp)
done:
SMARTLIST_FOREACH(items, char*, s, tor_free(s));
smartlist_free(items);
+ tor_free(address);
return r;
}
@@ -863,7 +870,8 @@ parse_cmethod_line(const char *line, managed_proxy_t *mp)
int socks_ver=PROXY_NONE;
char *addrport=NULL;
- tor_addr_t addr;
+ tor_addr_t tor_addr;
+ char *address=NULL;
uint16_t port = 0;
transport_t *transport=NULL;
@@ -899,7 +907,7 @@ parse_cmethod_line(const char *line, managed_proxy_t *mp)
}
addrport = smartlist_get(items, 3);
- if (tor_addr_port_lookup(addrport, &addr, &port)<0) {
+ if (tor_addr_port_split(LOG_PROTOCOL_WARN, addrport, &address, &port)<0) {
log_warn(LD_CONFIG, "Error parsing transport "
"address '%s'", addrport);
goto err;
@@ -911,7 +919,12 @@ parse_cmethod_line(const char *line, managed_proxy_t *mp)
goto err;
}
- transport = transport_new(&addr, port, method_name, socks_ver);
+ if (tor_addr_parse(&tor_addr, address) < 0) {
+ log_warn(LD_CONFIG, "Error parsing transport address '%s'", address);
+ goto err;
+ }
+
+ transport = transport_new(&tor_addr, port, method_name, socks_ver);
if (!transport)
goto err;
@@ -919,7 +932,7 @@ parse_cmethod_line(const char *line, managed_proxy_t *mp)
log_info(LD_CONFIG, "Transport %s at %s:%d with SOCKS %d. "
"Attached to managed proxy.",
- method_name, fmt_addr(&addr), (int)port, socks_ver);
+ method_name, address, (int)port, socks_ver);
r=0;
goto done;
@@ -930,6 +943,7 @@ parse_cmethod_line(const char *line, managed_proxy_t *mp)
done:
SMARTLIST_FOREACH(items, char*, s, tor_free(s));
smartlist_free(items);
+ tor_free(address);
return r;
}