From f1329d17d56b1ec2196306155012918515e5f199 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 1 Jan 2015 18:09:02 +0000 Subject: [PATCH] - Remove test.c we don't need git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5263 82007160-df01-0410-b94d-b575c5fd34c7 --- src/libopm/src/Makefile.am | 10 -- src/libopm/src/Makefile.in | 64 +++--------- src/libopm/src/test.c | 205 ------------------------------------- 3 files changed, 13 insertions(+), 266 deletions(-) delete mode 100644 src/libopm/src/test.c diff --git a/src/libopm/src/Makefile.am b/src/libopm/src/Makefile.am index 5ba20e5..467459e 100644 --- a/src/libopm/src/Makefile.am +++ b/src/libopm/src/Makefile.am @@ -20,13 +20,3 @@ libopm_la_SOURCES = compat.c \ proxy.h libopm_la_LIBADD = @LTLIBOBJS@ - -noinst_PROGRAMS = test test_debug -test_SOURCES = test.c -test_LDADD = libopm.la compat.o @LIBOBJS@ - -# An easier-to-debug version of test - -test_debug_SOURCES = test.c -test_debug_LDADD = libopm.la compat.o @LIBOBJS@ -test_debug_LDFLAGS = -static diff --git a/src/libopm/src/Makefile.in b/src/libopm/src/Makefile.in index 34d0506..59000b9 100644 --- a/src/libopm/src/Makefile.in +++ b/src/libopm/src/Makefile.in @@ -14,7 +14,6 @@ @SET_MAKE@ - VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ @@ -79,7 +78,6 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = test$(EXEEXT) test_debug$(EXEEXT) subdir = src/libopm/src DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp @@ -100,16 +98,6 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -PROGRAMS = $(noinst_PROGRAMS) -am_test_OBJECTS = test.$(OBJEXT) -test_OBJECTS = $(am_test_OBJECTS) -test_DEPENDENCIES = libopm.la compat.o @LIBOBJS@ -am_test_debug_OBJECTS = test.$(OBJEXT) -test_debug_OBJECTS = $(am_test_debug_OBJECTS) -test_debug_DEPENDENCIES = libopm.la compat.o @LIBOBJS@ -test_debug_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(test_debug_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -144,9 +132,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libopm_la_SOURCES) $(test_SOURCES) $(test_debug_SOURCES) -DIST_SOURCES = $(libopm_la_SOURCES) $(test_SOURCES) \ - $(test_debug_SOURCES) +SOURCES = $(libopm_la_SOURCES) +DIST_SOURCES = $(libopm_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -313,13 +300,6 @@ libopm_la_SOURCES = compat.c \ proxy.h libopm_la_LIBADD = @LTLIBOBJS@ -test_SOURCES = test.c -test_LDADD = libopm.la compat.o @LIBOBJS@ - -# An easier-to-debug version of test -test_debug_SOURCES = test.c -test_debug_LDADD = libopm.la compat.o @LIBOBJS@ -test_debug_LDFLAGS = -static all: all-am .SUFFIXES: @@ -369,23 +349,6 @@ clean-noinstLTLIBRARIES: libopm.la: $(libopm_la_OBJECTS) $(libopm_la_DEPENDENCIES) $(EXTRA_libopm_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libopm_la_OBJECTS) $(libopm_la_LIBADD) $(LIBS) -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) - @rm -f test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS) - -test_debug$(EXEEXT): $(test_debug_OBJECTS) $(test_debug_DEPENDENCIES) $(EXTRA_test_debug_DEPENDENCIES) - @rm -f test_debug$(EXEEXT) - $(AM_V_CCLD)$(test_debug_LINK) $(test_debug_OBJECTS) $(test_debug_LDADD) $(LIBS) - mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -399,7 +362,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -512,7 +474,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) +all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am @@ -547,7 +509,7 @@ maintainer-clean-generic: clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am + mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) @@ -618,15 +580,15 @@ uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am diff --git a/src/libopm/src/test.c b/src/libopm/src/test.c deleted file mode 100644 index ec94620..0000000 --- a/src/libopm/src/test.c +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2002 Erik Fears - * - * 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. - * - * - */ - -#include "setup.h" - -#include -#include "opm.h" -#include "opm_error.h" -#include "opm_types.h" -#include "compat.h" -#ifdef HAVE_UNISTD_H -# include -#endif - - -#define ARRAY_SIZEOF(x) (sizeof(x) / sizeof((x)[0])) - -void open_proxy(OPM_T *, OPM_REMOTE_T *, int, void *); -void negotiation_failed(OPM_T *, OPM_REMOTE_T *, int, void *); -void timeout(OPM_T *, OPM_REMOTE_T *, int, void *); -void end(OPM_T *, OPM_REMOTE_T *, int, void *); -void handle_error(OPM_T *, OPM_REMOTE_T *, int, void *); - -int complete = 0; - -int main(int argc, char **argv) -{ - OPM_ERR_T err; - int fdlimit = 1024; - int scan_port = 6667; - int max_read = 4096; - int scantimeout = 10; - unsigned int i, s; - - unsigned short http_ports[] = { - 8000, 8080, 3128, 80 - }; - - unsigned short wingate_ports[] = { - 23 - }; - - unsigned short router_ports[] = { - 23 - }; - - unsigned short socks4_ports[] = { - 1080 - }; - - unsigned short socks5_ports[] = { - 1080 - }; - - unsigned short httppost_ports[] = { - 80, 8090, 3128 - }; - - OPM_T *scanner; - OPM_REMOTE_T *remote; - - scanner = opm_create(); - - if(argc >= 2) - remote = opm_remote_create(argv[1]); - else - remote = opm_remote_create("127.0.0.1"); - - /* Setup callbacks */ - opm_callback(scanner, OPM_CALLBACK_OPENPROXY, &open_proxy, NULL); - opm_callback(scanner, OPM_CALLBACK_NEGFAIL, &negotiation_failed, NULL); - opm_callback(scanner, OPM_CALLBACK_TIMEOUT, &timeout, NULL); - opm_callback(scanner, OPM_CALLBACK_END, &end, NULL); - opm_callback(scanner, OPM_CALLBACK_ERROR, &handle_error, NULL); - - - /* Setup the scanner configuration */ - opm_config(scanner, OPM_CONFIG_FD_LIMIT, &fdlimit); - opm_config(scanner, OPM_CONFIG_SCAN_IP, "216.175.104.202"); - opm_config(scanner, OPM_CONFIG_SCAN_PORT, &scan_port); - opm_config(scanner, OPM_CONFIG_TARGET_STRING, "*** Looking up your hostname..."); - opm_config(scanner, OPM_CONFIG_TARGET_STRING, "ERROR :Trying to reconnect too fast."); - opm_config(scanner, OPM_CONFIG_TIMEOUT, &scantimeout); - opm_config(scanner, OPM_CONFIG_MAX_READ, &max_read); - - /* Setup the protocol configuration */ - for (s = ARRAY_SIZEOF(http_ports), i = 0; i < s; i++) { - opm_addtype(scanner, OPM_TYPE_HTTP, http_ports[i]); - } - - for (s = ARRAY_SIZEOF(wingate_ports), i = 0; i < s; i++) { - opm_addtype(scanner, OPM_TYPE_WINGATE, wingate_ports[i]); - } - - for (s = ARRAY_SIZEOF(router_ports), i = 0; i < s; i++) { - opm_addtype(scanner, OPM_TYPE_ROUTER, router_ports[i]); - } - - for (s = ARRAY_SIZEOF(socks4_ports), i = 0; i < s; i++) { - opm_addtype(scanner, OPM_TYPE_SOCKS4, socks4_ports[i]); - } - - for (s = ARRAY_SIZEOF(socks5_ports), i = 0; i < s; i++) { - opm_addtype(scanner, OPM_TYPE_SOCKS5, socks5_ports[i]); - } - - for (s = ARRAY_SIZEOF(httppost_ports), i = 0; i < s; i++) { - opm_addtype(scanner, OPM_TYPE_HTTPPOST, httppost_ports[i]); - } - - /* Remote structs can also have their own extended protocol configurations. For instance - if the target hostname contains strings such as 'proxy' or 'www', extended ports could - be scanned. */ - opm_remote_addtype(remote, OPM_TYPE_HTTP, 8001); - opm_remote_addtype(remote, OPM_TYPE_HTTP, 8002); - - switch(err = opm_scan(scanner, remote)) - { - case OPM_SUCCESS: - break; - case OPM_ERR_BADADDR: - printf("Bad address\n"); - opm_free(scanner); - opm_remote_free(remote); - return 0; - default: - printf("Unknown Error %d\n", err); - return 0; - } - - - while(!complete) - opm_cycle(scanner); - - opm_free(scanner); - - return 0; -} - -void open_proxy(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, - void *data) -{ - printf("Open proxy on %s:%d [%d bytes read]\n", remote->ip, - remote->port, remote->bytes_read); - opm_end(scanner, remote); -} - -void negotiation_failed(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, - void *data) -{ - printf("Negotiation on %s:%d failed [%d bytes read]\n", remote->ip, - remote->port, remote->bytes_read); -} - -void timeout(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, void *data) -{ - printf("Negotiation timed out on %s:%d\n", remote->ip, remote->port); -} - -void end(OPM_T *scanner, OPM_REMOTE_T *remote, int notused, void *data) -{ - printf("Scan on %s has ended\n", remote->ip); - opm_remote_free(remote); - complete = 1; -} - -void handle_error(OPM_T *scanner, OPM_REMOTE_T *remote, int err, void *data) -{ - switch(err) - { - case OPM_ERR_MAX_READ: - printf("Reached MAX READ on %s:%d\n", remote->ip, remote->port); - break; - case OPM_ERR_BIND: - printf("Unable to bind for %s:%d\n", remote->ip, remote->port); - break; - case OPM_ERR_NOFD: - printf("Unable to allocate file descriptor for %s:%d\n", - remote->ip, remote->port); - break; - default: - printf("Unknown error on %s:%d, err = %d\n", remote->ip, - remote->port, err); - } -} -- 2.30.2