diff options
author | Brent Eagles <brent@zeroc.com> | 2006-04-06 13:50:54 +0000 |
---|---|---|
committer | Brent Eagles <brent@zeroc.com> | 2006-04-06 13:50:54 +0000 |
commit | d63eafc1367b5aaa0bea4330b10a309e4806f5fc (patch) | |
tree | 9dd6e7283615abd68ea801509b29f4ada62b90be /cpp | |
parent | disable deprecation warning (diff) | |
download | ice-d63eafc1367b5aaa0bea4330b10a309e4806f5fc.tar.bz2 ice-d63eafc1367b5aaa0bea4330b10a309e4806f5fc.tar.xz ice-d63eafc1367b5aaa0bea4330b10a309e4806f5fc.zip |
removing RuleTester
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/test/Glacier2/attack/Makefile | 8 | ||||
-rw-r--r-- | cpp/test/Glacier2/attack/RuleTester.cpp | 196 | ||||
-rwxr-xr-x | cpp/test/Glacier2/attack/attackR.dsp | 106 | ||||
-rwxr-xr-x | cpp/test/Glacier2/attack/run.py | 12 | ||||
-rw-r--r-- | cpp/test/Glacier2/attack/test.dat | 48 |
5 files changed, 0 insertions, 370 deletions
diff --git a/cpp/test/Glacier2/attack/Makefile b/cpp/test/Glacier2/attack/Makefile index bee2e342d96..bbaa5e824eb 100644 --- a/cpp/test/Glacier2/attack/Makefile +++ b/cpp/test/Glacier2/attack/Makefile @@ -11,7 +11,6 @@ top_srcdir = ../../.. CLIENT = client SERVER = server -#RULETESTER = ruletester TARGETS = $(CLIENT) $(SERVER) $(RULETESTER) @@ -22,8 +21,6 @@ COBJS = Client.o SOBJS = Server.o -#RULETESTSRC = RuleTester.cpp - SRCS = $(OBJS:.o=.cpp) \ $(COBJS:.o=.cpp) \ $(SOBJS:.o=.cpp) @@ -42,9 +39,4 @@ $(SERVER): $(OBJS) $(SOBJS) rm -f $@ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS) -#$(RULETESTER): $(RULETESTSRC) $(top_srcdir)/src/Glacier2/ProxyVerifier.o -# rm -f $@ -# $(CXX) $(CPPFLAGS) -I$(top_srcdir)/src/Glacier2 $(LDFLAGS) -o $@ $(RULETESTSRC) \ -# $(top_srcdir)/src/Glacier2/ProxyVerifier.o $(LIBS) - include .depend diff --git a/cpp/test/Glacier2/attack/RuleTester.cpp b/cpp/test/Glacier2/attack/RuleTester.cpp deleted file mode 100644 index 3d9fca0abc8..00000000000 --- a/cpp/test/Glacier2/attack/RuleTester.cpp +++ /dev/null @@ -1,196 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -// -// From src/Glacier2 -// -#include <ProxyVerifier.h> - -#include <iostream> -#include <memory> -using namespace std; - -bool -startsWith(const string& s, const char* prefix) -{ - if(strncmp(s.c_str(), prefix, strlen(prefix)) == 0) - { - return true; - } - return false; -} - -void -dump(const Ice::PropertiesPtr& p) -{ - cerr << "Reject Rule: " << p->getPropertyWithDefault("Glacier2.Client.AddProxy.Reject", "(unset)") << '\n'; - cerr << "Accept Rule: " << p->getPropertyWithDefault("Glacier2.Client.AddProxy.Accept", "(unset)") << '\n'; - cerr << "MaxEndpoints Rule: " << p->getPropertyWithDefault("Glacier2.Client.AddProxy.MaxEndpoints", "(unset)") - << '\n'; -} - -void -parseLine(const string& line, string& prefix, string& data) -{ - istringstream is(line); - - if(!(is >> prefix) || is.eof()) - { - string msg = "Test definition error: malformed test case: "; - msg += line; - throw msg; - } - - while((is.peek() == ' ') && !is.eof()) - { - is.get(); - } - - if(is.eof()) - { - string msg = "Test definition error: malformed test case: "; - msg += line; - throw msg; - } - - getline(is, data); -} - -// -// Test driver is meant to be driven from a script. -// -int -main(int argc, char* argv[]) -{ - Ice::CommunicatorPtr communicator = Ice::initialize(argc, argv); - Ice::PropertiesPtr props = communicator->getProperties(); - auto_ptr<Glacier2::ProxyVerifier> v; - string input; - while(true) - { - getline(cin, input); - if(cin.eof()) - { - cerr << "input terminated" << endl; - break; - } - if(input == "EOF") - { - break; - } - else if(input[0] == '#') - { - continue; - } - else if(startsWith(input, "nr ")) - { - string prefix; - string data; - parseLine(input, prefix, data); - if(startsWith(data, "unset")) - { - data = ""; - } - props->setProperty("Glacier2.Client.AddProxy.Reject", data); - } - else if(startsWith(input, "na")) - { - string prefix; - string data; - parseLine(input, prefix, data); - if(startsWith(data, "unset")) - { - data = ""; - } - props->setProperty("Glacier2.Client.AddProxy.Accept", data); - } - else if(startsWith(input, "nm")) - { - string prefix; - string data; - parseLine(input, prefix, data); - if(startsWith(data, "unset")) - { - data = ""; - } - props->setProperty("Glacier2.Client.AddProxy.MaxEndpoints", data); - } - else if(input == "init") - { - v.reset(new Glacier2::ProxyVerifier(communicator, "")); - dump(props); - } - else - { - if(v.get() == 0) - { - cerr << "Test definition error: 'init' must appear before test cases." << endl; - return 1; - } - - // - // Test case - // - // Format is [expected result] [proxy] where [expected result] - // is 'r' for reject and 'a' for accept. Proxy strings must all - // be valid proxy strings. - // - string prefix; - string data; - try - { - parseLine(input, prefix, data); - } - catch(const string& ex) - { - cerr << ex << endl; - cout << "error" << endl; - throw; - } - bool accept; - if(prefix == "r") - { - accept = false; - } - else if(prefix == "a") - { - accept = true; - } - else - { - cerr << "Test definition error: test case line must being with an 'r' or 'a' followed by a space." - << endl; - cout << "error" << endl; - return 1; - } - Ice::ObjectPrx p = communicator->stringToProxy(data); - bool result = v->verify(p); - if(accept && !result) - { - cerr << "Test failed: " << data << " should've been accepted." << endl; - dump(props); - cout << "error" << endl; - return 1; - } - else if(!accept && result) - { - cerr << "Test failed: " << data << " should've been rejected." << endl; - dump(props); - cout << "error" << endl; - return 1; - } - else - { - cerr << "Test succeeded: " << data << " was " << (accept ? "accepted" : "rejected") << endl; - } - } - } - cout << "ok" << endl; - return 0; -} diff --git a/cpp/test/Glacier2/attack/attackR.dsp b/cpp/test/Glacier2/attack/attackR.dsp deleted file mode 100755 index c4d0a48e927..00000000000 --- a/cpp/test/Glacier2/attack/attackR.dsp +++ /dev/null @@ -1,106 +0,0 @@ -# Microsoft Developer Studio Project File - Name="attackR" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=attackR - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "attackR.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "attackR.mak" CFG="attackR - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "attackR - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "attackR - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "attackR - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /WX /GR /GX /O2 /I "." /I "../../../include" /I "../../include" /D "_CONSOLE" /D "NDEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /c
-# SUBTRACT CPP /Fr /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 ../../../src/Glacier2/Release/ProxyVerifier.obj Ice.lib IceUtil.lib pcre.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"client.exe" /libpath:"../../../lib" /FIXED:no
-# SUBTRACT LINK32 /debug /nodefaultlib
-
-!ELSEIF "$(CFG)" == "attackR - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /WX /Gm /GR /GX /Zi /Od /I "." /I "../../../include" /I "../../include" /I "../../../src/Glacier2" /D "_CONSOLE" /D "_DEBUG" /D "WIN32_LEAN_AND_MEAN" /FD /GZ /c
-# SUBTRACT CPP /Fr /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ../../../src/Glacier2/Debug/ProxyVerifier.obj Iced.lib IceUtild.lib pcred.lib /nologo /subsystem:console /debug /machine:I386 /out:"ruletester.exe" /pdbtype:sept /libpath:"../../../lib" /FIXED:no
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "attackR - Win32 Release"
-# Name "attackR - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\RuleTester.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/cpp/test/Glacier2/attack/run.py b/cpp/test/Glacier2/attack/run.py index a24d181907d..99b865c2b3c 100755 --- a/cpp/test/Glacier2/attack/run.py +++ b/cpp/test/Glacier2/attack/run.py @@ -17,18 +17,6 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: else: raise "can't find toplevel directory!" -#sys.stdout.write("Testing add proxy rules...") -#testcase = file("./test.dat") -#lines = testcase.readlines() -#input = os.popen(r"ruletester 1>test.out 2>test.log", "w") -#for l in lines: -# input.write(l) -# -#if not input.close() == None: -# print "There were errors, check test.log" -#else: -# print "ok" - sys.path.append(os.path.join(toplevel, "config")) import TestUtil diff --git a/cpp/test/Glacier2/attack/test.dat b/cpp/test/Glacier2/attack/test.dat deleted file mode 100644 index 0d1af43b97b..00000000000 --- a/cpp/test/Glacier2/attack/test.dat +++ /dev/null @@ -1,48 +0,0 @@ -# ********************************************************************** -# -# Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** -# -# See RuleTester.cpp for code that reads and uses this file. This code -# is written to ruletester's stdin in run.py. -# -# line format: -# init - initialize or re-initialize the proxy verification object -# after changing some properties with nr, na, or nm. -# nr regexp - new reject rule -# na regexp - new accept rule -# nm regexp - new max endpoints rule -# r proxy-string - test this proxy and expect a rejection -# a proxy-string - test this proxy and expect an accept -# EOF - ends the process -# -init -a hello:tcp -h foo.there.com -p 10041 -nr foo.there.com -init -r hello:tcp -h foo.there.com -p 10041 -a hello:tcp -h some.there.com -p 10041 -nr udp|foo.there.com -init -r hello:tcp -h foo.there.com -p 10041 -a hello:tcp -h some.there.com -p 10041 -r hello:udp -h some.there.com -p 10041 -nr udp -na foo.there.com -init -r hello:udp -h some.there.com -p 10041 -a hello:udp -h foo.there.com -p 10041 -nr unset -na unset -init -a hello:udp -h foo.there.com -p 10041 -nm 2 -init -a hello:udp -h foo.there.com -p 10041 -a hello:udp -h foo.there.com -p 10041:tcp -h foo.there.com -p 10042 -r hello:udp -h foo.there.com -p 10041:tcp -h foo.there.com -p 10042:tcp -h some.there.com -p 10043 -EOF |