diff options
author | George Kadianakis <desnacked@riseup.net> | 2012-04-12 22:42:37 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2012-04-12 22:42:37 +0200 |
commit | 6d2898607bd831944c6c15b6e15200a426149811 (patch) | |
tree | e0b2baee164b62b85c89c24aefdfaddee37252ec /src/or/config.c | |
parent | b03f90b5383744593dc1e83fc5834c965573a4dc (diff) | |
download | tor-6d2898607bd831944c6c15b6e15200a426149811.tar.gz tor-6d2898607bd831944c6c15b6e15200a426149811.zip |
Fix issues found by nickm.
* Document fmt_addr_impl() and friends.
* Parenthesize macro arguments.
* Rename get_first_listener_addrport_for_pt() to
get_first_listener_addrport_string().
* Handle port_cfg_t with no_listen.
* Handle failure of router_get_active_listener_port_by_type().
* Add an XXX to router_get_active_listener_port_by_type().
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/config.c b/src/or/config.c index 5ea1f5edee..3fc543c41f 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -6033,9 +6033,10 @@ get_configured_ports(void) * caller to free it after use. * * This function is meant to be used by the pluggable transport proxy - * spawning code. */ + * spawning code, please make sure that it fits your purposes before + * using it. */ char * -get_first_listener_addrport_for_pt(int listener_type) +get_first_listener_addrport_string(int listener_type) { static const char *ipv4_localhost = "127.0.0.1"; static const char *ipv6_localhost = "[::1]"; @@ -6047,6 +6048,8 @@ get_first_listener_addrport_for_pt(int listener_type) return NULL; SMARTLIST_FOREACH_BEGIN(configured_ports, const port_cfg_t *, cfg) { + if (cfg->no_listen) + continue; if (cfg->type == listener_type && tor_addr_family(&cfg->addr) != AF_UNSPEC) { @@ -6064,10 +6067,13 @@ get_first_listener_addrport_for_pt(int listener_type) /* If a listener is configured with port 'auto', we are forced to iterate all listener connections and find out in which port it ended up listening: */ - if (cfg->port == CFG_AUTO_PORT) + if (cfg->port == CFG_AUTO_PORT) { port = router_get_active_listener_port_by_type(listener_type); - else + if (!port) + return NULL; + } else { port = cfg->port; + } tor_asprintf(&string, "%s:%u", address, port); |