[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Give an early error if you pass a .onion or a .exit hostnam...



Update of /home/or/cvsroot/tor/src/tools
In directory moria.mit.edu:/tmp/cvs-serv22844/src/tools

Modified Files:
	tor-resolve.c 
Log Message:
Give an early error if you pass a .onion or a .exit hostname to tor-resolve

Index: tor-resolve.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/tools/tor-resolve.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- tor-resolve.c	28 Nov 2004 09:05:49 -0000	1.9
+++ tor-resolve.c	30 Nov 2004 03:12:37 -0000	1.10
@@ -204,6 +204,15 @@
     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;