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

[or-cvs] [torsocks/master] Remove unused source files



commit 71204c20eb080350e0e4dc8eafe71fc2ea41e8be
Author: Robert Hogan <robert@xxxxxxxxxxxxxxx>
Date:   Mon Feb 14 19:47:05 2011 +0000

    Remove unused source files
    
    Removing these supplementary utilities as they've been disabled
    for some time now. They can be restored by popular demand if
    necessary.
---
 configure.in        |    2 +-
 src/Makefile.am     |   11 --
 src/inspectsocks.c  |  200 ------------------------------------
 src/saveme.c        |   60 -----------
 src/tsocks.announce |   13 ---
 src/validateconf.c  |  285 ---------------------------------------------------
 6 files changed, 1 insertions(+), 570 deletions(-)

diff --git a/configure.in b/configure.in
index 9a41cf1..7cfa02c 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(src/saveme.c)
+AC_INIT()
 AC_CONFIG_HEADER(config.h)
 
 AM_INIT_AUTOMAKE(torsocks, 0.1)
diff --git a/src/Makefile.am b/src/Makefile.am
index f0ae121..aa61a21 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,17 +3,6 @@
 LIBS = -ldl -lc -lresolv
 libdir = @libdir@/torsocks
 
-# Install helper programs
-#bin_PROGRAMS = validateconf inspectsocks saveme
-#validateconf_SOURCES = validateconf.c common.c parser.c
-#validateconf_CFLAGS = $(AM_CFLAGS)
-
-#inspectsocks_SOURCES = inspectsocks.c common.c
-#inspectsocks_CFLAGS = $(AM_CFLAGS)
-
-#saveme_SOURCES = saveme.c
-#saveme_CFLAGS = $(AM_CFLAGS)
-
 # Install configuration file
 usewithtorconfdir = $(CONFDIR)/
 usewithtorconf_DATA = torsocks.conf
