]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Give an early error if you pass a .onion or a .exit hostname to tor-resolve
authorNick Mathewson <nickm@torproject.org>
Tue, 30 Nov 2004 03:12:37 +0000 (03:12 +0000)
committerNick Mathewson <nickm@torproject.org>
Tue, 30 Nov 2004 03:12:37 +0000 (03:12 +0000)
svn:r3027

src/tools/tor-resolve.c

index a082f829a4a35ac738067008a819327ff8612839..10600fb06f3e2624bd83ace1b966ece975ff06d7 100644 (file)
@@ -204,6 +204,15 @@ main(int argc, char **argv)
     usage();
   }
 
+  if (!strcasecmpend(arg[0], ".onion") || !strcasecmpend(arg[0], ".exit")) {
+    const char *name_type = (!strcasecmpend(arg[0], ".exit")) ?
+      "an exit-local hostname" : "a hidden service";
+    fprintf(stderr, "%s is %s; those don't have IP addresses.\n\n"
+            "To connect to %s, you need to send the hostname to Tor;\n"
+            "we suggest SOCKS 4a.\n", arg[0], name_type, name_type);
+    return 1;
+  }
+
   if (do_resolve(arg[0], sockshost, socksport, &result))
     return 1;