diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2018-02-11 15:22:41 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-03-28 07:39:03 -0400 |
commit | 0e453929d21b030832b0c48fceac0c5688657e15 (patch) | |
tree | b6f89ea48b25a0b4c3e3a057f38122e32815e8f3 /src/common/util.c | |
parent | ddee28a3c9b9dd256cd6560a4766f17a6c6fc13d (diff) | |
download | tor-0e453929d21b030832b0c48fceac0c5688657e15.tar.gz tor-0e453929d21b030832b0c48fceac0c5688657e15.zip |
Allow IPv6 address strings to be used as hostnames in SOCKS5 requests
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index 90204befc0..1818b4f19e 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1071,6 +1071,17 @@ string_is_valid_ipv6_address(const char *string) return (tor_inet_pton(AF_INET6,string,&addr) == 1); } +/** Return true iff <b>string</b> is a valid destination address, + * i.e. either a DNS hostname or IPv4/IPv6 address string. + */ +int +string_is_valid_dest(const char *string) +{ + return string_is_valid_ipv4_address(string) || + string_is_valid_ipv6_address(string) || + string_is_valid_hostname(string); +} + /** Return true iff <b>string</b> matches a pattern of DNS names * that we allow Tor clients to connect to. * |