[or-cvs] [torsocks/master] Remove socksdns, tordns and hostnames configure options.

hoganrobert at torproject.org hoganrobert at torproject.org
Mon Feb 14 21:30:19 UTC 2011


commit a445ee509995cca33595647b37c290884944743f
Author: Robert Hogan <robert at roberthogan.net>
Date:   Mon Feb 14 20:49:28 2011 +0000

    Remove socksdns, tordns and hostnames configure options.
    
    These options are defunct:
     1. socksdns (force dns lookups to use tcp)
        torsocks does this by default, no reason to make it optional.
     2. tordns (force dns lookups through tor)
        torsocks does this by default, option has been a no-op for a
        long time.
     3. hostnames (resolve name of socks server if required)
        potentially useful, but not really a good idea for tor.
---
 configure.in   |   26 --------------------------
 src/common.c   |   48 +++++++++++++++++++++++-------------------------
 src/torsocks.c |    2 +-
 3 files changed, 24 insertions(+), 52 deletions(-)

diff --git a/configure.in b/configure.in
index a962b55..ca5af2a 100644
--- a/configure.in
+++ b/configure.in
@@ -14,16 +14,10 @@ dnl /etc/ld.so.preload file
 dnl test "$libdir" = "\${exec_prefix}/lib" && libdir="/lib"
 
 dnl Arguments we allow
-AC_ARG_ENABLE(socksdns,
-[  --enable-socksdns       force dns lookups to use tcp ])
-AC_ARG_ENABLE(tordns,
-[  --disable-tordns         don't override name lookup calls to use SOCKS ])   
 AC_ARG_ENABLE(debug,
 [  --disable-debug         disable ALL error messages from torsocks ])
 AC_ARG_ENABLE(oldmethod,
 [  --enable-oldmethod      use the old method to override connect ])
-AC_ARG_ENABLE(hostnames,
-[  --enable-hostnames      enable hostname lookups for socks servers ])
 AC_ARG_ENABLE(envconf,
 [  --disable-envconf       do not allow TORSOCKS_CONF_FILE to specify configuration file ])
 
@@ -176,10 +170,6 @@ AC_EGREP_CPP(yes,
   ])    
 ])
 
-if test "${enable_socksdns}" = "yes"; then
-  AC_DEFINE([USE_SOCKS_DNS],[],[Description])
-fi
-
 if test "x${enable_envconf}" = "x"; then
   AC_DEFINE([ALLOW_ENV_CONFIG],[],[Description])
 fi
@@ -189,22 +179,6 @@ if test "${enable_oldmethod}" = "yes"; then
   oldmethod="yes"
 fi
 
-AC_DEFINE([HOSTNAMES],[0],[Description])
-
-if test "x${enable_hostnames}" = "xyes"; then
-  AC_DEFINE([HOSTNAMES],[1],[Description])
-fi
-
-if test "${enable_socksdns}" = "yes" -a \
-        "x${enable_hostnames}" = "xyes" ; then
-  AC_MSG_ERROR("--enable-socksdns is not valid with --enable-hostnames")
-fi
-
-if test "x${enable_tordns}" = "x" -a \
-        "x${enable_hostnames}" = "xyes" ; then
-  AC_MSG_ERROR("--enable-tordns is not valid with --enable-hostnames")
-fi
-
 dnl If we have to use the old method of overriding connect (i.e no
 dnl RTLD_NEXT) we need to know the location of the library that
 dnl contains connect(), select(), poll() and close()
diff --git a/src/common.c b/src/common.c
index 53a60b2..3826d3b 100644
--- a/src/common.c
+++ b/src/common.c
@@ -96,34 +96,32 @@ set_uint32(char *cp, uint32_t v)
   memcpy(cp,&v,4);
 }
 
-
-
 unsigned int resolve_ip(char *host, int showmsg, int allownames) {
-	struct hostent *new;
-	unsigned int	hostaddr;
-	struct in_addr *ip;
-
-	if ((hostaddr = inet_addr(host)) == (unsigned int) -1) {
-		/* We couldn't convert it as a numerical ip so */
-		/* try it as a dns name                        */
-		if (allownames) {
-			#ifdef HAVE_GETHOSTBYNAME
-			if ((new = gethostbyname(host)) == (struct hostent *) 0) {
-			#endif
-				return(0);
-			#ifdef HAVE_GETHOSTBYNAME
-			} else {
-				ip = ((struct in_addr *) * new->h_addr_list);
-				hostaddr = ip -> s_addr;
-				if (showmsg) 
-					printf("Connecting to %s...\n", inet_ntoa(*ip));
-			}
-			#endif
-		} else
-			return(0);
-	}
-
-	return (hostaddr);
+    struct hostent *new;
+    unsigned int    hostaddr;
+    struct in_addr *ip;
+
+    if ((hostaddr = inet_addr(host)) == (unsigned int) -1) {
+        /* We couldn't convert it as a numerical ip so */
+        /* try it as a dns name                        */
+        if (allownames) {
+            #ifdef HAVE_GETHOSTBYNAME
+            if ((new = gethostbyname(host)) == (struct hostent *) 0) {
+            #endif
+                return(0);
+            #ifdef HAVE_GETHOSTBYNAME
+            } else {
+                ip = ((struct in_addr *) * new->h_addr_list);
+                hostaddr = ip -> s_addr;
+                if (showmsg)
+                    printf("Connecting to %s...\n", inet_ntoa(*ip));
+            }
+            #endif
+        } else
+            return(0);
+    }
+
+    return (hostaddr);
 }
 
 /* Set logging options, the options are as follows:             */
diff --git a/src/torsocks.c b/src/torsocks.c
index 6f3bb39..46557f3 100644
--- a/src/torsocks.c
+++ b/src/torsocks.c
@@ -423,7 +423,7 @@ int tsocks_connect_guts(CONNECT_SIGNATURE, int (*original_connect)(CONNECT_SIGNA
                               "the server has not been "
                               "specified for this path\n",
                               path->lineno);
-    } else if ((res = resolve_ip(path->address, 0, HOSTNAMES)) == -1) {
+    } else if ((res = resolve_ip(path->address, 0, 0)) == -1) {
         show_msg(MSGERR, "The SOCKS server (%s) listed in the configuration "
                         "file which needs to be used for this connection "
                         "is invalid\n", path->address);





More information about the tor-commits mailing list