diff --git a/src/inspectsocks.c b/src/inspectsocks.c
deleted file mode 100644
index d93bddf..0000000
--- a/src/inspectsocks.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/***************************************************************************
- *                                                                         *
- * $Id: inspectsocks.c,v 1.2 2008-07-06 15:17:35 hoganrobert Exp $                            *
- *                                                                         *
- *   Copyright (C) 2008 by Robert Hogan                                    *
- *   robert@xxxxxxxxxxxxxxx                                                *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
- ***************************************************************************
- *                                                                         *
- *   This is a modified version of a source file from the tsocks project.  *
- *   Original copyright notice from tsocks source file follows:            *
- *                                                                         *
- ***************************************************************************/
-/*
-
-    INSPECTSOCKS - Part of the tsocks package
-		   This utility can be used to determine the protocol 
-		   level of a SOCKS server.
-
-    Copyright (C) 2000 Shaun Clowes 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/* Global configuration variables */ 
-const char *torsocks_progname = "inspectsocks";	   /* Name for error msgs      */
-int defaultport	= 1080;			   /* Default SOCKS port       */
-
-/* Header Files */
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <common.h>
-
-int send_request(struct sockaddr_in *server, void *req, 
-                 int reqlen, void *rep, int replen);
-
-int main(int argc, char *argv[]) {
-	const char *usage = "Usage: <socks server name/ip> [portno]";
-	char req[9];
-	char resp[100];
-	unsigned short int portno = defaultport;
-	int ver = 0;
-	int read_bytes;
-	struct sockaddr_in server;
-
-	if ((argc < 2) || (argc > 3)) {
-		show_msg(MSGERR, "Invalid number of arguments\n");
-		show_msg(MSGERR, "%s\n", usage);
-		exit(1);
-	}
-
-	switch (argc) {
-		case 3:
-			portno = (unsigned short int)
-				 strtol(argv[2], (char **) 0, 10);
-			if ((portno == 0) || (errno == EINVAL)) {
-				show_msg(MSGERR, "%s\n", usage);
-				exit(1);
-			}
-		case 2:
-			if ((server.sin_addr.s_addr = resolve_ip(argv[1], 1,HOSTNAMES))
-                            ==  0) {
-				show_msg(MSGERR, "Invalid IP/host specified (%s)\n", argv[1]);
-				show_msg(MSGERR, "%s\n", usage);
-				exit(1);
-			}
-	}
-
-	server.sin_family = AF_INET; /* host byte order */
-	server.sin_port = htons(portno);     /* short, network byte order */
-	bzero(&(server.sin_zero), 8);/* zero the rest of the struct */
-
-	/* Now, we send a SOCKS V5 request which happens to be */
-	/* the same size as the smallest possible SOCKS V4     */
-	/* request. In this packet we specify we have 7 auth   */
-	/* methods but specify them all as NO AUTH.            */
-	bzero(req, sizeof(req));
-	req[0] = '\x05';
-	req[1] = '\x07';
-	read_bytes = send_request(&server, req, 
-				  sizeof(req), resp, sizeof(resp));
-	if (read_bytes > 0) {
-		if ((int) resp[0] == 0) {
-			ver = 4;
-		} else if ((int) resp[0] == 5) {
-			ver = 5;
-		} 
-		if (ver != 0) {
-			printf("Reply indicates server is a version "
-			       "%d socks server\n", ver);
-		} else {
-			show_msg(MSGERR, "Invalid SOCKS version reply (%d), "
-			       	   "probably not a socks server\n",
-				   ver);
-		}
-		exit(0);
-	}	
-
-	/* Hmmm.... disconnected so try a V4 request */
-	printf("Server disconnected V5 request, trying V4\n");
-	req[0] = '\x04';
-	req[1] = '\x01';
-	read_bytes = send_request(&server, req, 
-				  sizeof(req), resp, sizeof(resp));	
-	if (read_bytes > 0) {
-		if ((int) resp[0] == 0) {
-			ver = 4;
-		} 
-		if (ver == 4) {
-			printf("Reply indicates server is a version "
-			       "4 socks server\n");
-		} else {
-			show_msg(MSGERR, "Invalid SOCKS version reply (%d), "
-			       	   "probably not a socks server\n",
-				   (int) resp[0]);
-		}
-		exit(0);
-	} else {
-		show_msg(MSGERR, "Server disconnected, probably not a "
-			   "socks server\n");
-	}
-
-	return(0);  
-}
-
-int send_request(struct sockaddr_in *server, void *req, 
-		 int reqlen, void *rep, int replen) {
-	int sock;
-	int rc;
-
-	if ((sock = socket(server->sin_family, SOCK_STREAM, 0)) < 0)
-	{
-		show_msg(MSGERR, "Could not create socket (%s)\n",
-			   strerror(errno));
-		exit(1);
-	}
-	
-	if (connect(sock, (struct sockaddr *) server,
-		    sizeof(struct sockaddr_in)) != -1) {
-	} else {
-		show_msg(MSGERR, "Connect failed! (%s)\n",
-			   strerror(errno));
-		exit(1);
-	}
-
-	if (send(sock, (void *) req, reqlen,0) < 0) {
-		show_msg(MSGERR, "Could not send to server (%s)\n",
-			   strerror(errno));
-		exit(1);
-	}
-
-	/* Now wait for reply */
-	if ((rc = recv(sock, (void *) rep, replen, 0)) < 0) {
-		show_msg(MSGERR, "Could not read from server\n",
-			   strerror(errno));
-		exit(1);
-	}
-
-	close(sock);
-
-	return(rc);
-	
-}
diff --git a/src/saveme.c b/src/saveme.c
deleted file mode 100644
index 43e490a..0000000
--- a/src/saveme.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
- *                                                                         *
- * $Id: saveme.c,v 1.2 2008-07-06 15:17:35 hoganrobert Exp $                            *
- *                                                                         *
- *   Copyright (C) 2008 by Robert Hogan                                    *
- *   robert@xxxxxxxxxxxxxxx                                                *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
- ***************************************************************************
- *                                                                         *
- *   This is a modified version of a source file from the tsocks project.  *
- *   Original copyright notice from tsocks source file follows:            *
- *                                                                         *
- ***************************************************************************/
-/* 
-
-     SAVEME    - Part of the tsocks package
-		 This program is designed to be statically linked so
-		 that if a user breaks their ld.so.preload file and
-		 cannot run any dynamically linked program it can 
-		 delete the offending ld.so.preload file.
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-
-int main() {
-
-	unlink("/etc/ld.so.preload");
-
-   return(0);
-}
diff --git a/src/tsocks.announce b/src/tsocks.announce
deleted file mode 100644
index 5b905e1..0000000
--- a/src/tsocks.announce
+++ /dev/null
@@ -1,13 +0,0 @@
-torsocks 1.8- Provide transparent, DNS-safe SOCKS support for Tor
-
-tsocks provides transparent network access through a SOCKS proxy. This
-is common in firewalled LAN environments where all connections to the
-internet need to pass through a SOCKS server on the firewall. 
-tsocks intercepts the calls applications make to create tcp connections
-and determines if they can be directly accessed or need the SOCKS server.
-If they need the SOCKS server they connection is negotiated with the
-server transparently to the application. This allows existing applications
-to use SOCKS without recompilation or modification. tsocks is a wrapper
-library for a number of socket networking functions.  Essentially it's the 
-equivalent of the socksified winsock.dll libraries that are available for 
-Windows.
diff --git a/src/validateconf.c b/src/validateconf.c
deleted file mode 100644
index 1d2eb44..0000000
--- a/src/validateconf.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/***************************************************************************
- *                                                                         *
- * $Id: validateconf.c,v 1.2 2008-07-06 15:17:35 hoganrobert Exp $                            *
- *                                                                         *
- *   Copyright (C) 2008 by Robert Hogan                                    *
- *   robert@xxxxxxxxxxxxxxx                                                *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
- ***************************************************************************
- *                                                                         *
- *   This is a modified version of a source file from the tsocks project.  *
- *   Original copyright notice from tsocks source file follows:            *
- *                                                                         *
- ***************************************************************************/
-/*
-
-    VALIDATECONF - Part of the tsocks package
-		   This utility can be used to validate the torsocks.conf
-		   configuration file
-
-    Copyright (C) 2000 Shaun Clowes 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/* Global configuration variables */ 
-const char *torsocks_progname = "validateconf";	      /* Name for error msgs      */
-
-/* Header Files */
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <string.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <common.h>
-#include <parser.h>
-
-void show_server(struct parsedfile *, struct serverent *, int);
-void show_conf(struct parsedfile *config);
-void test_host(struct parsedfile *config, char *);
-
-int main(int argc, char *argv[]) {
-	const char *usage = "Usage: [-f conf file] [-t hostname/ip[:port]]"; 
-	char *filename = NULL;
-	char *testhost = NULL;
-   struct parsedfile config;
-	int i;
-
-	if ((argc > 5) || (((argc - 1) % 2) != 0)) {
-		show_msg(MSGERR, "Invalid number of arguments\n");
-		show_msg(MSGERR, "%s\n", usage);
-		exit(1);
-	}
-
-	for (i = 1; i < argc; i = i + 2) {
-		if (!strcmp(argv[i], "-f")) {
-			filename = argv[(i + 1)];
-		} else if (!strcmp(argv[i], "-t")) {
-			testhost = argv[(i + 1)];
-		} else {
-			show_msg(MSGERR, "Unknown option %s\n", argv[i]);
-			show_msg(MSGERR, "%s\n", usage);
-			exit(1);
-		}
-	}
-
-	if (!filename) 
-		filename = strdup(CONF_FILE);
-
-	printf("Reading configuration file %s...\n", filename);
-	if (read_config(filename, &config) == 0)
-		printf("... Read complete\n\n");
-	else 
-		exit(1);
-
-	/* If they specified a test host, test it, otherwise */
-	/* dump the configuration                            */
-	if (!testhost)
-		show_conf(&config);
-	else
-		test_host(&config, testhost);
-	
-	return(0);  
-}
-
-void test_host(struct parsedfile *config, char *host) { 
-	struct in_addr hostaddr;
-	struct serverent *path;
-   char *hostname, *port;
-   char separator;
-   unsigned long portno = 0;
-
-   /* See if a port has been specified */
-   hostname = strsplit(&separator, &host, ": \t\n");
-   if (separator == ':') {
-      port = strsplit(NULL, &host, " \t\n");
-      if (port) 
-         portno = strtol(port, NULL, 0);
-   }
-
-	/* First resolve the host to an ip */
-	if ((hostaddr.s_addr = resolve_ip(hostname, 0, 1)) == 0) {
-		fprintf(stderr, "Error: Cannot resolve %s\n", host);
-		return;
-	} else {
-		printf("Finding path for %s...\n", inet_ntoa(hostaddr));
-      if (!(is_local(config, &(hostaddr)))) {
-         printf("Path is local\n");
-      } else {
-         pick_server(config, &path, &hostaddr, portno);
-         if (path == &(config->defaultserver)) {
-            printf("Path is via default server:\n");
-            show_server(config, path, 1);
-         } else {
-            printf("Host is reached via this path:\n");
-            show_server(config, path, 0);
-         }
-      }
-	}
-
-	return;
-}
-
-void show_conf(struct parsedfile *config) {
-	struct netent *net;
-	struct serverent *server;
-
-	/* Show the local networks */
-	printf("=== Local networks (no socks server needed) ===\n");
-	net = (config->localnets);
-	while (net != NULL) {
-		printf("Network: %15s ",
-		       inet_ntoa(net->localip));
-		printf("NetMask: %15s\n", 
-		       inet_ntoa(net->localnet));
-		net = net->next;
-	}
-	printf("\n");
-
-	/* If we have a default server configuration show it */
-	printf("=== Default Server Configuration ===\n");
-	if ((config->defaultserver).address != NULL) {
-		show_server(config, &(config->defaultserver), 1);
-	} else {
-		printf("No default server specified, this is rarely a "
-		       "good idea\n");
-	}
-	printf("\n");
-
-	/* Now show paths */
-	if ((config->paths) != NULL) {
-		server = (config->paths);
-		while (server != NULL) {
-			printf("=== Path (line no %d in configuration file)"
-			       " ===\n", server->lineno);
-			show_server(config, server, 0);
-			printf("\n");
-			server = server->next;
-		}	
-	} 
-
-    /* Show tordns configuration options */
-    printf("=== TorDNS Configuration Options ===\n");
-    printf("Tor DNS enabled:        %s\n", 
-           config->tordns_enabled ? "yes" : "no");
-    printf("Tor DNS deadpool range: %s/", 
-           inet_ntoa(config->tordns_deadpool_range->localip));
-    printf("%s\n", 
-        inet_ntoa(config->tordns_deadpool_range->localnet));
-    printf("Tor DNS cache size:     %d\n", config->tordns_cache_size);
-    printf("\n");
-
-    return;
-}
-
-void show_server(struct parsedfile *config, struct serverent *server, int def) {
-	struct in_addr res;
-	struct netent *net;
-
-	/* Show address */
-	if (server->address != NULL) 
-		printf("Server:       %s (%s)\n", server->address, 
-	       		((res.s_addr = resolve_ip(server->address, 0, 
-						  HOSTNAMES)) == 0 
-			 ? "Invalid!" : inet_ntoa(res)));
-	else
-		printf("Server:       ERROR! None specified\n");
-
-	/* Check the server is on a local net */
-	if ((server->address != NULL) && (res.s_addr != 0) && 
-	    (is_local(config, &res))) 
-		fprintf(stderr, "Error: Server is not on a network "
-				"specified as local\n");
-
-	/* Show port */
-	printf("Port:         %d\n", server->port);
-
-	/* Show SOCKS type */
-	printf("SOCKS type:   %d\n", server->type);
-
-	/* Show default username and password info */
-	if (server->type == 5) {
-		/* Show the default user info */
-		printf("Default user: %s\n", 
-		       (server->defuser == NULL) ? 
-		       "Not Specified" : server->defuser);
-		printf("Default pass: %s\n", 
-		       (server->defpass == NULL) ? 
-		       "Not Specified" : "******** (Hidden)");
-		if ((server->defuser == NULL) && 
-		    (server->defpass != NULL)) 
-			fprintf(stderr, "Error: Default user must be specified "
-				   "if default pass is specified\n");
-	} else {
-		if (server->defuser) printf("Default user: %s\n", 
-					    server->defuser);
-		if (server->defpass) printf("Default pass: %s\n", 
-					    server->defpass);
-		if ((server->defuser != NULL) || (server->defpass != NULL))
-			fprintf(stderr, "Error: Default user and password "
-				   "may only be specified for version 5 "
-				   "servers\n");
-	}
-
-	/* If this is the default servers and it has reachnets, thats stupid */
-	if (def) {
-		if (server->reachnets != NULL) { 
-			fprintf(stderr, "Error: The default server has "
-			       "specified networks it can reach (reach statements), "
-			       "these statements are ignored since the "
-			       "default server will be tried for any network "
-			       "which is not specified in a reach statement "
-			       "for other servers\n");
-		}
-	} else if (server->reachnets == NULL) {
-		fprintf(stderr, "Error: No reach statements specified for "
-		       "server, this server will never be used\n");
-	} else {
-		printf("This server can be used to reach:\n");
-		net = server->reachnets;
-		while (net != NULL) {
-			printf("Network: %15s ",
-			       inet_ntoa(net->localip));
-			printf("NetMask: %15s ", 
-			       inet_ntoa(net->localnet));
-         if (net->startport)
-            printf("Ports: %5lu - %5lu",
-                   net->startport, net->endport);
-         printf("\n");
-			net = net->next;
-		}
-	}
-}