diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-07-10 13:18:55 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-07-10 13:23:37 -0400 |
commit | 2f657a1416f2f81dd1be900269c4ae9bdb29f52d (patch) | |
tree | dd54069b078d165de04a85295bba79a1590fb422 /src/app/config | |
parent | c2ddb7b231c640a292d261af265dd423cee09179 (diff) | |
download | tor-2f657a1416f2f81dd1be900269c4ae9bdb29f52d.tar.gz tor-2f657a1416f2f81dd1be900269c4ae9bdb29f52d.zip |
Remove all users of addr_port_lookup outside of address.c
This function has a nasty API, since whether or not it invokes the
resolver depends on whether one of its arguments is NULL. That's a
good way for accidents to happen.
This patch incidentally makes tor-resolve support socks hosts on
IPv6.
Diffstat (limited to 'src/app/config')
-rw-r--r-- | src/app/config/config.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index 665732ea56..fa99fb0c88 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -6459,26 +6459,17 @@ parse_dir_authority_line(const char *line, dirinfo_type_t required_type, addrport = smartlist_get(items, 0); smartlist_del_keeporder(items, 0); - const char *addrport_sep = strchr(addrport, ':'); - if (!addrport_sep) { - log_warn(LD_CONFIG, "Error parsing DirAuthority address '%s' " - "(':' not found)", addrport); + if (tor_addr_port_split(LOG_WARN, addrport, &address, &dir_port) < 0) { + log_warn(LD_CONFIG, "Error parsing DirAuthority address '%s'.", addrport); goto err; } - address = tor_strndup(addrport, addrport_sep - addrport); if (!string_is_valid_ipv4_address(address)) { log_warn(LD_CONFIG, "Error parsing DirAuthority address '%s' " "(invalid IPv4 address)", address); goto err; } - tor_free(address); - - if (addr_port_lookup(LOG_WARN, addrport, &address, NULL, &dir_port)<0) { - log_warn(LD_CONFIG, "Error parsing DirAuthority address '%s'", addrport); - goto err; - } if (!dir_port) { log_warn(LD_CONFIG, "Missing port in DirAuthority address '%s'",addrport); goto err; |