aboutsummaryrefslogtreecommitdiff
path: root/src/common/address.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-03-28 03:19:00 -0400
committerNick Mathewson <nickm@torproject.org>2012-03-28 03:19:00 -0400
commit433d7578465e04484d537810096512b5cc61246f (patch)
treede201fe472549b9497894033660f979a0b80bd94 /src/common/address.c
parent70c17134c79d9de05408748329c0918158d7deb0 (diff)
downloadtor-433d7578465e04484d537810096512b5cc61246f.tar.gz
tor-433d7578465e04484d537810096512b5cc61246f.zip
Reject SOCKS requests for "localhost" or ".local"
Sending them on is futile, since we will be told "127.0.0.1" and then think we've been lied to. Partial fix for 2822.
Diffstat (limited to 'src/common/address.c')
-rw-r--r--src/common/address.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c
index 676c485897..e379464ebf 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -1682,3 +1682,12 @@ get_interface_address(int severity, uint32_t *addr)
return r;
}
+/** Return true if we can tell that <b>name</b> is a canonical name for the
+ * loopback address. */
+int
+tor_addr_hostname_is_local(const char *name)
+{
+ return !strcasecmp(name, "localhost") ||
+ !strcasecmp(name, "local") ||
+ !strcasecmpend(name, ".local");
+}