summaryrefslogtreecommitdiff
path: root/cleopatre/application/spidnetsnmp/testing
diff options
context:
space:
mode:
authormars2009-09-09 15:56:58 +0000
committermars2009-09-09 15:56:58 +0000
commitbbf10fd6f6151b95bfc63eebabfee5a7adaff0a0 (patch)
treee5e428e9cddd03bf29bfcbc29704706c847b87c6 /cleopatre/application/spidnetsnmp/testing
parentaa4a270c0ae90c19db2a959e011817c4a949efbe (diff)
[CLEO][APP] spidnetsnmp sources added to cleopatre/application
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@5482 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cleopatre/application/spidnetsnmp/testing')
-rw-r--r--cleopatre/application/spidnetsnmp/testing/Makefile.in89
-rw-r--r--cleopatre/application/spidnetsnmp/testing/README21
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/RUNTESTS400
-rw-r--r--cleopatre/application/spidnetsnmp/testing/T.c182
-rw-r--r--cleopatre/application/spidnetsnmp/testing/T2.sh32
-rw-r--r--cleopatre/application/spidnetsnmp/testing/TESTCONF.sh173
-rw-r--r--cleopatre/application/spidnetsnmp/testing/data.keychange-md526
-rw-r--r--cleopatre/application/spidnetsnmp/testing/data.keychange-sha126
-rw-r--r--cleopatre/application/spidnetsnmp/testing/data.keychange-sha1-des26
-rw-r--r--cleopatre/application/spidnetsnmp/testing/data.kul-md58
-rw-r--r--cleopatre/application/spidnetsnmp/testing/data.kul-sha18
-rw-r--r--cleopatre/application/spidnetsnmp/testing/etimetest.c423
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/eval_oneprogram.sh138
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/eval_onescript.sh36
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/eval_suite.sh212
-rw-r--r--cleopatre/application/spidnetsnmp/testing/eval_testlist5
-rw-r--r--cleopatre/application/spidnetsnmp/testing/eval_tools.sh578
-rw-r--r--cleopatre/application/spidnetsnmp/testing/keymanagetest.c651
-rw-r--r--cleopatre/application/spidnetsnmp/testing/misctest.c266
-rw-r--r--cleopatre/application/spidnetsnmp/testing/rfc1213/README25
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/rfc1213/run58
-rw-r--r--cleopatre/application/spidnetsnmp/testing/rfc1213/snmpfun.sh78
-rw-r--r--cleopatre/application/spidnetsnmp/testing/rfc1213/test_fun68
-rw-r--r--cleopatre/application/spidnetsnmp/testing/rfc1213/testmib1.sh448
-rw-r--r--cleopatre/application/spidnetsnmp/testing/rfc1213/testmib2.sh447
-rw-r--r--cleopatre/application/spidnetsnmp/testing/rfc1213/testmib3.sh448
-rw-r--r--cleopatre/application/spidnetsnmp/testing/scapitest.c489
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/test_keychange.sh71
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/test_kul.sh78
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Sv1config4
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Sv2cconfig4
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Sv3config44
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigagent23
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigbase94
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigtrapd19
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Sv3vacmconfig28
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Svacmconfig38
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/Svanyconfig26
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T001snmpv1get37
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T014snmpv2cget24
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T015snmpv2cgetnext25
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T0160snmpv2cbulkget40
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T016snmpv2cgetfail29
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T017snmpv2ctov1getfail30
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T018snmpv1tov2cgetfail26
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T019snmpv2cnosuch25
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T020snmpv3get24
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T021snmpv3getnext24
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T0220snmpv3bulkget39
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T022snmpv3getMD525
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5AES29
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5DES28
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T024snmpv3getSHA125
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T025snmpv3getSHADES28
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T026snmpv3getSHAAES28
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T028snmpv3getfail22
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T030snmpv3usercreation114
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T035snmpv3trapdusermgmt124
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3inform25
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informauth25
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informpriv28
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T050snmpv3trap36
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T051snmpv2ctrap24
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T052snmpv2cinform24
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T053agentv1trap33
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T054agentv2ctrap33
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T055agentv1mintrap33
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T056agentv2cmintrap34
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest28
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest228
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest328
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T058agentauthtrap36
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T059trapdtraphandle48
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T060trapdperl50
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T061agentperl94
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T065agentextend47
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T100agenthup36
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T110agentxget59
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T111agentxset76
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T112agentxsetfail70
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T113agentxtrap78
-rwxr-xr-xcleopatre/application/spidnetsnmp/testing/tests/T115agentxperl133
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T120proxyget64
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T121proxyset81
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T122proxysetfail81
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T130snmpv1vacmget31
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T131snmpv2cvacmget35
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T132snmpv3vacmget31
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T140snmpv1vacmgetfail35
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T141snmpv2cvacmgetfail45
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T142snmpv3vacmgetfail32
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T150solarishostcpu31
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T151solarishostdisk31
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T152hostuptime27
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T153solarisswap32
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T160snmpnetstat55
-rw-r--r--cleopatre/application/spidnetsnmp/testing/tests/T200snmpv2cwalkall38
97 files changed, 8291 insertions, 0 deletions
diff --git a/cleopatre/application/spidnetsnmp/testing/Makefile.in b/cleopatre/application/spidnetsnmp/testing/Makefile.in
new file mode 100644
index 0000000000..7b8a0055d2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/Makefile.in
@@ -0,0 +1,89 @@
+#
+# Makefile for testing
+#
+
+# use GNU vpath, if available, to only set a path for source and headers
+# VPATH will pick up objects too, which is bad if you are sharing a
+# source dir...
+@GNU_vpath@ %.h $(srcdir)
+@GNU_vpath@ %.c $(srcdir)
+# fallback to regular VPATH for non-gnu...
+@NON_GNU_VPATH@ $(srcdir)
+
+#TARG = etest ktest misctest stest
+
+USELIBS = ../snmplib/libsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
+LIBS = -L../snmplib $(CC_RUNTIME_ARG) -lsnmp @LIBS@
+
+PARSEOBJS =
+
+CPPFLAGS = $(SNMPLIB_INCLUDES) @CPPFLAGS@
+CC = @CC@ $(CPPFLAGS)
+
+all: $(TARG)
+
+test:
+ $(srcdir)/RUNTESTS -a -D `pwd`/.. $(TESTOPTS)
+
+test-mibs:
+ cd $(srcdir)/rfc1213 ; ./run
+
+etest: etimetest.o $(PARSEOBJS) $(USELIBS)
+ ${CC} -o $@ etimetest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS}
+
+ktest: keymanagetest.o $(PARSEOBJS) $(USELIBS)
+ ${CC} -o $@ keymanagetest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS}
+
+misctest: misctest.o $(PARSEOBJS) $(USELIBS)
+ ${CC} -o $@ misctest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS}
+
+stest: scapitest.o $(PARSEOBJS) $(USELIBS)
+ ${CC} -o $@ scapitest.o $(PARSEOBJS) ${LDFLAGS} ${LIBS}
+
+clean: testclean
+ rm -f *.o core *.core $(TARG)
+
+testclean:
+ -rm -fr /tmp/snmp-test*
+
+install: installdirs $(TARG)
+ @for i in $(TARG) ; \
+ do $(INSTALL) $$i $(INSTALL_PREFIX)$(bindir) ; \
+ echo "install: installed $$i in $(INSTALL_PREFIX)$(bindir)" ; \
+ done
+
+installdirs:
+ @$(SHELL) $(srcdir)/../mkinstalldirs $(INSTALL_PREFIX)$(snmplibdir) $(INSTALL_PREFIX)$(bindir)
+
+dependlocal:
+ makedepend $(CPPFLAGS) -o.lo $(srcdir)/*.c
+
+depend: dependlocal
+
+nosysdepend:
+ makedepend $(CPPFLAGS) -o.lo *.c
+ $(PERL) -n -i.bak $(top_srcdir)/makenosysdepend.pl Makefile
+
+makefileindepend: nosysdepend
+ $(PERL) $(top_srcdir)/makefileindepend.pl
+
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+
+etimetest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+etimetest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/lcd_time.h
+etimetest.lo: ../snmplib/snmp_api.h ../snmplib/snmp_debug.h ../snmplib/tools.h
+etimetest.lo: ../s/sysv.h
+keymanagetest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+keymanagetest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/keytools.h
+keymanagetest.lo: ../snmplib/scapi.h ../snmplib/snmp_api.h ../snmplib/tools.h
+keymanagetest.lo: ../snmplib/transform_oids.h ../s/sysv.h
+misctest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+misctest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/snmp_api.h
+misctest.lo: ../snmplib/tools.h ../snmplib/transform_oids.h ../s/sysv.h
+scapitest.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h
+scapitest.lo: ../snmplib/asn1.h ../snmplib/callback.h ../snmplib/keytools.h
+scapitest.lo: ../snmplib/scapi.h ../snmplib/snmp_api.h ../snmplib/tools.h
+scapitest.lo: ../snmplib/transform_oids.h ../s/sysv.h
+T.lo: ../config.h ../m/generic.h ../s/generic.h ../s/linux.h ../s/sysv.h
diff --git a/cleopatre/application/spidnetsnmp/testing/README b/cleopatre/application/spidnetsnmp/testing/README
new file mode 100644
index 0000000000..99cb3a0f57
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/README
@@ -0,0 +1,21 @@
+The RUNTESTS script is the wrapper around all the tests. To run the
+tests, simply run "./RUNTESTS". The important arguments for RUNTESTS
+accepts (from ./RUNTESTS -h):
+
+Usage: RUNTESTS [-a] [-S SLEEPTIME] [-h] [-i] [-v] [-V] [-s]
+ [-T TESTNUMS] [-D bindir] [-S seconds] [-P <udp|tcp|udp6|tcp6|unix>]"
+
+ -a run all tests.
+ -T NUMS run particular tests (command separated list of numbers)
+ -i run interactively
+ -v be verbose
+ -V be very verbose
+ -S TIME TIME should be used as the timeout when waiting for a
+ response from the agent.
+ -A FLAGS Extra flags to pass to the agent.
+ -t FLAGS Extra flags to pass to the trapd.
+ -s Don't erase the runtime data directory for successful tests
+ -XM Don't set MIBDIRS environment unless absolutely necessary
+ -x Turn on SH output debugging for tests.
+ -P TRANS Specify on which transport domain to run the tests. Default is udp.
+ udp,tcp,udp6,tcp6,unix are available.
diff --git a/cleopatre/application/spidnetsnmp/testing/RUNTESTS b/cleopatre/application/spidnetsnmp/testing/RUNTESTS
new file mode 100755
index 0000000000..c39e761591
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/RUNTESTS
@@ -0,0 +1,400 @@
+#!/bin/sh
+#
+# RUNTESTS [-h]...
+#
+# RETURNS: Number of failed tests.
+#
+# CALLS: eval_oneprogram.sh [-h][-lk] <program>
+#
+#
+
+#
+# Suggested improvement(s):
+# Run a given test against a running agent.
+#
+# Variables: (* = exported)
+# *SNMP_BASEDIR: the source base directory for tests
+# *SNMP_UPDIR: directory above where the test binaries live (-D option)
+# *SNMP_PATH ## yes, PATH is already setup
+# *SNMP_VERBOSE ## 0=silent, 1=warnings, 2=more
+
+# Usage mess. (No, it works.)
+#
+
+usage() {
+ cat << BLIK
+
+Usage: `basename $0` [-a] [-S SLEEPTIME] [-h] [-i] [-v] [-V] [-s] [-XM]
+ [-T TESTNUMS] [-D bindir] [-S seconds] [-P <udp|tcp|udp6|tcp6|unix>]
+
+ -a run all tests.
+ -T NUMS run particular tests (command separated list of numbers)
+ -i run interactively
+ -v be verbose
+ -V be very verbose
+ -S TIME TIME should be used as the timeout when waiting for a
+ response from the agent.
+ -A FLAGS Extra flags to pass to the agent.
+ -t FLAGS Extra flags to pass to the trapd.
+ -s Don't erase the runtime data directory for successful tests
+ -XM Don't set MIBDIRS environment unless absolutely necessary
+ -x Turn on SH output debugging for tests.
+ -P TRANS Specify on which transport domain to run the tests.Default is udp.
+ -p prefix Specify test case prefix. Options are [T|V]. Default is T
+
+BLIK
+ exit 0
+}
+
+trap "exit 1;" 1 2 3 9 13 15 17
+
+SNMP_BASEDIR=`dirname $0`
+SNMP_PREFER_NEAR_MIBS=1 ## prefer MIB files found in source hierarchy
+export SNMP_PREFER_NEAR_MIBS
+SNMP_TEST_PREFIX=${SNMP_TEST_PREFIX:=T}
+export SNMP_TEST_PREFIX
+
+### Check for the configuration script.
+##if [ ! -s "${SNMP_BASEDIR}/TESTCONF.sh" ] ; then
+## echo "No TESTCONF.sh in \"$SNMP_BASEDIR\" ; exiting"
+## exit 0
+##fi
+
+ORIGDIR=`pwd` ## this script may be invoked with relative path
+SNMP_UPDIR=.. ## building from the source tree
+interactive=no
+SNMP_VERBOSE=${SNMP_VERBOSE:=0}
+SNMP_SLEEP=${SNMP_SLEEP:=1} ## default seconds to sleep
+SH_DEBUG=0
+USE_TEST_NUMS=0
+
+while [ -n "$1" ]; do
+ case "$1" in
+ -h)
+ usage
+ exit
+ ;;
+
+ -i)
+ interactive="yes"
+ ;;
+ -v)
+ SNMP_VERBOSE=1
+ ;;
+ -V)
+ SNMP_VERBOSE=2
+ ;;
+ -s)
+ SNMP_SAVE_TMPDIR="yes"
+ export SNMP_SAVE_TMPDIR
+ ;;
+ -D)
+ shift
+ SNMP_UPDIR="$1"
+ ;;
+ -p)
+ shift
+ SNMP_TEST_PREFIX="$1"
+ ;;
+ -P)
+ shift
+ SNMP_TRANSPORT_SPEC="$1"
+ export SNMP_TRANSPORT_SPEC
+ if [ "x$SNMP_TRANSPORT_SPEC" = "xunix" ];then
+ SNMP_SNMPD_PORT="/var/tmp/unixsnmpd"
+ SNMP_SNMPTRAPD_PORT="/var/tmp/unixsnmptrapd"
+ SNMP_TEST_DEST=""
+ export SNMP_SNMPD_PORT
+ export SNMP_SNMPTRAPD_PORT
+ export SNMP_TEST_DEST
+ fi
+ ;;
+ -T)
+ shift
+ test_nums=`echo $1 | sed 's/,/ /g'`
+ ;;
+ -a)
+ test_nums="all"
+ ;;
+
+ -A)
+ shift
+ AGENT_FLAGS="$1"
+ export AGENT_FLAGS
+ ;;
+ -S)
+ shift
+ SNMP_SLEEP="$1"
+ ;;
+ -t)
+ shift
+ TRAPD_FLAGS="$1"
+ export TRAPD_FLAGS
+ ;;
+
+ -x)
+ SH_DEBUG=1
+ ;;
+
+ -XM)
+ SNMP_PREFER_NEAR_MIBS=0
+ ;;
+
+ -n)
+ USE_TEST_NUMS=1
+ ;;
+ esac
+
+ shift
+done
+
+export SNMP_SLEEP
+
+# Make sure MinGW / MSYS users have the kill.exe program to stop the agent and snmptrapd
+if [ "x$OSTYPE" = "xmsys" ]; then
+ kill_command=`which kill.exe`
+ if [ "x$kill_command" = "x" ]; then
+ echo Could not find kill.exe. Aborting tests
+ echo Kill.exe is available from the Support Tools package availble on the
+ echo Windows 2000 CDROM under SUPPORT\\TOOLS.
+ exit
+ fi
+fi
+
+# Find executables in source first, then build, then existing PATH.
+## Add to PATH if a binary is found.
+
+cd $SNMP_UPDIR
+SNMP_UPDIR=`pwd`
+bf=snmpget
+if [ -x "$bf" ] ; then
+ PATH=$SNMP_UPDIR:$PATH
+else
+ for dd in apps bin ; do
+ bf=$dd/snmpget
+ if [ -x "$bf" ] ; then
+ PATH=$SNMP_UPDIR/$dd:$PATH
+ break
+ fi
+ done
+fi
+for dd in agent bin sbin ; do
+ bf=$dd/snmpd
+ if [ -x "$bf" ] ; then
+ PATH=$SNMP_UPDIR/$dd:$PATH
+ break
+ fi
+done
+
+bf=include/net-snmp/net-snmp-config.h
+if [ ! -s "$bf" ] ; then
+ echo "No \"$bf\" in $SNMP_UPDIR . Some tests will be skipped"
+fi
+unset bf
+
+# Run from the test scripts directory.
+cd $ORIGDIR ; cd ${SNMP_BASEDIR}
+SNMP_BASEDIR=`pwd`
+
+# Setup for the next test run.
+rm -f core tests/core
+
+PATH=${SNMP_BASEDIR}:$PATH
+SNMP_PATH=yes
+
+export PATH
+export SNMP_BASEDIR
+export SNMP_PATH
+export SNMP_UPDIR
+export SNMP_VERBOSE
+
+WHICH=which
+$WHICH $0 > /dev/null 2>&1
+if [ $? -ne 0 ] ; then
+ WHICH=type
+fi
+
+for needed in snmpd snmpget snmpgetnext; do
+ $WHICH $needed > /dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ echo "No $needed found. Exiting"
+ exit 1
+ fi
+done
+
+#
+# Distinguished expectations.
+#
+if [ $SNMP_VERBOSE -gt 0 ]; then
+ echo ${SNMP_UPDIR}/testing
+ echo path is $PATH
+ echo top of build is $SNMP_UPDIR
+ echo source testing is $SNMP_BASEDIR
+ $WHICH snmpusm
+fi
+
+#
+# Source the testing configuration file
+#
+
+. TESTCONF.sh
+
+# Hack: the above created a directory, now we have to nuke it and
+# forget about it... All for the convenience of the test writer.
+rm -fR $SNMP_TMPDIR
+unset SNMP_TMPDIR
+export SNMP_TMPDIR
+
+if [ "x$SNMP_PREFER_NEAR_MIBS" = "x0" ]; then
+ # try the compiled MIBDIRS directory first.
+ # if MIB files are not found, fallback to the source base
+
+ snmptranslate -On -IR sysDescr > /dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ if [ "x$MIBDIRS" = "x" ]; then
+ MIBDIRS=${SNMP_BASEDIR}/../mibs
+ export MIBDIRS
+ fi
+ fi
+ snmptranslate -On -IR sysDescr > /dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ echo "Could not resolve sysDescr in $MIBDIRS. Exiting"
+ exit 1
+ fi
+fi ## SNMP_PREFER_NEAR_MIBS
+
+#
+# Switch to the testing directory, for ease of the client test packages.
+#
+cd ./tests
+
+#------------------------------------ -o-
+# Globals.
+#
+PROGRAM=
+ARGUMENTS="$*"
+
+TMPFILE=$SNMP_TMPDIR/eval_suite.sh$$
+
+testname=
+
+success_count=0
+failed_count=0
+
+if [ "x$do_tests" = "x" ]; then
+ #
+ # List the tests in question
+ #
+ num=0
+ for testfile in $SNMP_TEST_PREFIX*; do
+ case $testfile in
+ # Skip backup files, and the like.
+ *~) ;;
+ *.bak) ;;
+ *.orig) ;;
+ *.rej) ;;
+
+ # Do the rest
+ *)
+ num=`expr $num + 1`
+ if [ "x$interactive" != "xyes" -a "x$test_nums" = "x" ]; then
+ eval_onescript.sh $testfile $num "yes"
+ fi
+ all_tests="$all_tests $num"
+ all_files="$all_files $testfile"
+ ;;
+ esac
+ done
+
+ #
+ # TODO: allow user to interactively pick the list of tests to run.
+ #
+
+ if [ "x$interactive" != "xyes" ]; then
+ if [ "x$test_nums" = "x" ]; then
+ ECHO "Enter test numbers [all]: "
+ read inp
+ else
+ if [ "x$test_nums" = "xall" ]; then
+ inp=""
+ else
+ inp="$test_nums"
+ fi
+ fi
+ if [ "x$inp" = "x" ]; then
+ do_tests="$all_files"
+ else
+ a=1
+ set $all_files
+ while [ $a -le $num ]; do
+ if echo " $inp " | grep " $a " > /dev/null; then
+ do_tests="$do_tests $1"
+ if [ "x$test_nums" = "x" ] ; then
+ test_nums=$a
+ fi
+ fi
+ shift
+ a=`expr $a + 1`
+ done
+ fi
+ fi
+
+ #echo Starting: Running tests $do_tests
+fi
+
+#
+# Run the tests
+#
+if [ "x$test_nums" = "xall" -o "x$test_nums" = "x" ] ; then
+ num=1
+else
+ num="$test_nums"
+fi
+cntr=0
+for testfile in $do_tests; do
+ dothisone="yes"
+ if [ $USE_TEST_NUMS = 1 ] ; then
+ num=`echo $testfile | sed -e 's/^T//;s/[a-zA-Z].*//;'`
+ else
+ id_x=0
+ for itest in $inp; do
+ if [ "$cntr" = "$id_x" ] ; then
+ num="$itest"
+ fi
+ id_x=`expr $id_x + 1`
+ done
+ fi
+ if [ "x$interactive" = "xyes" ]; then
+
+ if [ $SH_DEBUG = 1 ] ; then
+ sh -x "${SNMP_BASEDIR}/eval_onescript.sh" $testfile $num "yes"
+ else
+ eval_onescript.sh $testfile $num "yes"
+ fi
+
+ ECHO " Run test #$num (y/n) [y]? "
+ read inp2
+ if [ "x$inp2" = "xn" ]; then
+ dothisone=no
+ fi
+ fi
+
+ if [ "x$dothisone" = "xyes" ]; then
+ if [ $SH_DEBUG = 1 ] ; then
+ sh -x "${SNMP_BASEDIR}/eval_onescript.sh" $testfile $num "no"
+ else
+ eval_onescript.sh $testfile $num "no"
+ fi
+ if [ $? = 0 ]; then
+ success_count=`expr $success_count + 1`
+ else
+ failed_count=`expr $failed_count + 1`
+ fi
+ fi
+ num=`expr $num + 1`
+ cntr=`expr $cntr + 1`
+done
+
+echo Summary: $success_count / `expr $failed_count + $success_count` succeeded.
+
+exit $failed_count
diff --git a/cleopatre/application/spidnetsnmp/testing/T.c b/cleopatre/application/spidnetsnmp/testing/T.c
new file mode 100644
index 0000000000..da483a15f2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/T.c
@@ -0,0 +1,182 @@
+/*
+ * T.c
+ *
+ * Expected SUCCESSes for all tests: FIX [+ FIX ...]
+ * (List number of lines containing the
+ * string "SUCCESS" that are expected
+ * to be printed to stdout.)
+ *
+ * Returns:
+ * Number of FAILUREs.
+ *
+ * FIX Short test description/table of contents. SUCCESSes: FIX
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/*
+ * #include ...
+ */
+
+extern char *optarg;
+extern int optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char *local_progname;
+
+#define USAGE "Usage: %s [-h][-aS]"
+#define OPTIONLIST "ahS"
+
+int doalltests = 0, dosomething = 0;
+
+#define ALLOPTIONS (doalltests + dosomething)
+
+
+
+#define LOCAL_MAXBUF (1024 * 8)
+#define NL "\n"
+
+#define OUTPUT(o) fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s) \
+{ \
+ if (!failcount) \
+ fprintf(stdout, "\nSUCCESS: %s\n", s); \
+}
+
+#define FAILED(e, f) \
+{ \
+ if (e != SNMPERR_SUCCESS) { \
+ fprintf(stdout, "\nFAILED: %s\n", f); \
+ failcount += 1; \
+ } \
+}
+
+
+
+
+
+/*
+ * Prototypes.
+ */
+void usage(FILE * ofp);
+
+int test_dosomething(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+ char ch;
+
+ local_progname = argv[0];
+
+ EM(-1); /* */
+
+ /*
+ * Parse.
+ */
+ while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+ switch (ch) {
+ case 'a':
+ doalltests = 1;
+ break;
+ case 'S':
+ dosomething = 1;
+ break;
+ case 'h':
+ rval = 0;
+ default:
+ usage(stdout);
+ exit(rval);
+ }
+
+ argc -= 1;
+ argv += 1;
+ if (optarg) {
+ argc -= 1;
+ argv += 1;
+ optarg = NULL;
+ }
+ optind = 1;
+ } /* endwhile getopt */
+
+ if ((argc > 1)) {
+ usage(stdout);
+ exit(1000);
+
+ } else if (ALLOPTIONS != 1) {
+ usage(stdout);
+ exit(1000);
+ }
+
+
+ /*
+ * Test stuff.
+ */
+ if (dosomething || doalltests) {
+ failcount += test_dosomething();
+ }
+
+
+ /*
+ * Cleanup.
+ */
+ return failcount;
+
+} /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+ fprintf(ofp,
+ USAGE
+ "" NL
+ " -a All tests." NL
+ " -S Test something." NL
+ " -h Help." NL "" NL, local_progname);
+
+} /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+#endif /* EXAMPLE */
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test template.
+ */
+int
+test_dosomething(void)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+
+ EM0(1, "UNIMPLEMENTED"); /* EM(1); /* */
+
+ test_dosomething_quit:
+ return failcount;
+
+} /* end test_dosomething() */
diff --git a/cleopatre/application/spidnetsnmp/testing/T2.sh b/cleopatre/application/spidnetsnmp/testing/T2.sh
new file mode 100644
index 0000000000..d0a51a8c15
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/T2.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# T.sh
+#
+# FIX Short description.
+#
+
+. eval_tools.sh
+
+HEADER a short description of your test
+
+#------------------------------------ -o-
+# Test.
+#
+
+# Start the agent if needed (make sure it stop it below)
+STARTAGENT
+
+CAPTURE "<executable_with_arguments:_stores_stdout/stderr_for_use_later>"
+
+CHECKEXACT "<string_to_look_for_an_exact_match_of_in_the_CAPTUREd_file_output>"
+[ $? -eq 1 ]
+FAILED $? "<diagnostic_label>"
+
+#------------------------------------ -o-
+# Cleanup, exit.
+#
+
+# Stop the agent if necessary
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/TESTCONF.sh b/cleopatre/application/spidnetsnmp/testing/TESTCONF.sh
new file mode 100644
index 0000000000..625404c9a8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/TESTCONF.sh
@@ -0,0 +1,173 @@
+#! /bin/sh -f
+
+#
+# Variables: (* = exported)
+# *SNMP_TMPDIR: place to put files used in testing.
+# SNMP_TESTDIR: where the test scripts are kept.
+# *SNMP_PERSISTENT_FILE: where to store the agent's persistent information
+# (XXX: this should be specific to just the agent)
+
+#
+# Only allow ourselves to be eval'ed once
+#
+if [ "x$TESTCONF_SH_EVALED" != "xyes" ]; then
+ TESTCONF_SH_EVALED=yes
+
+#
+# set cpu and memory limits to prevent major damage
+#
+# defaults: 1h CPU, 500MB VMEM
+#
+[ "x$SNMP_LIMIT_VMEM" = "x" ] && SNMP_LIMIT_VMEM=512000
+[ "x$SNMP_LIMIT_CPU" = "x" ] && SNMP_LIMIT_CPU=3600
+# ulimit will fail if existing limit is lower -- ignore because it's ok
+ulimit -S -t $SNMP_LIMIT_CPU 2>/dev/null
+# not all sh-alikes support "ulimit -v" -- play safe
+[ "x$BASH_VERSION" != "x" ] && ulimit -S -v $SNMP_LIMIT_VMEM 2>/dev/null
+
+#
+# Set up an NL suppressing echo command
+#
+case "`echo 'x\c'`" in
+ 'x\c')
+ ECHO() { echo -n $*; }
+ ;;
+ x)
+ ECHO() { echo $*\\c; }
+ ;;
+ *)
+ echo "I don't understand your echo command ..."
+ exit 1
+ ;;
+esac
+#
+# how verbose should we be (0 or 1)
+#
+if [ "x$SNMP_VERBOSE" = "x" ]; then
+ SNMP_VERBOSE=0
+ export SNMP_VERBOSE
+fi
+
+if [ "x$MIBDIRS" = "x" ]; then
+ if [ "x$SNMP_PREFER_NEAR_MIBS" = "x1" ]; then
+ MIBDIRS=${SNMP_BASEDIR}/../mibs
+ export MIBDIRS
+ fi
+fi
+
+# Set up the path to the programs we want to use.
+if [ "x$SNMP_PATH" = "x" ]; then
+ PATH=../agent:../apps:../../agent:../../apps:$PATH
+ export PATH
+ SNMP_PATH=yes
+ export SNMP_PATH
+fi
+
+
+# Set up temporary directory
+if [ "x$SNMP_TMPDIR" = "x" -a "x$SNMP_HEADERONLY" != "xyes" ]; then
+ if [ "x$testnum" = "x" ] ; then
+ testnum=1
+ fi
+ SNMP_TMPDIR="/tmp/snmp-test-$testnum-$$"
+ export SNMP_TMPDIR
+ if [ -d $SNMP_TMPDIR ]; then
+ echo "$0: ERROR: $SNMP_TMPDIR already existed."
+ exit 1;
+ fi
+ SNMP_TMP_PERSISTENTDIR=$SNMP_TMPDIR/persist
+ export SNMP_TMP_PERSISTENTDIR
+ mkdir $SNMP_TMPDIR
+ mkdir $SNMP_TMP_PERSISTENTDIR
+fi
+
+if [ "x$SNMP_SAVE_TMPDIR" = "x" ]; then
+ SNMP_SAVE_TMPDIR="no"
+ export SNMP_SAVE_TMPDIR
+fi
+
+SNMP_PERLPROG="`$SNMP_UPDIR/net-snmp-config --perlprog`"
+SNMP_TESTDIR="$SNMP_BASEDIR/tests"
+SNMP_CONFIG_FILE="$SNMP_TMPDIR/snmpd.conf"
+SNMPTRAPD_CONFIG_FILE="$SNMP_TMPDIR/snmptrapd.conf"
+AGENTX_CONFIG_FILE="$SNMP_TMPDIR/agentx.conf"
+SNMP_SNMPTRAPD_LOG_FILE="$SNMP_TMPDIR/snmptrapd.log"
+SNMP_SNMPTRAPD_PID_FILE="$SNMP_TMPDIR/snmptrapd.pid"
+SNMP_SNMPD_PID_FILE="$SNMP_TMPDIR/snmpd.pid"
+SNMP_SNMPD_LOG_FILE="$SNMP_TMPDIR/snmpd.log"
+SNMP_AGENTX_PID_FILE="$SNMP_TMPDIR/agentx.pid"
+SNMP_AGENTX_LOG_FILE="$SNMP_TMPDIR/agentx.log"
+SNMPCONFPATH=${SNMP_TMPDIR}:${SNMP_TMP_PERSISTENTDIR}
+export SNMPCONFPATH
+SNMP_PERSISTENT_DIR=$SNMP_TMP_PERSISTENTDIR
+export SNMP_PERSISTENT_DIR
+#SNMP_PERSISTENT_FILE="$SNMP_TMP_PERSISTENTDIR/persistent-store.conf"
+#export SNMP_PERSISTENT_FILE
+
+## Setup default flags and ports iff not done
+if [ "x$SNMP_FLAGS" = "x" ]; then
+ SNMP_FLAGS="-d"
+fi
+if test -x /bin/netstat ; then
+ NETSTAT=/bin/netstat
+elif test -x /usr/bin/netstat ; then
+ NETSTAT=/usr/bin/netstat
+elif test -x /usr/sbin/netstat ; then
+ # e.g. Tru64 Unix
+ NETSTAT=/usr/sbin/netstat
+elif test -x /usr/etc/netstat ; then
+ # e.g. IRIX
+ NETSTAT=/usr/etc/netstat
+else
+ NETSTAT=""
+fi
+
+PROBE_FOR_PORT() {
+ BASE_PORT=$1
+ MAX_RETRIES=10
+ if test -x "$NETSTAT" ; then
+ if test -z "$RANDOM"; then
+ RANDOM=2
+ fi
+ while :
+ do
+ BASE_PORT=`expr $BASE_PORT + \( $RANDOM % 100 \)`
+ IN_USE=`$NETSTAT -a -n 2>/dev/null | grep "[\.:]$BASE_PORT "`
+ if [ $? -ne 0 ]; then
+ echo "$BASE_PORT"
+ break
+ fi
+ MAX_RETRIES=`expr $MAX_RETRIES - 1`
+ if [ $MAX_RETRIES -eq 0 ]; then
+ echo "ERROR: Could not find available port." >&2
+ echo "NOPORT"
+ exit 255
+ fi
+ done
+ fi
+}
+
+if [ "x$SNMP_SNMPD_PORT" = "x" ]; then
+ SNMP_SNMPD_PORT=`PROBE_FOR_PORT 8765`
+fi
+if [ "x$SNMP_SNMPTRAPD_PORT" = "x" ]; then
+ SNMP_SNMPTRAPD_PORT=`PROBE_FOR_PORT 5678`
+fi
+if [ "x$SNMP_AGENTX_PORT" = "x" ]; then
+ SNMP_AGENTX_PORT=`PROBE_FOR_PORT 7676`
+fi
+if [ "x$SNMP_TRANSPORT_SPEC" = "x" ];then
+ SNMP_TRANSPORT_SPEC="udp"
+fi
+if [ "x$SNMP_TEST_DEST" = "x" -a $SNMP_TRANSPORT_SPEC != "unix" ];then
+ SNMP_TEST_DEST="localhost:"
+fi
+export SNMP_FLAGS SNMP_SNMPD_PORT SNMP_SNMPTRAPD_PORT
+
+# Make sure the agent doesn't parse any config file but what we give it.
+# this is mainly to protect against a broken agent that doesn't
+# properly handle combinations of -c and -C. (since I've broke it before).
+#SNMPCONFPATH="$SNMP_TMPDIR/does-not-exist"
+#export SNMPCONFPATH
+
+fi # Only allow ourselves to be eval'ed once
diff --git a/cleopatre/application/spidnetsnmp/testing/data.keychange-md5 b/cleopatre/application/spidnetsnmp/testing/data.keychange-md5
new file mode 100644
index 0000000000..2e24c4a39e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/data.keychange-md5
@@ -0,0 +1,26 @@
+0x526f5eed9fcce26f8964c2930787d82b # old kul
+0x87021d7bd9d101ba05ea6e3bf9d9bd4a # new kul
+000000000000000000000000000000008805615141676cc9196174e742a32551 # keychange string -- auth/privacy
+
+
+ # # # #
+
+#
+# Following data exerpted from:
+#
+# Message-Id: <199809282003.QAA27494@relay.hq.tis.com>
+# Date: Mon, 28 Sep 98 21:57:48 DST
+# From: "Bert Wijnen" <WIJNEN@vnet.ibm.com>
+# To: snmpv3@tis.com
+# Subject: suggested new appendix section A.5 for RFC2274
+#
+maplesyrup # old passphrase
+0x000000000000000000000002 # engineID
+
+newsyrup # new passphrase
+01add273107c4e596b4b00f82b1d42a7 # new Ku
+87021d7bd9d101ba05ea6e3bf9d9bd4a # new kul
+
+00000000000000000000000000000000 # random delta
+
+000000000000000000000000000000008805615141676cc9196174e742a32551 # keychange string -- auth/privacy
diff --git a/cleopatre/application/spidnetsnmp/testing/data.keychange-sha1 b/cleopatre/application/spidnetsnmp/testing/data.keychange-sha1
new file mode 100644
index 0000000000..4d97749ac3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/data.keychange-sha1
@@ -0,0 +1,26 @@
+0x6695febc9288e36282235fc7151f128497b38f3f # old kul -- for auth
+0x78e2dcce79d59403b58c1bbaa5bff46391f1cd25 # new kul -- for auth
+00000000000000000000000000000000000000009c1017f4fd483d2de8d5fadbf84392cb06457051 # keychange string -- auth
+
+
+ # # # #
+
+#
+# Following data exerpted from:
+#
+# Message-Id: <199809282003.QAA27494@relay.hq.tis.com>
+# Date: Mon, 28 Sep 98 21:57:48 DST
+# From: "Bert Wijnen" <WIJNEN@vnet.ibm.com>
+# To: snmpv3@tis.com
+# Subject: suggested new appendix section A.5 for RFC2274
+#
+maplesyrup # old passphrase
+0x000000000000000000000002 # engineID
+
+newsyrup # new passphrase
+3a51a6d736aa347b83dc4a87e3e55ee4d698ac71 # new Ku -- auth
+78e2dcce79d59403b58c1bbaa5bff46391f1cd25 # new kul -- auth
+
+0000000000000000000000000000000000000000 # random delta
+
+00000000000000000000000000000000000000009c1017f4fd483d2de8d5fadbf84392cb06457051 # keychange string -- auth
diff --git a/cleopatre/application/spidnetsnmp/testing/data.keychange-sha1-des b/cleopatre/application/spidnetsnmp/testing/data.keychange-sha1-des
new file mode 100644
index 0000000000..67719d5f5c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/data.keychange-sha1-des
@@ -0,0 +1,26 @@
+0x6695febc9288e36282235fc7151f1284 # old kul -- privacy
+0x78e2dcce79d59403b58c1bbaa5bff463 # new kul -- privacy
+000000000000000000000000000000007ef8d8a4c9cdb26b47591cd852ff88b5 # keychange string -- privacy
+
+
+ # # # #
+
+#
+# Following data exerpted from:
+#
+# Message-Id: <199809282003.QAA27494@relay.hq.tis.com>
+# Date: Mon, 28 Sep 98 21:57:48 DST
+# From: "Bert Wijnen" <WIJNEN@vnet.ibm.com>
+# To: snmpv3@tis.com
+# Subject: suggested new appendix section A.5 for RFC2274
+#
+maplesyrup # old passphrase
+0x000000000000000000000002 # engineID
+
+newsyrup # new passphrase
+3a51a6d736aa347b83dc4a87e3e55ee4d698ac71 # new Ku -- privacy
+78e2dcce79d59403b58c1bbaa5bff463 # new kul -- privacy
+
+00000000000000000000000000000000 # random delta
+
+000000000000000000000000000000007ef8d8a4c9cdb26b47591cd852ff88b5 # keychange string -- privacy
diff --git a/cleopatre/application/spidnetsnmp/testing/data.kul-md5 b/cleopatre/application/spidnetsnmp/testing/data.kul-md5
new file mode 100644
index 0000000000..78e1e27345
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/data.kul-md5
@@ -0,0 +1,8 @@
+maplesyrup # passphrase
+9faf3283884e92834ebc9847d8edd963 # Ku
+0x000000000000000000000002 # engineID
+526f5eed9fcce26f8964c2930787d82b # kul
+
+#
+# Taken from <draft-ietf-snmpv3-usm-v2-01.txt>, Section A.3.
+#
diff --git a/cleopatre/application/spidnetsnmp/testing/data.kul-sha1 b/cleopatre/application/spidnetsnmp/testing/data.kul-sha1
new file mode 100644
index 0000000000..c827abda32
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/data.kul-sha1
@@ -0,0 +1,8 @@
+maplesyrup # passphrase
+9fb5cc0381497b3793528939ff788d5d79145211 # Ku
+0x000000000000000000000002 # engineID
+6695febc9288e36282235fc7151f128497b38f3f # kul
+
+#
+# Taken from <draft-ietf-snmpv3-usm-v2-01.txt>, Section A.3.
+#
diff --git a/cleopatre/application/spidnetsnmp/testing/etimetest.c b/cleopatre/application/spidnetsnmp/testing/etimetest.c
new file mode 100644
index 0000000000..35c74a6e5b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/etimetest.c
@@ -0,0 +1,423 @@
+/*
+ * etimetest.c
+ *
+ * Expected SUCCESSes for all tests: 3
+ *
+ * Returns:
+ * Number of FAILUREs.
+ *
+ * Test of hash_engineID(). SUCCESSes: 0
+ * Test of LCD Engine ID and Time List. SUCCESSes: 3
+ *
+ * FIX Devise a test for {set,get}_enginetime(..., FALSE).
+ */
+
+static char *rcsid = "$Id: etimetest.c 15220 2006-09-15 00:48:50Z tanders $"; /* */
+
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "tools.h"
+#include "lcd_time.h"
+#include "snmp_debug.h"
+#include "callback.h"
+
+static u_int dummy_etime, dummy_eboot; /* For ISENGINEKNOWN(). */
+
+
+#include <stdlib.h>
+
+extern char *optarg;
+extern int optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char *local_progname;
+
+#define USAGE "Usage: %s [-h][-s <seconds>][-aeH]"
+#define OPTIONLIST "aehHs:"
+
+int doalltests = 0, dohashindex = 0, doetimetest = 0;
+
+#define ALLOPTIONS (doalltests + dohashindex + doetimetest)
+
+
+
+#define LOCAL_MAXBUF (1024 * 8)
+#define NL "\n"
+
+#define OUTPUT(o) fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s) \
+{ \
+ if (!failcount) \
+ fprintf(stdout, "\nSUCCESS: %s\n", s); \
+}
+
+#define FAILED(e, f) \
+{ \
+ if (e != SNMPERR_SUCCESS) { \
+ fprintf(stdout, "\nFAILED: %s\n", f); \
+ failcount += 1; \
+ } \
+}
+
+
+
+/*
+ * Global variables.
+ */
+int sleeptime = 7;
+
+#define BLAT "alk;djf;an riu;alicenmrul;aiknglksajhe1 adcfalcenrco2"
+
+
+
+
+/*
+ * Prototypes.
+ */
+void usage(FILE * ofp);
+
+int test_etime(void);
+int test_hashindex(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+ char ch;
+
+ local_progname = argv[0];
+
+ /*
+ * Parse.
+ */
+ while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+ switch (ch) {
+ case 'a':
+ doalltests = 1;
+ break;
+ case 'e':
+ doetimetest = 1;
+ break;
+ case 'H':
+ dohashindex = 1;
+ break;
+ case 's':
+ sleeptime = atoi(optarg);
+ if (sleeptime < 0) {
+ usage(stderr);
+ exit(1000);
+ }
+ break;
+ break;
+ case 'h':
+ rval = 0;
+ default:
+ usage(stdout);
+ exit(rval);
+ }
+
+ argc -= 1;
+ argv += 1;
+ if (optarg) {
+ argc -= 1;
+ argv += 1;
+ optarg = NULL;
+ }
+ optind = 1;
+ } /* endwhile getopt */
+
+ if ((argc > 1)) {
+ usage(stdout);
+ exit(1000);
+
+ } else if (ALLOPTIONS != 1) {
+ usage(stdout);
+ exit(1000);
+ }
+
+
+ /*
+ * Test stuff.
+ */
+ rval = sc_init();
+ FAILED(rval, "sc_init()");
+
+
+ if (dohashindex || doalltests) {
+ failcount += test_hashindex();
+ }
+ if (doetimetest || doalltests) {
+ failcount += test_etime();
+ }
+
+
+ /*
+ * Cleanup.
+ */
+ rval = sc_shutdown(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+ NULL, NULL);
+ FAILED(rval, "sc_shutdown()");
+
+ return failcount;
+
+} /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+ fprintf(ofp,
+ USAGE
+ "" NL
+ " -a All tests." NL
+ " -e Exercise the list of enginetimes."
+ NL
+ " -h Help."
+ NL
+ " -H Test hash_engineID()."
+ NL
+ " -s <seconds> Seconds to pause. (Default: 0.)"
+ NL NL, local_progname);
+
+} /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test template.
+ */
+int
+test_dosomething(void)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+
+ test_dosomething_quit:
+ return failcount;
+
+} /* end test_dosomething() */
+#endif /* EXAMPLE */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_hashindex
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test hash_engineID().
+ */
+int
+test_hashindex(void)
+{
+ int /* rval = SNMPERR_SUCCESS, */
+ failcount = 0;
+ char *s;
+
+ OUTPUT("Visual spot check of hash index outputs. "
+ "(Success or failure not noted.)");
+
+ s = "A";
+ fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+ s = "BB";
+ fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+ s = "CCC";
+ fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+ s = "DDDD";
+ fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+ s = "EEEEE";
+ fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+ s = BLAT;
+ fprintf(stdout, "%s = %d\n", s, hash_engineID(s, strlen(s)));
+
+
+ OUTPUT("Visual spot check -- DONE.");
+
+ return failcount;
+
+} /* end test_hashindex() */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_etime
+ *
+ * Returns:
+ * Number of failures.
+ *
+ * Test of LCD Engine ID and Time List.
+ */
+int
+test_etime(void)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+ u_int etime, eboot;
+
+ /*
+ * ------------------------------------ -o-
+ */
+ OUTPUT("Query of empty list, two set actions.");
+
+
+ rval = ISENGINEKNOWN("A", 1);
+ if (rval == TRUE) {
+ FAILED(SNMPERR_GENERR, "Query of empty list returned TRUE.")
+ }
+
+
+ rval = set_enginetime("BB", 2, 2, 20, TRUE);
+ FAILED(rval, "set_enginetime()");
+
+
+ rval = set_enginetime("CCC", 3, 31, 90127, TRUE);
+ FAILED(rval, "set_enginetime()");
+
+
+ SUCCESS("Check of empty list, and two additions.");
+
+
+
+ /*
+ * ------------------------------------ -o-
+ */
+ OUTPUT("Add entries using macros, test for existence with macros.");
+
+
+ rval = ENSURE_ENGINE_RECORD("DDDD", 4);
+ FAILED(rval, "ENSURE_ENGINE_RECORD()");
+
+
+ rval = MAKENEW_ENGINE_RECORD("EEEEE", 5);
+ if (rval == SNMPERR_SUCCESS) {
+ FAILED(rval,
+ "MAKENEW_ENGINE_RECORD returned success for "
+ "missing record.");
+ }
+
+
+ rval = MAKENEW_ENGINE_RECORD("BB", 2);
+ FAILED(rval, "MAKENEW_ENGINE_RECORD().");
+
+
+ SUCCESS
+ ("Added entries with macros, tested for existence with macros.");
+
+
+
+ /*
+ * ------------------------------------ -o-
+ */
+ OUTPUT("Dump the list and then sleep.");
+
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+ dump_etimelist();
+#endif
+
+ fprintf(stdout, "\nSleeping for %d second%s... ",
+ sleeptime, (sleeptime == 1) ? "" : "s");
+ fflush(stdout);
+
+ sleep(sleeptime);
+ fprintf(stdout, "\n");
+
+
+
+ /*
+ * ------------------------------------ -o-
+ */
+ OUTPUT
+ ("Retrieve data from real/stubbed records, update real/stubbed.");
+
+
+
+ rval = get_enginetime("BB", 2, &eboot, &etime, TRUE);
+ FAILED(rval, "get_enginetime().");
+
+ fprintf(stdout, "BB = <%d,%d>\n", eboot, etime);
+ if ((etime < 20) || (eboot < 2)) {
+ FAILED(SNMPERR_GENERR,
+ "get_enginetime() returned bad values. (1)");
+ }
+
+ rval = get_enginetime("DDDD", 4, &eboot, &etime, FALSE);
+ FAILED(rval, "get_enginetime().");
+
+ fprintf(stdout, "DDDD = <%d,%d>\n", eboot, etime);
+ if ((etime < sleeptime) || (eboot != 0)) {
+ FAILED(SNMPERR_GENERR,
+ "get_enginetime() returned bad values. (2)");
+ }
+
+
+ rval = set_enginetime("CCC", 3, 234, 10000, TRUE);
+ FAILED(rval, "set_enginetime().");
+
+
+ rval = set_enginetime("EEEEE", 5, 9876, 55555, TRUE);
+ FAILED(rval, "set_enginetime().");
+
+
+ SUCCESS("Retrieval and updates.");
+
+
+
+ /*
+ * ------------------------------------ -o-
+ */
+ OUTPUT("Sleep again, then dump the list one last time.");
+
+ fprintf(stdout, "Sleeping for %d second%s... ",
+ sleeptime, (sleeptime == 1) ? "" : "s");
+ fflush(stdout);
+
+ sleep(sleeptime);
+ fprintf(stdout, "\n");
+
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+ dump_etimelist();
+#endif
+
+ return failcount;
+
+} /* end test_etime() */
diff --git a/cleopatre/application/spidnetsnmp/testing/eval_oneprogram.sh b/cleopatre/application/spidnetsnmp/testing/eval_oneprogram.sh
new file mode 100755
index 0000000000..45edfc0a67
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/eval_oneprogram.sh
@@ -0,0 +1,138 @@
+#!/bin/sh
+#
+# eval_oneprogram.sh [-h][-lk] <program> [<program_args>]
+#
+# CALLED BY: eval_suite.sh
+#
+#
+# Runs <program> and reports how many instances of the strings SUCCESS
+# or FAILED occur.
+#
+#
+# FIX Output from $PROGRAM on stderr is separated out and comes first.
+#
+#
+USAGE_LONG='
+#
+# -h Help.
+# -k Save the program output in "__<program_args>__<pid>o".
+# -l Long form. (Short form by default.)
+#
+# <program> is the executable to run and collect the output of.
+'
+
+USAGE="Usage: `basename $0` [-h][-lk] <program>"
+
+
+
+
+#------------------------------------ -o-
+# Globals.
+#
+AWKFILE="_`basename $0`$$.awk"
+SCRIPTFILE=
+
+dolongform=0
+dokeepoutput=
+
+TOTALFAILED=0
+
+
+
+#------------------------------------ -o-
+# Parse & setup.
+#
+while [ -n "$1" ]; do
+ case "$1" in
+ -k) dokeepoutput=true
+ ;;
+ -l) dolongform=1
+ ;;
+ -h) echo $USAGE
+ cat <<BLIK | sed 's/^#//' | sed '1d' 1>&2
+$USAGE_LONG
+BLIK
+ exit 0
+ ;;
+ *) PROGRAM="$*"
+ shift `expr $# - 1`
+ ;;
+ esac
+
+ shift
+done
+
+[ -z "$PROGRAM" ] && echo $USAGE && exit 1
+
+
+SCRIPTFILE="__`echo \`basename $PROGRAM\` | sed 's/ /_/g'`__$$o"
+
+
+
+#------------------------------------ -o-
+# Create awk script.
+#
+
+cat <<GRONK >$AWKFILE
+
+BEGIN {
+ pass = 0
+ passlist[0] = ""
+
+ fail = 0
+ faillist[0] = ""
+
+ longform = $dolongform + 0
+}
+
+/SUCCESS/ {
+ passlist[pass] = \$0
+ pass += 1
+}
+
+/FAILED/ {
+ faillist[fail] = \$0
+ fail += 1
+}
+
+END {
+ printf "$PROGRAM SUCCESS: %d\n", pass
+ printf "$PROGRAM FAILED: %d\n", fail
+
+ if (longform) {
+ printf "\n"
+ for (i=0; i<pass; i++)
+ print passlist[i]
+
+ for (i=0; i<fail; i++)
+ print faillist[i]
+ }
+
+ exit fail
+}
+GRONK
+
+
+
+
+#------------------------------------ -o-
+# Get and print results.
+#
+
+{ $PROGRAM $* 2>&1 ; } >$SCRIPTFILE
+
+awk -f $AWKFILE $SCRIPTFILE
+TOTALFAILED=$?
+
+rm -f $AWKFILE
+[ -z "$dokeepoutput" ] && rm -f $SCRIPTFILE
+
+
+
+
+#------------------------------------ -o-
+# Exit, cleanup.
+#
+exit $TOTALFAILED
+
+
diff --git a/cleopatre/application/spidnetsnmp/testing/eval_onescript.sh b/cleopatre/application/spidnetsnmp/testing/eval_onescript.sh
new file mode 100755
index 0000000000..f2476d1e35
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/eval_onescript.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# eval_onescript.sh SCRIPT [TESTNUMBER [HEADERONLY] ]
+#
+# Evaluates one test program, and helps it out by doing a bit of setup
+# for it. It does this by sourcing some configuration files for it
+# first, and if it exited without calling FINISHED, call it.
+#
+# Not intended to be a tool for the common user! Called by RUNTESTS
+# directly instead.
+#
+
+testnum=1
+if [ "x$2" != "x" ]; then
+ testnum=$2
+fi
+export testnum
+
+unset SNMP_HEADERONLY
+if [ "x$3" = "xyes" ]; then
+ SNMP_HEADERONLY=yes
+fi
+export SNMP_HEADERONLY
+
+. TESTCONF.sh
+
+. eval_tools.sh
+
+ECHO "$testnum: "
+
+. ./$1
+
+# We shouldn't get here...
+# If we do, it means they didn't exit properly.
+# So we will.
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/eval_suite.sh b/cleopatre/application/spidnetsnmp/testing/eval_suite.sh
new file mode 100755
index 0000000000..b8038205cf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/eval_suite.sh
@@ -0,0 +1,212 @@
+#!/bin/sh
+#
+# eval_suite.sh [-h][<args_passed_to_getresults>]
+#
+# CALLS: eval_oneprogram.sh [-h][-lk] <program>
+#
+# RETURNS: Number of failed tests, regardless of how that failure occured
+# or how many failures there were in a given test.
+#
+#
+
+
+ USAGE_LONG='
+#
+# HOW TO ENTER A NEW TEST
+#
+# To add a test to the testlist, add a line to the TESTLISTFILE (eval_testlist)
+# using the following format:
+#
+# <#_of_expected_successes> [#]<program> <args>
+#
+# Any white space may be used as separator. If <program> is immediately
+# preceeded by a pound sign (#) that test will be skipped. (No white space
+# allowed after the pound. Eg, "#<program>".)
+#
+#
+# HOW TESTS ARE RUN AND EVALUATED
+#
+# The harness for individual tests is the script "eval_oneprogram.sh".
+# It expects that the test print FAILED when something fails, and SUCCESS
+# when something succeeds. If a test executes properly there should be
+# some SUCCESS strings and NO FAILED strings. If the reason for the
+# success or failure of the test should be printed on the SAME line as the
+# SUCCESS/FAILED string to allow the dianostic to be easilly grepped from
+# the its output.
+#
+# The long form of the output (-l flag) will capture that output which may
+# help to diagnosis the problem. For more information:
+#
+# % eval_oneprogram.sh -h
+#
+#
+# MISSING TESTS ARE NOTED
+#
+# If an executable is found MISSING, a note is printed to that effect
+# and TESTFAILURE is incremented by 1.
+#
+'
+
+#
+# Suggested improvement(s):
+# Have two (or more?) arbitrary script(s) that may be associated
+# with a given test. One could prepare the environment, the other
+# could clean up the environment after running the test. This could
+# help when testing large subsystems that might require legitimately
+# building or changing things such that the testable item may be
+# accessed in the first place (eg). ...
+#
+
+
+#------------------------------------ -o-
+# Usage mess. (No, it works.)
+#
+USAGE="Usage: `basename $0` [-h][<args_for_getresults>]"
+
+usage() { echo; echo $USAGE; cat <<BLIK | sed 's/^#//' | sed '1d' | $PAGER
+$USAGE_LONG
+BLIK
+exit 0
+}
+
+[ "x$1" = "x-h" ] && usage
+
+
+
+#------------------------------------ -o-
+# Globals.
+#
+PROGRAM=
+ARGUMENTS="$*"
+
+TMPFILE=/tmp/eval_suite.sh$$
+
+TESTLISTFILE=eval_testlist
+
+EXPECTEDSUCCESSES=
+TESTFAILURE=0
+
+testname=
+
+success_count=
+failed_count=
+
+#
+# TESTLISTFILE format:
+# <expected_successes> <program> <arg(s)> ...
+# <expected_successes> <program> <arg(s)> ...
+# ...
+#
+TESTLIST="`cat $TESTLISTFILE | sed 's/$/ ===/'`"
+
+
+
+
+
+#------------------------------------ -o-
+# Run all tests in the testlist. For each test do the following:
+#
+# 1) Note whether the test is SKIPPED or MISSING.
+#
+# 2) Run the test; collect the number of FAILED strings from the
+# return value of eval_oneprogram.sh.
+#
+# 3) Count the number of SUCCESSes from the test output.
+#
+# 4) Print the results. If there were no FAILED strings *and* the
+# number of SUCCESS strings is what we expect, simply
+# note that the test passed. Otherwise, cat the output
+# generated by eval_oneprogram.sh and (possibly)
+# print other details.
+#
+set x $TESTLIST
+shift
+
+while [ -n "$1" ] ; do
+ #
+ # Parse agument stream...
+ #
+ EXPECTEDSUCCESSES=$1
+ shift
+
+ PROGRAM=
+ while [ "$1" != "===" ] ; do { PROGRAM="$PROGRAM $1" ; shift ; } done
+ shift
+
+ testname="`echo $PROGRAM | grep '^#' | sed 's/^#//'`"
+
+ echo '+==================================-o-===+'
+ echo
+
+
+
+ #
+ # Decide whether to skip the test, if it's mising, else run it.
+ #
+ [ -n "$testname" ] && { # Skip the test?
+ echo "SKIPPING test for \"$testname\"."
+ echo
+ continue
+ }
+ [ ! -e "`echo $PROGRAM | awk '{ print $1 }'`" ] && { # Missing test?
+ TESTFAILURE=`expr $TESTFAILURE + 1`
+
+ echo "MISSING test for \"$PROGRAM\"."
+ echo
+ continue
+ }
+
+ echo "TESTING \"$PROGRAM\"..." # Announce test!
+
+
+
+ #
+ # Run the test and collect the failed_count and success_count.
+ #
+ eval_oneprogram.sh $ARGUMENTS $PROGRAM >$TMPFILE
+ failed_count=$?
+
+ success_count=`awk '$(NF-1) == "SUCCESS:" { print $NF; exit }' $TMPFILE`
+ [ -z "$success_count" ] && success_count=0
+
+
+
+ #
+ # Output best-effort results of the test -OR- a fully successful run.
+ #
+ [ "$failed_count" -eq 0 -a \
+ "$success_count" -eq "$EXPECTEDSUCCESSES" ] &&
+ {
+ echo
+ echo $PROGRAM PASSED # Successful, fully, completed
+ echo
+
+ true
+ } || {
+ TESTFAILURE=`expr $TESTFAILURE + 1`
+
+ echo
+ cat $TMPFILE
+ echo
+
+ [ "$success_count" -ne $EXPECTEDSUCCESSES ] && {
+ echo "Got $success_count SUCCESSes"\
+ "out of $EXPECTEDSUCCESSES."
+ echo
+ }
+ true
+ } # end -- evaluation of and output based upon test success.
+done # endwhile
+
+
+
+
+#------------------------------------ -o-
+# Cleanup, exit.
+#
+rm -f $TMPFILE
+
+exit $TESTFAILURE
+
+
+
diff --git a/cleopatre/application/spidnetsnmp/testing/eval_testlist b/cleopatre/application/spidnetsnmp/testing/eval_testlist
new file mode 100644
index 0000000000..6f0f1f58e5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/eval_testlist
@@ -0,0 +1,5 @@
+7 ktest -a
+13 stest -a
+3 #test_keychange.sh
+2 test_kul.sh
+3 etest -a
diff --git a/cleopatre/application/spidnetsnmp/testing/eval_tools.sh b/cleopatre/application/spidnetsnmp/testing/eval_tools.sh
new file mode 100644
index 0000000000..483f214d7a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/eval_tools.sh
@@ -0,0 +1,578 @@
+#
+# eval_tools.sh
+#
+# Output functions for script tests. Source this from other test scripts
+# to establish a standardized repertory of test functions.
+#
+#
+# Except where noted, all functions return:
+# 0 On success, (Bourne Shell's ``true'')
+# non-0 Otherwise.
+#
+# Input arguments to each function are documented with each function.
+#
+#
+# XXX Suggestions:
+# DEBUG ON|OFF
+# dump CAPTURE output to stdout as well as to junkoutputfile.
+#
+
+#
+# Only allow ourselves to be eval'ed once
+#
+if [ "x$EVAL_TOOLS_SH_EVALED" != "xyes" ]; then
+ EVAL_TOOLS_SH_EVALED=yes
+ . TESTCONF.sh
+
+#
+# Variables used in global environment of calling script.
+#
+failcount=0
+junkoutputfile="$SNMP_TMPDIR/output-`basename $0`$$"
+seperator="-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
+if [ -z "$OK_TO_SAVE_RESULT" ] ; then
+OK_TO_SAVE_RESULT=1
+export OK_TO_SAVE_RESULT
+fi
+
+
+#
+# HEADER: returns a single line when SNMP_HEADERONLY mode and exits.
+#
+HEADER() {
+ if [ "x$SNMP_HEADERONLY" != "x" ]; then
+ echo test $*
+ exit 0;
+ else
+ ECHO "testing $*... "
+ headerStr="testing $*"
+ fi
+}
+
+
+#------------------------------------ -o-
+#
+OUTPUT() { # <any_arguments>
+ cat <<GRONK
+
+
+$*
+
+
+GRONK
+}
+
+CAN_USLEEP() {
+ if [ "$SNMP_CAN_USLEEP" = 0 -o "$SNMP_CAN_USLEEP" = 0 ] ; then
+ return $SNMP_CAN_USLEEP
+ fi
+ sleep .1 > /dev/null 2>&1
+ if [ $? = 0 ] ; then
+ SNMP_CAN_USLEEP=1
+ else
+ SNMP_CAN_USLEEP=0
+ fi
+ export SNMP_CAN_USLEEP
+}
+
+
+#------------------------------------ -o-
+#
+SUCCESS() { # <any_arguments>
+ [ "$failcount" -ne 0 ] && return
+ cat <<GROINK
+
+SUCCESS: $*
+
+GROINK
+}
+
+
+
+#------------------------------------ -o-
+#
+FAILED() { # <return_value>, <any_arguments>
+ [ "$1" -eq 0 ] && return
+ shift
+
+ failcount=`expr $failcount + 1`
+ cat <<GRONIK
+
+FAILED: $*
+
+GRONIK
+}
+
+#------------------------------------ -o-
+#
+SKIP() {
+ REMOVETESTDATA
+ echo "SKIPPED"
+ exit 0
+}
+
+SKIPIFNOT() {
+ grep "^#define $1" $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h $SNMP_UPDIR/include/net-snmp/agent/agent_module_config.h > /dev/null
+ if [ $? != 0 ]; then
+ SKIP
+ fi
+}
+
+SKIPIF() {
+ grep "^#define $1 " $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h $SNMP_UPDIR/include/net-snmp/agent/agent_module_config.h > /dev/null
+ if [ $? = 0 ]; then
+ SKIP
+ fi
+}
+
+
+#------------------------------------ -o-
+#
+VERIFY() { # <path_to_file(s)>
+ local missingfiles=
+
+ for f in $*; do
+ [ -e "$f" ] && continue
+ echo "FAILED: Cannot find file \"$f\"."
+ missingfiles=true
+ done
+
+ [ "$missingfiles" = true ] && exit 1000
+}
+
+
+#------------------------------------ -o-
+#
+STARTTEST() {
+ [ ! -e "$junkoutputfile" ] && {
+ touch $junkoutputfile
+ return
+ }
+ echo "FAILED: Output file already exists: \"$junkoutputfile\"."
+ exit 1000
+}
+
+
+#------------------------------------ -o-
+#
+STOPTEST() {
+ rm -f "$junkoutputfile"
+}
+
+
+#------------------------------------ -o-
+#
+REMOVETESTDATA() {
+# ECHO "removing $SNMP_TMPDIR "
+ rm -rf $SNMP_TMPDIR
+}
+
+
+#------------------------------------ -o-
+# Captures output from command, and returns the command's exit code.
+CAPTURE() { # <command_with_arguments_to_execute>
+ echo $* >> $SNMP_TMPDIR/invoked
+
+ if [ $SNMP_VERBOSE -gt 0 ]; then
+ cat <<KNORG
+
+EXECUTING: $*
+
+KNORG
+
+ fi
+ ( $* 2>&1 ) > $junkoutputfile 2>&1
+ RC=$?
+
+ if [ $SNMP_VERBOSE -gt 1 ]; then
+ echo "Command Output: "
+ echo "MIBDIR $MIBDIRS $MIBS"
+ echo "$seperator"
+ cat $junkoutputfile | sed 's/^/ /'
+ echo "$seperator"
+ fi
+ return $RC
+}
+
+#------------------------------------ -o-
+# Delay to let processes settle
+DELAY() {
+ if [ "$SNMP_SLEEP" != "0" ] ; then
+ sleep $SNMP_SLEEP
+ fi
+}
+
+SAVE_RESULTS() {
+ real_return_value=$return_value
+}
+
+#
+# Checks the output result against what we expect.
+# Sets return_value to 0 or 1.
+#
+EXPECTRESULT() {
+ if [ $OK_TO_SAVE_RESULT -ne 0 ] ; then
+ if [ "$snmp_last_test_result" = "$1" ]; then
+ return_value=0
+ else
+ return_value=1
+ fi
+ fi
+}
+
+#------------------------------------ -o-
+# Returns: Count of matched lines.
+#
+CHECK() { # <pattern_to_match>
+ if [ $SNMP_VERBOSE -gt 0 ]; then
+ echo -n "checking output for \"$*\"..."
+ fi
+
+ rval=`grep -c "$*" "$junkoutputfile" 2>/dev/null`
+
+ if [ $SNMP_VERBOSE -gt 0 ]; then
+ echo "$rval matches found"
+ fi
+
+ snmp_last_test_result=$rval
+ EXPECTRESULT 1 # default
+ return $rval
+}
+
+CHECKFILE() {
+ file=$1
+ if [ "x$file" = "x" ] ; then
+ file=$junkoutputfile
+ fi
+ shift
+ myoldjunkoutputfile="$junkoutputfile"
+ junkoutputfile="$file"
+ CHECK $*
+ junkoutputfile="$myoldjunkoutputfile"
+}
+
+CHECKTRAPD() {
+ CHECKFILE $SNMP_SNMPTRAPD_LOG_FILE $@
+}
+
+CHECKTRAPDORDIE() {
+ CHECKORDIE $@ $SNMP_SNMPTRAPD_LOG_FILE
+}
+
+CHECKAGENT() {
+ CHECKFILE $SNMP_SNMPD_LOG_FILE $@
+}
+
+WAITFORAGENT() {
+ WAITFOR "$@" $SNMP_SNMPD_LOG_FILE
+}
+
+WAITFORTRAPD() {
+ WAITFOR "$@" $SNMP_SNMPTRAPD_LOG_FILE
+}
+
+WAITFOR() {
+ ## save the previous save state and test result
+ save_state=$OK_TO_SAVE_RESULT
+ save_test=$snmp_last_test_result
+ OK_TO_SAVE_RESULT=0
+
+ sleeptime=$SNMP_SLEEP
+ oldsleeptime=$SNMP_SLEEP
+ if [ "$1" != "" ] ; then
+ CAN_USLEEP
+ if [ $SNMP_CAN_USLEEP = 1 ] ; then
+ sleeptime=`expr $SNMP_SLEEP '*' 50`
+ SNMP_SLEEP=.1
+ else
+ sleeptime=`expr $SNMP_SLEEP '*' 5`
+ SNMP_SLEEP=1
+ fi
+ while [ $sleeptime -gt 0 ] ; do
+ if [ "$2" = "" ] ; then
+ CHECK "$@"
+ else
+ CHECKFILE "$2" "$1"
+ fi
+ if [ "$snmp_last_test_result" != "" ] ; then
+ if [ "$snmp_last_test_result" -gt 0 ] ; then
+ break;
+ fi
+ fi
+ DELAY
+ sleeptime=`expr $sleeptime - 1`
+ done
+ SNMP_SLEEP=$oldsleeptime
+ else
+ if [ $SNMP_SLEEP -ne 0 ] ; then
+ sleep $SNMP_SLEEP
+ fi
+ fi
+
+ ## restore the previous save state and test result
+ OK_TO_SAVE_RESULT=$save_state
+ snmp_last_test_result=$save_test
+}
+
+# WAITFORORDIE "grep string" ["file"]
+WAITFORORDIE() {
+ WAITFOR "$1" "$2"
+ if [ "$snmp_last_test_result" != 0 ] ; then
+ FINISHED
+ fi
+ ECHO "."
+}
+
+# CHECKORDIE "grep string" ["file"] .. FAIL if "grep string" is *not* found
+CHECKORDIE() {
+ CHECKFILE "$2" "$1"
+ if [ "$snmp_last_test_result" = 0 ] ; then
+ FINISHED
+ fi
+ ECHO "."
+}
+
+# CHECKANDDIE "grep string" ["file"] .. FAIL if "grep string" *is* found
+CHECKANDDIE() {
+ CHECKFILE "$2" "$1"
+ EXPECTRESULT 0 # make sure return_value gets set correctly
+ if [ "$snmp_last_test_result" != 0 ] ; then
+ FINISHED
+ fi
+ ECHO "."
+}
+
+#------------------------------------ -o-
+# Returns: Count of matched lines.
+#
+CHECKEXACT() { # <pattern_to_match_exactly>
+ rval=`grep -wc "$*" "$junkoutputfile" 2>/dev/null`
+ snmp_last_test_result=$rval
+ EXPECTRESULT 1 # default
+ return $rval
+}
+
+CONFIGAGENT() {
+ if [ "x$SNMP_CONFIG_FILE" = "x" ]; then
+ echo "$0: failed because var: SNMP_CONFIG_FILE wasn't set"
+ exit 1;
+ fi
+ echo $* >> $SNMP_CONFIG_FILE
+}
+
+CONFIGTRAPD() {
+ if [ "x$SNMPTRAPD_CONFIG_FILE" = "x" ]; then
+ echo "$0: failed because var: SNMPTRAPD_CONFIG_FILE wasn't set"
+ exit 1;
+ fi
+ echo $* >> $SNMPTRAPD_CONFIG_FILE
+}
+
+#
+# common to STARTAGENT and STARTTRAPD
+# log command to "invoked" file
+# delay after command to allow for settle
+#
+STARTPROG() {
+ if [ $SNMP_VERBOSE -gt 1 ]; then
+ echo "$CFG_FILE contains: "
+ if [ -f $CFG_FILE ]; then
+ cat $CFG_FILE
+ else
+ echo "[no config file]"
+ fi
+ fi
+ if test -f $CFG_FILE; then
+ COMMAND="$COMMAND -C -c $CFG_FILE"
+ fi
+ if [ $SNMP_VERBOSE -gt 0 ]; then
+ echo "running: $COMMAND"
+ fi
+ if [ "x$PORT_SPEC" != "x" ]; then
+ COMMAND="$COMMAND $PORT_SPEC"
+ fi
+ echo $COMMAND >> $SNMP_TMPDIR/invoked
+ if [ "x$OSTYPE" = "xmsys" ]; then
+ ## $COMMAND > $LOG_FILE.stdout 2>&1 &
+ COMMAND="cmd.exe //c start //min $COMMAND"
+ start $COMMAND > $LOG_FILE.stdout 2>&1
+ else
+ $COMMAND > $LOG_FILE.stdout 2>&1
+ fi
+}
+
+#------------------------------------ -o-
+STARTAGENT() {
+ SNMPDSTARTED=1
+ COMMAND="snmpd $SNMP_FLAGS -r -U -p $SNMP_SNMPD_PID_FILE -Lf $SNMP_SNMPD_LOG_FILE $AGENT_FLAGS"
+ CFG_FILE=$SNMP_CONFIG_FILE
+ LOG_FILE=$SNMP_SNMPD_LOG_FILE
+ PORT_SPEC="$SNMP_SNMPD_PORT"
+ if [ "x$SNMP_TRANSPORT_SPEC" != "x" ]; then
+ PORT_SPEC="${SNMP_TRANSPORT_SPEC}:${SNMP_TEST_DEST}${PORT_SPEC}"
+ fi
+ STARTPROG
+ WAITFORAGENT "NET-SNMP version"
+}
+
+#------------------------------------ -o-
+STARTTRAPD() {
+ TRAPDSTARTED=1
+ COMMAND="snmptrapd -d -p $SNMP_SNMPTRAPD_PID_FILE -Lf $SNMP_SNMPTRAPD_LOG_FILE $TRAPD_FLAGS"
+ CFG_FILE=$SNMPTRAPD_CONFIG_FILE
+ LOG_FILE=$SNMP_SNMPTRAPD_LOG_FILE
+ PORT_SPEC="$SNMP_SNMPTRAPD_PORT"
+ if [ "x$SNMP_TRANSPORT_SPEC" != "x" ]; then
+ PORT_SPEC="${SNMP_TRANSPORT_SPEC}:${SNMP_TEST_DEST}${PORT_SPEC}"
+ fi
+ STARTPROG
+ WAITFORTRAPD "NET-SNMP version"
+}
+
+## sending SIGHUP for reconfiguration
+#
+HUPPROG() {
+ if [ -f $1 ]; then
+ if [ "x$OSTYPE" = "xmsys" ]; then
+ COMMAND='echo "Skipping SIGHUP (not supported by kill.exe on MinGW)"'
+ else
+ COMMAND="kill -HUP `cat $1`"
+ fi
+ echo $COMMAND >> $SNMP_TMPDIR/invoked
+ $COMMAND > /dev/null 2>&1
+ fi
+}
+
+HUPAGENT() {
+ HUPPROG $SNMP_SNMPD_PID_FILE
+ if [ "x$OSTYPE" != "xmsys" ]; then
+ WAITFORAGENT "restarted"
+ fi
+}
+
+HUPTRAPD() {
+ HUPPROG $SNMP_SNMPTRAPD_PID_FILE
+ if [ "x$OSTYPE" != "xmsys" ]; then
+ WAITFORTRAPD "restarted"
+ fi
+}
+
+
+## used by STOPAGENT and STOPTRAPD
+# delay before kill to allow previous action to finish
+# this is especially important for interaction between
+# master agent and sub agent.
+STOPPROG() {
+ if [ -f $1 ]; then
+ if [ "x$OSTYPE" = "xmsys" ]; then
+ COMMAND="kill.exe `cat $1`"
+ else
+ COMMAND="kill -TERM `cat $1`"
+ fi
+ echo $COMMAND >> $SNMP_TMPDIR/invoked
+ $COMMAND > /dev/null 2>&1
+ fi
+}
+
+#------------------------------------ -o-
+#
+STOPAGENT() {
+ SAVE_RESULTS
+ STOPPROG $SNMP_SNMPD_PID_FILE
+ if [ "x$OSTYPE" != "xmsys" ]; then
+ WAITFORAGENT "shutting down"
+ fi
+ if [ $SNMP_VERBOSE -gt 1 ]; then
+ echo "Agent Output:"
+ echo "$seperator [stdout]"
+ cat $SNMP_SNMPD_LOG_FILE.stdout
+ echo "$seperator [logfile]"
+ cat $SNMP_SNMPD_LOG_FILE
+ echo "$seperator"
+ fi
+}
+
+#------------------------------------ -o-
+#
+STOPTRAPD() {
+ SAVE_RESULTS
+ STOPPROG $SNMP_SNMPTRAPD_PID_FILE
+ if [ "x$OSTYPE" != "xmsys" ]; then
+ WAITFORTRAPD "Stopped"
+ fi
+ if [ $SNMP_VERBOSE -gt 1 ]; then
+ echo "snmptrapd Output:"
+ echo "$seperator [stdout]"
+ cat $SNMP_SNMPTRAPD_LOG_FILE.stdout
+ echo "$seperator [logfile]"
+ cat $SNMP_SNMPTRAPD_LOG_FILE
+ echo "$seperator"
+ fi
+}
+
+#------------------------------------ -o-
+#
+FINISHED() {
+
+ ## no more changes to test result.
+ OK_TO_SAVE_RESULT=0
+
+ if [ "$SNMPDSTARTED" = "1" ] ; then
+ STOPAGENT
+ fi
+ if [ "$TRAPDSTARTED" = "1" ] ; then
+ STOPTRAPD
+ fi
+ for pfile in $SNMP_TMPDIR/*pid* ; do
+ if [ "x$pfile" = "x$SNMP_TMPDIR/*pid*" ]; then
+ ECHO "(no pid file(s) found) "
+ break
+ fi
+ if [ ! -f $pfile ]; then
+ ECHO "('$pfile' disappeared) "
+ continue
+ fi
+ pid=`cat $pfile`
+ ps -e 2>/dev/null | egrep "^[ ]*$pid[ ]+" > /dev/null 2>&1
+ if [ $? = 0 ] ; then
+ SNMP_SAVE_TMPDIR=yes
+ if [ "x$OSTYPE" = "xmsys" ]; then
+ COMMAND="kill.exe $pid"
+ else
+ COMMAND="kill -9 $pid"
+ fi
+ echo $COMMAND "($pfile)" >> $SNMP_TMPDIR/invoked
+ $COMMAND > /dev/null 2>&1
+ return_value=1
+ fi
+ done
+ if [ "x$real_return_value" != "x0" ]; then
+ if [ -s core ] ; then
+ # XX hope that only one prog cores !
+ cp core $SNMP_TMPDIR/core.$$
+ rm -f core
+ fi
+ echo "FAIL"
+ echo "$headerStr...FAIL" >> $SNMP_TMPDIR/invoked
+ exit $real_return_value
+ fi
+
+ echo "ok"
+ echo "$headerStr...ok" >> $SNMP_TMPDIR/invoked
+
+ if [ "x$SNMP_SAVE_TMPDIR" != "xyes" ]; then
+ REMOVETESTDATA
+ fi
+ exit $real_return_value
+}
+
+#------------------------------------ -o-
+#
+VERBOSE_OUT() {
+ if [ $SNMP_VERBOSE > $1 ]; then
+ shift
+ echo "$*"
+ fi
+}
+
+fi # Only allow ourselves to be eval'ed once
diff --git a/cleopatre/application/spidnetsnmp/testing/keymanagetest.c b/cleopatre/application/spidnetsnmp/testing/keymanagetest.c
new file mode 100644
index 0000000000..394a29ca80
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/keymanagetest.c
@@ -0,0 +1,651 @@
+/*
+ * keymanagetest.c
+ *
+ * Expected SUCCESSes: 2 + 2 + 3 for all tests.
+ *
+ * Returns:
+ * Number of FAILUREs.
+ *
+ *
+ * FIX Or how about passing a usmUser name and looking up the entry as
+ * a means of getting key material? This means the userList is
+ * available from an application...
+ *
+ * ASSUMES No key management functions return non-zero success codes.
+ *
+ * Test of generate_Ku(). SUCCESSes: 2
+ * Test of generate_kul(). SUCCESSes: 2
+ * Test of {encode,decode}_keychange(). SUCCESSes: 3
+ */
+
+static char *rcsid = "$Id: keymanagetest.c 6918 2002-04-20 07:30:29Z hardaker $"; /* */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "keytools.h"
+#include "tools.h"
+#include "scapi.h"
+#include "transform_oids.h"
+#include "callback.h"
+
+#include <stdlib.h>
+
+extern char *optarg;
+extern int optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char *local_progname;
+
+#define USAGE "Usage: %s [-h][-aklu][-E <engineID>][-N <newkey>][-O <oldkey>][-P <passphrase>]"
+#define OPTIONLIST "aqE:hklN:O:P:u"
+
+int doalltests = 0, dogenKu = 0, dogenkul = 0, dokeychange = 0;
+
+#define ALLOPTIONS (doalltests + dogenKu + dogenkul + dokeychange)
+
+
+#define LOCAL_MAXBUF (1024 * 8)
+#define NL "\n"
+
+#define OUTPUTALWAYS(o) fprintf(stdout, "\n\n%s\n\n", o);
+#define OUTPUT(o) if (!bequiet) { OUTPUTALWAYS(o); }
+
+#define SUCCESS(s) \
+{ \
+ if (!failcount && !bequiet) \
+ fprintf(stdout, "\nSUCCESS: %s\n", s); \
+}
+
+#define FAILED(e, f) \
+{ \
+ if (e != SNMPERR_SUCCESS && !bequiet) { \
+ fprintf(stdout, "\nFAILED: %s\n", f); \
+ failcount += 1; \
+ } \
+}
+
+
+
+/*
+ * Test specific globals.
+ */
+#define ENGINEID_DEFAULT "1.2.3.4wild"
+#define PASSPHRASE_DEFAULT "Clay's Conclusion: Creativity is great, " \
+ "but plagiarism is faster."
+#define OLDKEY_DEFAULT "This is a very old key."
+#define NEWKEY_DEFAULT "This key, on the other hand, is very new."
+
+char *engineID = NULL;
+char *passphrase = NULL;
+char *oldkey = NULL;
+char *newkey = NULL;
+int bequiet = 0;
+
+
+/*
+ * Prototypes.
+ */
+void usage(FILE * ofp);
+
+int test_genkul(void);
+int test_genKu(void);
+int test_keychange(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+ char ch;
+
+ local_progname = argv[0];
+ optarg = NULL;
+
+ /*
+ * Parse.
+ */
+ while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+ switch (ch) {
+ case 'a':
+ doalltests = 1;
+ break;
+ case 'E':
+ engineID = optarg;
+ break;
+ case 'k':
+ dokeychange = 1;
+ break;
+ case 'l':
+ dogenkul = 1;
+ break;
+ case 'N':
+ newkey = optarg;
+ break;
+ case 'O':
+ oldkey = optarg;
+ break;
+ case 'P':
+ passphrase = optarg;
+ break;
+ case 'u':
+ dogenKu = 1;
+ break;
+ case 'q':
+ bequiet = 1;
+ break;
+ case 'h':
+ rval = 0;
+ default:
+ usage(stdout);
+ exit(rval);
+ }
+
+ argc -= 1;
+ argv += 1;
+ if (optarg) {
+ argc -= 1;
+ argv += 1;
+ }
+
+ optind = 1;
+ optarg = NULL;
+ } /* endwhile getopt */
+
+ if ((argc > 1)) {
+ usage(stdout);
+ exit(1000);
+
+ } else if (ALLOPTIONS != 1) {
+ usage(stdout);
+ exit(1000);
+ }
+
+
+ /*
+ * Test stuff.
+ */
+ rval = sc_init();
+ FAILED(rval, "sc_init().");
+
+ if (dogenKu || doalltests) {
+ failcount += test_genKu();
+ }
+ if (dogenkul || doalltests) {
+ failcount += test_genkul();
+ }
+ if (dokeychange || doalltests) {
+ failcount += test_keychange();
+ }
+
+
+ /*
+ * Cleanup.
+ */
+ rval = sc_shutdown(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+ NULL, NULL);
+ FAILED(rval, "sc_shutdown().");
+
+ return failcount;
+
+} /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+ fprintf(ofp,
+ USAGE
+ "" NL
+ " -a All tests." NL
+ " -E [0x]<engineID> snmpEngineID string."
+ NL
+ " -k Test {encode,decode}_keychange()."
+ NL
+ " -l generate_kul()."
+ NL
+ " -h Help."
+ NL
+ " -N [0x]<newkey> New key (for testing KeyChange TC)."
+ NL
+ " -O [0x]<oldkey> Old key (for testing KeyChange TC)."
+ NL
+ " -P <passphrase> Source string for usmUser master key."
+ NL
+ " -u generate_Ku()."
+ NL
+ " -q be quiet."
+ NL "" NL, local_progname);
+
+} /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Test template.
+ *
+ * Returns:
+ * Number of failures.
+ */
+int
+test_dosomething(void)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+
+ EM0(1, "UNIMPLEMENTED"); /* EM(1); /* */
+
+ test_dosomething_quit:
+ return failcount;
+
+} /* end test_dosomething() */
+#endif /* EXAMPLE */
+
+
+
+/*******************************************************************-o-******
+ * test_genKu
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test generation of usmUser master key from a passphrase.
+ *
+ * ASSUMES Passphrase is made of printable characters!
+ */
+int
+test_genKu(void)
+{
+ int rval = SNMPERR_SUCCESS,
+ failcount = 0,
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5), kulen;
+ char *hashname = "usmHMACMD5AuthProtocol.", *s;
+ u_char Ku[LOCAL_MAXBUF];
+ oid *hashtype = usmHMACMD5AuthProtocol;
+
+ OUTPUT("Test of generate_Ku --");
+
+ /*
+ * Set passphrase.
+ */
+ if (!passphrase) {
+ passphrase = PASSPHRASE_DEFAULT;
+ }
+ if (!bequiet)
+ fprintf(stdout, "Passphrase%s:\n\t%s\n\n",
+ (passphrase == PASSPHRASE_DEFAULT) ? " (default)" : "",
+ passphrase);
+
+
+ test_genKu_again:
+ memset(Ku, 0, LOCAL_MAXBUF);
+ kulen = LOCAL_MAXBUF;
+
+ rval = generate_Ku(hashtype, USM_LENGTH_OID_TRANSFORM,
+ passphrase, strlen(passphrase), Ku, &kulen);
+ FAILED(rval, "generate_Ku().");
+
+ if (kulen != properlength) {
+ FAILED(SNMPERR_GENERR, "Ku length is wrong for this hashtype.");
+ }
+
+ binary_to_hex(Ku, kulen, &s);
+ if (!bequiet)
+ fprintf(stdout, "Ku (len=%d): %s\n", kulen, s);
+ free_zero(s, kulen);
+
+ SUCCESS(hashname);
+ if (!bequiet)
+ fprintf(stdout, "\n");
+
+ if (hashtype == usmHMACMD5AuthProtocol) {
+ hashtype = usmHMACSHA1AuthProtocol;
+ hashname = "usmHMACSHA1AuthProtocol.";
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+ goto test_genKu_again;
+ }
+
+ return failcount;
+
+} /* end test_genKu() */
+
+
+
+
+/*******************************************************************-o-******
+ * test_genkul
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test of generate_kul().
+ *
+ * A passphrase and engineID are hashed into a master key Ku using
+ * both known hash transforms. Localized keys, also using both hash
+ * transforms, are generated from each of these master keys.
+ *
+ * ASSUME generate_Ku is already tested.
+ * ASSUME engineID is initially a NULL terminated string.
+ */
+int
+test_genkul(void)
+{
+ int rval = SNMPERR_SUCCESS,
+ failcount = 0,
+ properlength, kulen, kul_len, engineID_len, isdefault = FALSE;
+
+ char *s = NULL,
+ *testname = "Using HMACMD5 to create master key.",
+ *hashname_Ku = "usmHMACMD5AuthProtocol", *hashname_kul;
+
+ u_char Ku[LOCAL_MAXBUF], kul[LOCAL_MAXBUF];
+
+ oid *hashtype_Ku = usmHMACMD5AuthProtocol, *hashtype_kul;
+
+ OUTPUT("Test of generate_kul --");
+
+
+ /*
+ * Set passphrase and engineID.
+ *
+ * If engineID begins with 0x, assume it is written in (printable)
+ * hex and convert it to binary data.
+ */
+ if (!passphrase) {
+ passphrase = PASSPHRASE_DEFAULT;
+ }
+ if (!bequiet)
+ fprintf(stdout, "Passphrase%s:\n\t%s\n\n",
+ (passphrase == PASSPHRASE_DEFAULT) ? " (default)" : "",
+ passphrase);
+
+ if (!engineID) {
+ engineID = ENGINEID_DEFAULT;
+ isdefault = TRUE;
+ }
+
+ engineID_len = strlen(engineID);
+
+ if (tolower(*(engineID + 1)) == 'x') {
+ engineID_len = hex_to_binary2(engineID + 2, engineID_len - 2, &s);
+ if (engineID_len < 0) {
+ FAILED((rval = SNMPERR_GENERR),
+ "Could not resolve hex engineID.");
+ }
+ engineID = s;
+ binary_to_hex(engineID, engineID_len, &s);
+ }
+
+ if (!bequiet)
+ fprintf(stdout, "engineID%s (len=%d): %s\n\n",
+ (isdefault) ? " (default)" : "",
+ engineID_len, (s) ? s : engineID);
+ if (s) {
+ SNMP_FREE(s);
+ }
+
+
+
+ /*
+ * Create a master key using both hash transforms; create localized
+ * keys using both hash transforms from each master key.
+ */
+ test_genkul_again_master:
+ memset(Ku, 0, LOCAL_MAXBUF);
+ kulen = LOCAL_MAXBUF;
+ hashname_kul = "usmHMACMD5AuthProtocol";
+ hashtype_kul = usmHMACMD5AuthProtocol;
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5);
+
+
+ rval = generate_Ku(hashtype_Ku, USM_LENGTH_OID_TRANSFORM,
+ passphrase, strlen(passphrase), Ku, &kulen);
+ FAILED(rval, "generate_Ku().");
+
+ binary_to_hex(Ku, kulen, &s);
+ if (!bequiet)
+ fprintf(stdout,
+ "\n\nMaster Ku using \"%s\":\n\t%s\n\n", hashname_Ku, s);
+ free_zero(s, kulen);
+
+
+ test_genkul_again_local:
+ memset(kul, 0, LOCAL_MAXBUF);
+ kul_len = LOCAL_MAXBUF;
+
+ rval = generate_kul(hashtype_kul, USM_LENGTH_OID_TRANSFORM,
+ engineID, engineID_len, Ku, kulen, kul, &kul_len);
+
+ if ((hashtype_Ku == usmHMACMD5AuthProtocol)
+ && (hashtype_kul == usmHMACSHA1AuthProtocol)) {
+ if (rval == SNMPERR_SUCCESS) {
+ FAILED(SNMPERR_GENERR,
+ "generate_kul SHOULD fail when Ku length is "
+ "less than hash transform length.");
+ }
+
+ } else {
+ FAILED(rval, "generate_kul().");
+
+ if (kul_len != properlength) {
+ FAILED(SNMPERR_GENERR,
+ "kul length is wrong for the given hashtype.");
+ }
+
+ binary_to_hex(kul, kul_len, &s);
+ fprintf(stdout, "kul (%s) (len=%d): %s\n",
+ ((hashtype_Ku == usmHMACMD5AuthProtocol) ? "MD5" : "SHA"),
+ kul_len, s);
+ free_zero(s, kul_len);
+ }
+
+
+ /*
+ * Create localized key using the other hash transform, but from
+ * * the same master key.
+ */
+ if (hashtype_kul == usmHMACMD5AuthProtocol) {
+ hashtype_kul = usmHMACSHA1AuthProtocol;
+ hashname_kul = "usmHMACSHA1AuthProtocol";
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+ goto test_genkul_again_local;
+ }
+
+ SUCCESS(testname);
+
+
+ /*
+ * Re-create the master key using the other hash transform.
+ */
+ if (hashtype_Ku == usmHMACMD5AuthProtocol) {
+ hashtype_Ku = usmHMACSHA1AuthProtocol;
+ hashname_Ku = "usmHMACSHA1AuthProtocol";
+ testname = "Using HMACSHA1 to create master key.";
+ goto test_genkul_again_master;
+ }
+
+ return failcount;
+
+} /* end test_genkul() */
+
+
+
+
+/*******************************************************************-o-******
+ * test_keychange
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test of KeyChange TC implementation.
+ *
+ * ASSUME newkey and oldkey begin as NULL terminated strings.
+ */
+int
+test_keychange(void)
+{
+ int rval = SNMPERR_SUCCESS,
+ failcount = 0,
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5),
+ oldkey_len,
+ newkey_len,
+ keychange_len,
+ temp_len, isdefault_new = FALSE, isdefault_old = FALSE;
+
+ char *hashname = "usmHMACMD5AuthProtocol.", *s;
+
+ u_char oldkey_buf[LOCAL_MAXBUF],
+ newkey_buf[LOCAL_MAXBUF],
+ temp_buf[LOCAL_MAXBUF], keychange_buf[LOCAL_MAXBUF];
+
+ oid *hashtype = usmHMACMD5AuthProtocol;
+
+ OUTPUT("Test of KeyChange TC --");
+
+
+ /*
+ * Set newkey and oldkey.
+ */
+ if (!newkey) { /* newkey */
+ newkey = NEWKEY_DEFAULT;
+ isdefault_new = TRUE;
+ }
+ newkey_len = strlen(newkey);
+
+ if (tolower(*(newkey + 1)) == 'x') {
+ newkey_len = hex_to_binary2(newkey + 2, newkey_len - 2, &s);
+ if (newkey_len < 0) {
+ FAILED((rval = SNMPERR_GENERR),
+ "Could not resolve hex newkey.");
+ }
+ newkey = s;
+ binary_to_hex(newkey, newkey_len, &s);
+ }
+
+ if (!oldkey) { /* oldkey */
+ oldkey = OLDKEY_DEFAULT;
+ isdefault_old = TRUE;
+ }
+ oldkey_len = strlen(oldkey);
+
+ if (tolower(*(oldkey + 1)) == 'x') {
+ oldkey_len = hex_to_binary2(oldkey + 2, oldkey_len - 2, &s);
+ if (oldkey_len < 0) {
+ FAILED((rval = SNMPERR_GENERR),
+ "Could not resolve hex oldkey.");
+ }
+ oldkey = s;
+ binary_to_hex(oldkey, oldkey_len, &s);
+ }
+
+
+
+ test_keychange_again:
+ memset(oldkey_buf, 0, LOCAL_MAXBUF);
+ memset(newkey_buf, 0, LOCAL_MAXBUF);
+ memset(keychange_buf, 0, LOCAL_MAXBUF);
+ memset(temp_buf, 0, LOCAL_MAXBUF);
+
+ memcpy(oldkey_buf, oldkey, SNMP_MIN(oldkey_len, properlength));
+ memcpy(newkey_buf, newkey, SNMP_MIN(newkey_len, properlength));
+ keychange_len = LOCAL_MAXBUF;
+
+
+ binary_to_hex(oldkey_buf, properlength, &s);
+ fprintf(stdout, "\noldkey%s (len=%d): %s\n",
+ (isdefault_old) ? " (default)" : "", properlength, s);
+ SNMP_FREE(s);
+
+ binary_to_hex(newkey_buf, properlength, &s);
+ fprintf(stdout, "newkey%s (len=%d): %s\n\n",
+ (isdefault_new) ? " (default)" : "", properlength, s);
+ SNMP_FREE(s);
+
+
+ rval = encode_keychange(hashtype, USM_LENGTH_OID_TRANSFORM,
+ oldkey_buf, properlength,
+ newkey_buf, properlength,
+ keychange_buf, &keychange_len);
+ FAILED(rval, "encode_keychange().");
+
+ if (keychange_len != (properlength * 2)) {
+ FAILED(SNMPERR_GENERR,
+ "KeyChange string (encoded) is not proper length "
+ "for this hash transform.");
+ }
+
+ binary_to_hex(keychange_buf, keychange_len, &s);
+ fprintf(stdout, "(%s) KeyChange string: %s\n\n",
+ ((hashtype == usmHMACMD5AuthProtocol) ? "MD5" : "SHA"), s);
+ SNMP_FREE(s);
+
+ temp_len = properlength;
+ rval = decode_keychange(hashtype, USM_LENGTH_OID_TRANSFORM,
+ oldkey_buf, properlength,
+ keychange_buf, properlength * 2,
+ temp_buf, &temp_len);
+ FAILED(rval, "decode_keychange().");
+
+ if (temp_len != properlength) {
+ FAILED(SNMPERR_GENERR,
+ "decoded newkey is not proper length for "
+ "this hash transform.");
+ }
+
+ binary_to_hex(temp_buf, temp_len, &s);
+ fprintf(stdout, "decoded newkey: %s\n\n", s);
+ SNMP_FREE(s);
+
+
+ if (memcmp(newkey_buf, temp_buf, temp_len)) {
+ FAILED(SNMPERR_GENERR, "newkey did not decode properly.");
+ }
+
+
+ SUCCESS(hashname);
+ fprintf(stdout, "\n");
+
+
+ /*
+ * Multiplex different test combinations.
+ *
+ * First clause is for Test #2, second clause is for (last) Test #3.
+ */
+ if (hashtype == usmHMACMD5AuthProtocol) {
+ hashtype = usmHMACSHA1AuthProtocol;
+ hashname = "usmHMACSHA1AuthProtocol (w/DES length kul's).";
+ properlength = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES)
+ + BYTESIZE(SNMP_TRANS_PRIVLEN_1DES_IV);
+ goto test_keychange_again;
+
+ } else if (properlength < BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1)) {
+ hashtype = usmHMACSHA1AuthProtocol;
+ hashname = "usmHMACSHA1AuthProtocol.";
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+ goto test_keychange_again;
+ }
+
+ return failcount;
+
+} /* end test_keychange() */
diff --git a/cleopatre/application/spidnetsnmp/testing/misctest.c b/cleopatre/application/spidnetsnmp/testing/misctest.c
new file mode 100644
index 0000000000..e86beefce2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/misctest.c
@@ -0,0 +1,266 @@
+/*
+ * misctest.c
+ *
+ * Expected SUCCESSes for all tests: 0
+ *
+ * Returns:
+ * Number of FAILUREs.
+ *
+ * Test of dump_snmpEngineID(). SUCCESSes: 0
+ */
+
+static char *rcsid = "$Id: misctest.c 15220 2006-09-15 00:48:50Z tanders $"; /* */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "tools.h"
+#include "transform_oids.h"
+#include "callback.h"
+
+#include <stdlib.h>
+
+extern char *optarg;
+extern int optind, optopt, opterr;
+
+
+
+/*
+ * Globals, &c...
+ */
+char *local_progname;
+
+#define USAGE "Usage: %s [-h][-1a]"
+#define OPTIONLIST "1ah"
+
+int doalltests = 0, dodumpseid = 0;
+
+#define ALLOPTIONS (doalltests + dodumpseid)
+
+
+
+#define LOCAL_MAXBUF (1024 * 8)
+#define NL "\n"
+
+#define OUTPUT(o) fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s) \
+{ \
+ if (!failcount) \
+ fprintf(stdout, "\nSUCCESS: %s\n", s); \
+}
+
+#define FAILED(e, f) \
+{ \
+ if (e != SNMPERR_SUCCESS) { \
+ fprintf(stdout, "\nFAILED: %s\n", f); \
+ failcount += 1; \
+ } \
+}
+
+
+
+
+#define IDBLAT_4 "00010203"
+
+#define IDVIOLATE1 "8000000300deedcafe"
+
+#define IDIPv4 "80000003010a090807"
+#define IDIPv6 "8000000302100f0e0d0c0b0a090807060504030201"
+#define IDMAC "8000000303ffeeddccbbaa"
+
+#define IDTEXT "8000000304"
+#define PRINTABLE "Let this be printable."
+
+#define IDOCTETS_7 "80000003050001020304050607"
+
+#define IDLOCAL_11 "8000000306000102030405060708090a0b"
+
+#define IDIPv4_EXTRA3 "80000003010a090807010203"
+
+#define ID_NUMSTRINGS 10
+
+
+
+
+/*
+ * Prototypes.
+ */
+void usage(FILE * ofp);
+
+int test_dumpseid(void);
+
+
+
+
+
+int
+main(int argc, char **argv)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+ char ch;
+
+ local_progname = argv[0];
+
+ /*
+ * Parse.
+ */
+ while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+ switch (ch) {
+ case '1':
+ dodumpseid = 1;
+ break;
+ case 'a':
+ doalltests = 1;
+ break;
+ case 'h':
+ rval = 0;
+ default:
+ usage(stdout);
+ exit(rval);
+ }
+
+ argc -= 1;
+ argv += 1;
+ if (optarg) {
+ argc -= 1;
+ argv += 1;
+ optarg = NULL;
+ }
+ optind = 1;
+ } /* endwhile getopt */
+
+ if ((argc > 1)) {
+ usage(stdout);
+ exit(1000);
+
+ } else if (ALLOPTIONS != 1) {
+ usage(stdout);
+ exit(1000);
+ }
+
+
+ /*
+ * Test stuff.
+ */
+ if (dodumpseid || doalltests) {
+ failcount += test_dumpseid();
+ }
+
+
+ /*
+ * Cleanup.
+ */
+ return failcount;
+
+} /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+ fprintf(ofp,
+ USAGE
+ "" NL
+ " -1 Test dump_snmpEngineID()." NL
+ " -a All tests." NL
+ " -h Help." NL "" NL, local_progname);
+
+} /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test template.
+ */
+int
+test_dosomething(void)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+
+ EM0(1, "UNIMPLEMENTED"); /* EM(1); /* */
+
+ test_dosomething_quit:
+ return failcount;
+
+} /* end test_dosomething() */
+#endif /* EXAMPLE */
+
+
+
+
+/*******************************************************************-o-******
+ * test_dumpseid
+ *
+ * Returns:
+ * Number of failures.
+ *
+ * Test dump_snmpEngineID().
+ */
+int
+test_dumpseid(void)
+{
+ int /* rval = SNMPERR_SUCCESS, */
+ failcount = 0, tlen, count = 0;
+
+ char buf[SNMP_MAXBUF],
+ *s, *t, *ris, *rawid_set[ID_NUMSTRINGS + 1] = {
+ IDBLAT_4,
+ IDVIOLATE1,
+ IDIPv4,
+ IDIPv6,
+ IDMAC,
+ IDTEXT,
+ IDOCTETS_7,
+ IDLOCAL_11,
+ IDIPv4_EXTRA3,
+ NULL
+ };
+
+ OUTPUT("Test of dump_snmpEngineID. "
+ "(Does not report failure or success.)");
+
+
+ while ((ris = rawid_set[count++])) {
+ tlen = hex_to_binary2(ris, strlen(ris), &t);
+
+ if (ris == IDTEXT) {
+ memset(buf, 0, SNMP_MAXBUF);
+ memcpy(buf, t, tlen);
+ tlen += sprintf(buf + tlen, "%s", PRINTABLE);
+
+ SNMP_FREE(t);
+ t = buf;
+ }
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+ s = dump_snmpEngineID(t, &tlen);
+ printf("%s (len=%d)\n", s, tlen);
+#endif
+
+ SNMP_FREE(s);
+ if (t != buf) {
+ SNMP_FREE(t);
+ }
+ }
+
+
+ return failcount;
+
+} /* end test_dumpseid() */
diff --git a/cleopatre/application/spidnetsnmp/testing/rfc1213/README b/cleopatre/application/spidnetsnmp/testing/rfc1213/README
new file mode 100644
index 0000000000..3802aa8539
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/rfc1213/README
@@ -0,0 +1,25 @@
+#######################################
+# Ling Xiaofeng
+#
+
+These test cases are to test for accessing RFC-1213MIB variable
+To run test:
+cd this directory and type
+./run
+
+#######################################
+# 07-Apr-2004 Mike Slifcak adapted for use with "make test" [RUNTESTS]
+#
+Options
+ Environment Variables
+
+ SNMP_SLEEP -- number of seconds delay between actions. Defaults to 1
+ SNMP_VERBOSE - 1=verbose messages; 0=dots plus summary. Defaults to 0
+
+
+Notes for proper operation in certain environments
+
+ Msys/MinGW provides a _minimal_ GNU environment
+ For best results with these tests:
+ copy c:\msys\bin\sh.exe c:\msys\bin\bash.exe
+
diff --git a/cleopatre/application/spidnetsnmp/testing/rfc1213/run b/cleopatre/application/spidnetsnmp/testing/rfc1213/run
new file mode 100755
index 0000000000..e07a7af252
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/rfc1213/run
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+
+cd `dirname $0`
+
+PATH=..:$PATH
+
+. ../eval_tools.sh
+
+. test_fun
+. snmpfun.sh
+
+SNMP_SLEEP=${SNMP_SLEEP:-"1"}
+SNMP_VERBOSE=${SNMP_VERBOSE:-"0"}
+
+trap "STOPAGENT; DELAY; summary; exit 1" 1 2 3 9 15 19
+
+if [ -z "$1" ] ; then
+ LIST="testmib1.sh testmib2.sh testmib3.sh"
+ MULTI="yes"
+else
+ LIST=testmib${1}.sh
+fi
+
+for f in $LIST
+do
+ if [ -n "$MULTI" ] ; then
+ echo ## start next in series on new line
+ fi
+ if [ $SNMP_VERBOSE -ne 0 ] ; then
+ echo "run test in $f"
+ fi
+
+ . $f
+ dperline=0
+
+ for ic in $iclist
+ do
+ eval tplist=\"\$$ic\"
+ for tp in $tplist
+ do
+ $tp
+ done
+ done
+
+ STOPAGENT
+ DELAY
+done
+
+summary
+
+if [ $fail_num -ne 0 ] ; then
+ RC=1
+else
+ RC=0
+fi
+
+exit $RC
+
diff --git a/cleopatre/application/spidnetsnmp/testing/rfc1213/snmpfun.sh b/cleopatre/application/spidnetsnmp/testing/rfc1213/snmpfun.sh
new file mode 100644
index 0000000000..d87c2409a9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/rfc1213/snmpfun.sh
@@ -0,0 +1,78 @@
+
+# functions used by RFC-1213 MIB test modules
+
+myport=$SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT
+
+noauth="" # no - use Auth+Priv . yes - no auth, no priv
+
+if [ "x$noauth" = xyes ] ; then
+ TEST_AUTHPRIV_PARMS="-l noAuthnoPriv"
+else
+ TEST_AUTHPRIV_PARMS="-l authNoPriv -a MD5 -A testpass"
+fi
+
+config()
+{
+ rm -f $SNMP_CONFIG_FILE
+ CONFIGAGENT rwcommunity test
+ STARTAGENT
+}
+
+configv3()
+{
+ rm -f $SNMP_CONFIG_FILE
+ CONFIGAGENT rwcommunity test
+ CONFIGAGENT rwuser testrwuser noauth
+ CONFIGAGENT createUser testrwuser MD5 testpass
+ STARTAGENT
+}
+
+get_snmp_variable()
+{
+ test_start "Access $2.0 by SNMPv$1..."
+ CAPTURE "snmpget -v $1 -c test $myport $2.0"
+ if [ $? != 0 ];then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
+
+}
+
+get_snmpv3_variable()
+{
+ test_start "Access $2.0 by SNMPv3..."
+ CAPTURE "snmpget -v 3 -u testrwuser $TEST_AUTHPRIV_PARMS $myport $2.0"
+ if [ $? != 0 ];then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
+
+}
+
+get_snmp_table()
+{
+ test_start "Access table $2 by SNMPv$1..."
+ CAPTURE "snmpgetnext -Of -v $1 -c test $myport $2"
+ CHECKFILE '' "\.$2\."
+ if [ "$snmp_last_test_result" = 0 ] ; then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
+
+}
+
+get_snmpv3_table()
+{
+ test_start "Access table $2 by SNMPv3..."
+ CAPTURE "snmpgetnext -Of -v 3 -u testrwuser $TEST_AUTHPRIV_PARMS $myport $2"
+ CHECKFILE '' "\.$2\."
+ if [ "$snmp_last_test_result" = 0 ] ; then
+ test_finish FAIL
+ else
+ test_finish PASS
+ fi
+
+}
diff --git a/cleopatre/application/spidnetsnmp/testing/rfc1213/test_fun b/cleopatre/application/spidnetsnmp/testing/rfc1213/test_fun
new file mode 100644
index 0000000000..b5c6080e22
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/rfc1213/test_fun
@@ -0,0 +1,68 @@
+## no ANSI color for cygwin
+pass_num=0;
+fail_num=0;
+case_num=0;
+tcase_str=""
+dperline=0
+max_dperline=25 # maximum dots per line
+
+pass_info()
+{
+ if [ $SNMP_VERBOSE -ne 0 ] ; then
+# if [ "x$OSTYPE" = "xcygwin" ] ; then
+ echo -en $1
+# else
+# echo -en "\033[1;32m$1\033[0;39m"
+# fi
+ fi
+}
+
+fail_info()
+{
+ if [ $SNMP_VERBOSE -eq 0 ] ; then
+ echo
+ ECHO $tcase_str
+ fi
+# if [ "x$OSTYPE" = "xcygwin" ] ; then
+ echo -en $1
+# else
+# echo -en "\033[1;31m$1\033[0;39m"
+# fi
+}
+
+test_start()
+{
+ case_num=`expr $case_num + 1`;
+ tcase_str="$testnum.$case_num:$1 "
+ if [ $SNMP_VERBOSE -ne 0 ] ; then
+ ECHO $tcase_str
+ else
+ ECHO "."
+ dperline=`expr $dperline + 1`
+ if [ $dperline -ge $max_dperline ] ; then
+ dperline=0
+ echo
+ fi
+ fi
+}
+
+test_finish()
+{
+ if [ x$1 == x"PASS" ];then
+ pass_num=`expr $pass_num + 1`
+ pass_info "PASS\n"
+ else
+ fail_num=`expr $fail_num + 1`
+ fail_info "FAIL\n"
+ fi
+ tcase_str=""
+}
+
+summary()
+{
+ if [ $case_num -ne $pass_num ] ; then
+ echo
+ ECHO "$testnum: $case_num total, $pass_num passed, $fail_num failed. "
+ fi
+}
+
diff --git a/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib1.sh b/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib1.sh
new file mode 100644
index 0000000000..7da5333aad
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib1.sh
@@ -0,0 +1,448 @@
+#!/bin/sh
+#
+# Test for RFC-1213MIB variable
+#
+#
+
+HEADER RFC-1213 MIB SNMPv1 access
+
+iclist="ic1 " # list invocable components
+
+ic1="tp1 tp2 tp3 tp4 tp5 tp6 tp7 tp8 tp9 tp10 tp11 tp12 tp13 tp14 tp15 tp16 tp17 tp18 tp19 tp20 tp21 tp22 tp23 tp24 tp25 tp26 tp27 tp28 tp29 tp30 tp31 tp32 tp33 tp34 tp35 tp36 tp37 tp38 tp39 tp40 tp41 tp42 tp43 tp44 tp45 tp46 tp47 tp48 tp49 tp50 tp51 tp52 tp53 tp54 tp55 tp56 tp57 tp58 tp59 tp60 tp61 tp62 tp63 tp64 tp65 tp66 tp67 tp68 tp69 tp70 tp71 tp72 tp73 tp74 tp75 tp76 tp77 tp78 tp79 tp80 tp81 tp82 tp83 tp84 tp85 tp86 tp87 tp88 tp89 tp90 tp91 tp92 tp93 tp94 tp95 tp96 tp97 tp98 tp99 tp100 tp101 tp102 tp103 tp104 tp105 tp106 tp107 tp108"
+
+
+config
+
+tp1()
+{
+ get_snmp_variable 1 system.sysDescr
+}
+tp2()
+{
+ get_snmp_variable 1 system.sysObjectID
+}
+tp3()
+{
+ get_snmp_variable 1 system.sysUpTime
+}
+tp4()
+{
+ get_snmp_variable 1 system.sysContact
+}
+tp5()
+{
+ get_snmp_variable 1 system.sysName
+}
+tp6()
+{
+ get_snmp_variable 1 system.sysLocation
+}
+tp7()
+{
+ get_snmp_variable 1 interfaces.ifNumber
+}
+tp8()
+{
+ get_snmp_table 1 interfaces.ifTable
+}
+tp9()
+{
+ get_snmp_table 1 at.atTable
+}
+tp10()
+{
+ get_snmp_variable 1 ip.ipInReceives
+}
+tp11()
+{
+ get_snmp_variable 1 ip.ipForwarding
+}
+tp12()
+{
+ get_snmp_variable 1 ip.ipDefaultTTL
+}
+tp13()
+{
+ get_snmp_variable 1 ip.ipInReceives
+}
+tp14()
+{
+ get_snmp_variable 1 ip.ipInHdrErrors
+}
+tp15()
+{
+ get_snmp_variable 1 ip.ipInAddrErrors
+}
+tp16()
+{
+ get_snmp_variable 1 ip.ipForwDatagrams
+}
+tp17()
+{
+ get_snmp_variable 1 ip.ipInUnknownProtos
+}
+tp18()
+{
+ get_snmp_variable 1 ip.ipInDiscards
+}
+tp19()
+{
+ get_snmp_variable 1 ip.ipInDelivers
+}
+tp20()
+{
+ get_snmp_variable 1 ip.ipOutRequests
+}
+tp21()
+{
+ get_snmp_variable 1 ip.ipOutDiscards
+}
+tp22()
+{
+ get_snmp_variable 1 ip.ipOutNoRoutes
+}
+tp23()
+{
+ get_snmp_variable 1 ip.ipReasmTimeout
+}
+tp24()
+{
+ get_snmp_variable 1 ip.ipReasmReqds
+}
+tp25()
+{
+ get_snmp_variable 1 ip.ipReasmOKs
+}
+tp26()
+{
+ get_snmp_variable 1 ip.ipReasmFails
+}
+tp27()
+{
+ get_snmp_variable 1 ip.ipFragOKs
+}
+tp28()
+{
+ get_snmp_variable 1 ip.ipFragFails
+}
+tp29()
+{
+ get_snmp_variable 1 ip.ipFragCreates
+}
+tp30()
+{
+ get_snmp_variable 1 ip.ipRoutingDiscards
+}
+tp31()
+{
+ get_snmp_table 1 ip.ipAddrTable
+}
+tp32()
+{
+ get_snmp_table 1 ip.ipRouteTable
+}
+tp33()
+{
+ get_snmp_table 1 ip.ipNetToMediaTable
+}
+tp34()
+{
+ get_snmp_variable 1 icmp.icmpInMsgs
+}
+tp35()
+{
+ get_snmp_variable 1 icmp.icmpInErrors
+}
+tp36()
+{
+ get_snmp_variable 1 icmp.icmpInDestUnreachs
+}
+tp37()
+{
+ get_snmp_variable 1 icmp.icmpInTimeExcds
+}
+tp38()
+{
+ get_snmp_variable 1 icmp.icmpInParmProbs
+}
+tp39()
+{
+ get_snmp_variable 1 icmp.icmpInSrcQuenchs
+}
+tp40()
+{
+ get_snmp_variable 1 icmp.icmpInRedirects
+}
+tp41()
+{
+ get_snmp_variable 1 icmp.icmpInEchos
+}
+tp42()
+{
+ get_snmp_variable 1 icmp.icmpInEchoReps
+}
+tp43()
+{
+ get_snmp_variable 1 icmp.icmpInTimestamps
+}
+tp44()
+{
+ get_snmp_variable 1 icmp.icmpInTimestampReps
+}
+tp45()
+{
+ get_snmp_variable 1 icmp.icmpInAddrMasks
+}
+tp46()
+{
+ get_snmp_variable 1 icmp.icmpInAddrMaskReps
+}
+tp47()
+{
+ get_snmp_variable 1 icmp.icmpOutMsgs
+}
+tp48()
+{
+ get_snmp_variable 1 icmp.icmpOutErrors
+}
+tp49()
+{
+ get_snmp_variable 1 icmp.icmpOutDestUnreachs
+}
+tp50()
+{
+ get_snmp_variable 1 icmp.icmpOutTimeExcds
+}
+tp51()
+{
+ get_snmp_variable 1 icmp.icmpOutParmProbs
+}
+tp52()
+{
+ get_snmp_variable 1 icmp.icmpOutSrcQuenchs
+}
+tp53()
+{
+ get_snmp_variable 1 icmp.icmpOutRedirects
+}
+tp54()
+{
+ get_snmp_variable 1 icmp.icmpOutEchos
+}
+tp55()
+{
+ get_snmp_variable 1 icmp.icmpOutEchoReps
+}
+tp56()
+{
+ get_snmp_variable 1 icmp.icmpOutTimestamps
+}
+tp57()
+{
+ get_snmp_variable 1 icmp.icmpOutTimestampReps
+}
+tp58()
+{
+ get_snmp_variable 1 icmp.icmpOutAddrMasks
+}
+tp59()
+{
+ get_snmp_variable 1 icmp.icmpOutAddrMaskReps
+}
+tp60()
+{
+ get_snmp_variable 1 tcp.tcpActiveOpens
+}
+tp61()
+{
+ get_snmp_variable 1 tcp.tcpRtoAlgorithm
+}
+tp62()
+{
+ get_snmp_variable 1 tcp.tcpRtoMin
+}
+tp63()
+{
+ get_snmp_variable 1 tcp.tcpRtoMax
+}
+tp64()
+{
+ get_snmp_variable 1 tcp.tcpMaxConn
+}
+tp65()
+{
+ get_snmp_variable 1 tcp.tcpActiveOpens
+}
+tp66()
+{
+ get_snmp_variable 1 tcp.tcpPassiveOpens
+}
+tp67()
+{
+ get_snmp_variable 1 tcp.tcpAttemptFails
+}
+tp68()
+{
+ get_snmp_variable 1 tcp.tcpEstabResets
+}
+tp69()
+{
+ get_snmp_variable 1 tcp.tcpCurrEstab
+}
+tp70()
+{
+ get_snmp_variable 1 tcp.tcpInSegs
+}
+tp71()
+{
+ get_snmp_variable 1 tcp.tcpOutSegs
+}
+tp72()
+{
+ get_snmp_variable 1 tcp.tcpRetransSegs
+}
+tp73()
+{
+ get_snmp_variable 1 tcp.tcpInErrs
+}
+tp74()
+{
+ get_snmp_variable 1 tcp.tcpOutRsts
+}
+tp75()
+{
+ get_snmp_table 1 tcp.tcpConnTable
+}
+tp76()
+{
+ get_snmp_variable 1 udp.udpInDatagrams
+}
+tp77()
+{
+ get_snmp_variable 1 udp.udpNoPorts
+}
+tp78()
+{
+ get_snmp_variable 1 udp.udpInErrors
+}
+tp79()
+{
+ get_snmp_variable 1 udp.udpOutDatagrams
+}
+tp80()
+{
+ get_snmp_table 1 udp.udpTable
+}
+tp81()
+{
+ get_snmp_variable 1 snmp.snmpInPkts
+}
+tp82()
+{
+ get_snmp_variable 1 snmp.snmpOutPkts
+}
+tp83()
+{
+ get_snmp_variable 1 snmp.snmpInBadVersions
+}
+tp84()
+{
+ get_snmp_variable 1 snmp.snmpInBadCommunityNames
+}
+tp85()
+{
+ get_snmp_variable 1 snmp.snmpInBadCommunityUses
+}
+tp86()
+{
+ get_snmp_variable 1 snmp.snmpInASNParseErrs
+}
+tp87()
+{
+ get_snmp_variable 1 snmp.snmpInTooBigs
+}
+tp88()
+{
+ get_snmp_variable 1 snmp.snmpInNoSuchNames
+}
+tp89()
+{
+ get_snmp_variable 1 snmp.snmpInBadValues
+}
+tp90()
+{
+ get_snmp_variable 1 snmp.snmpInReadOnlys
+}
+tp91()
+{
+ get_snmp_variable 1 snmp.snmpInGenErrs
+}
+tp92()
+{
+ get_snmp_variable 1 snmp.snmpInTotalReqVars
+}
+tp93()
+{
+ get_snmp_variable 1 snmp.snmpInTotalSetVars
+}
+tp94()
+{
+ get_snmp_variable 1 snmp.snmpInGetRequests
+}
+tp95()
+{
+ get_snmp_variable 1 snmp.snmpInGetNexts
+}
+tp96()
+{
+ get_snmp_variable 1 snmp.snmpInSetRequests
+}
+tp97()
+{
+ get_snmp_variable 1 snmp.snmpInGetResponses
+}
+tp98()
+{
+ get_snmp_variable 1 snmp.snmpInTraps
+}
+tp99()
+{
+ get_snmp_variable 1 snmp.snmpOutTooBigs
+}
+tp100()
+{
+ get_snmp_variable 1 snmp.snmpOutNoSuchNames
+}
+tp101()
+{
+ get_snmp_variable 1 snmp.snmpOutBadValues
+}
+tp102()
+{
+ get_snmp_variable 1 snmp.snmpOutGenErrs
+}
+tp103()
+{
+ get_snmp_variable 1 snmp.snmpOutGetRequests
+}
+tp104()
+{
+ get_snmp_variable 1 snmp.snmpOutGetNexts
+}
+tp105()
+{
+ get_snmp_variable 1 snmp.snmpOutSetRequests
+}
+tp106()
+{
+ get_snmp_variable 1 snmp.snmpOutGetResponses
+}
+tp107()
+{
+ get_snmp_variable 1 snmp.snmpOutTraps
+}
+tp108()
+{
+ get_snmp_variable 1 snmp.snmpEnableAuthenTraps
+}
+
diff --git a/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib2.sh b/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib2.sh
new file mode 100644
index 0000000000..adae571f3c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib2.sh
@@ -0,0 +1,447 @@
+#!/bin/sh
+#
+# Test for RFC-1213MIB variable
+#
+#
+
+HEADER RFC-1213 MIB SNMPv2c access
+
+iclist="ic1 " # list invocable components
+
+ic1="tp1 tp2 tp3 tp4 tp5 tp6 tp7 tp8 tp9 tp10 tp11 tp12 tp13 tp14 tp15 tp16 tp17 tp18 tp19 tp20 tp21 tp22 tp23 tp24 tp25 tp26 tp27 tp28 tp29 tp30 tp31 tp32 tp33 tp34 tp35 tp36 tp37 tp38 tp39 tp40 tp41 tp42 tp43 tp44 tp45 tp46 tp47 tp48 tp49 tp50 tp51 tp52 tp53 tp54 tp55 tp56 tp57 tp58 tp59 tp60 tp61 tp62 tp63 tp64 tp65 tp66 tp67 tp68 tp69 tp70 tp71 tp72 tp73 tp74 tp75 tp76 tp77 tp78 tp79 tp80 tp81 tp82 tp83 tp84 tp85 tp86 tp87 tp88 tp89 tp90 tp91 tp92 tp93 tp94 tp95 tp96 tp97 tp98 tp99 tp100 tp101 tp102 tp103 tp104 tp105 tp106 tp107 tp108"
+
+config
+
+tp1()
+{
+ get_snmp_variable 2c system.sysDescr
+}
+tp2()
+{
+ get_snmp_variable 2c system.sysObjectID
+}
+tp3()
+{
+ get_snmp_variable 2c system.sysUpTime
+}
+tp4()
+{
+ get_snmp_variable 2c system.sysContact
+}
+tp5()
+{
+ get_snmp_variable 2c system.sysName
+}
+tp6()
+{
+ get_snmp_variable 2c system.sysLocation
+}
+tp7()
+{
+ get_snmp_variable 2c interfaces.ifNumber
+}
+tp8()
+{
+ get_snmp_table 2c interfaces.ifTable
+}
+tp9()
+{
+ get_snmp_table 2c at.atTable
+}
+tp10()
+{
+ get_snmp_variable 2c ip.ipInReceives
+}
+tp11()
+{
+ get_snmp_variable 2c ip.ipForwarding
+}
+tp12()
+{
+ get_snmp_variable 2c ip.ipDefaultTTL
+}
+tp13()
+{
+ get_snmp_variable 2c ip.ipInReceives
+}
+tp14()
+{
+ get_snmp_variable 2c ip.ipInHdrErrors
+}
+tp15()
+{
+ get_snmp_variable 2c ip.ipInAddrErrors
+}
+tp16()
+{
+ get_snmp_variable 2c ip.ipForwDatagrams
+}
+tp17()
+{
+ get_snmp_variable 2c ip.ipInUnknownProtos
+}
+tp18()
+{
+ get_snmp_variable 2c ip.ipInDiscards
+}
+tp19()
+{
+ get_snmp_variable 2c ip.ipInDelivers
+}
+tp20()
+{
+ get_snmp_variable 2c ip.ipOutRequests
+}
+tp21()
+{
+ get_snmp_variable 2c ip.ipOutDiscards
+}
+tp22()
+{
+ get_snmp_variable 2c ip.ipOutNoRoutes
+}
+tp23()
+{
+ get_snmp_variable 2c ip.ipReasmTimeout
+}
+tp24()
+{
+ get_snmp_variable 2c ip.ipReasmReqds
+}
+tp25()
+{
+ get_snmp_variable 2c ip.ipReasmOKs
+}
+tp26()
+{
+ get_snmp_variable 2c ip.ipReasmFails
+}
+tp27()
+{
+ get_snmp_variable 2c ip.ipFragOKs
+}
+tp28()
+{
+ get_snmp_variable 2c ip.ipFragFails
+}
+tp29()
+{
+ get_snmp_variable 2c ip.ipFragCreates
+}
+tp30()
+{
+ get_snmp_variable 2c ip.ipRoutingDiscards
+}
+tp31()
+{
+ get_snmp_table 2c ip.ipAddrTable
+}
+tp32()
+{
+ get_snmp_table 2c ip.ipRouteTable
+}
+tp33()
+{
+ get_snmp_table 2c ip.ipNetToMediaTable
+}
+tp34()
+{
+ get_snmp_variable 2c icmp.icmpInMsgs
+}
+tp35()
+{
+ get_snmp_variable 2c icmp.icmpInErrors
+}
+tp36()
+{
+ get_snmp_variable 2c icmp.icmpInDestUnreachs
+}
+tp37()
+{
+ get_snmp_variable 2c icmp.icmpInTimeExcds
+}
+tp38()
+{
+ get_snmp_variable 2c icmp.icmpInParmProbs
+}
+tp39()
+{
+ get_snmp_variable 2c icmp.icmpInSrcQuenchs
+}
+tp40()
+{
+ get_snmp_variable 2c icmp.icmpInRedirects
+}
+tp41()
+{
+ get_snmp_variable 2c icmp.icmpInEchos
+}
+tp42()
+{
+ get_snmp_variable 2c icmp.icmpInEchoReps
+}
+tp43()
+{
+ get_snmp_variable 2c icmp.icmpInTimestamps
+}
+tp44()
+{
+ get_snmp_variable 2c icmp.icmpInTimestampReps
+}
+tp45()
+{
+ get_snmp_variable 2c icmp.icmpInAddrMasks
+}
+tp46()
+{
+ get_snmp_variable 2c icmp.icmpInAddrMaskReps
+}
+tp47()
+{
+ get_snmp_variable 2c icmp.icmpOutMsgs
+}
+tp48()
+{
+ get_snmp_variable 2c icmp.icmpOutErrors
+}
+tp49()
+{
+ get_snmp_variable 2c icmp.icmpOutDestUnreachs
+}
+tp50()
+{
+ get_snmp_variable 2c icmp.icmpOutTimeExcds
+}
+tp51()
+{
+ get_snmp_variable 2c icmp.icmpOutParmProbs
+}
+tp52()
+{
+ get_snmp_variable 2c icmp.icmpOutSrcQuenchs
+}
+tp53()
+{
+ get_snmp_variable 2c icmp.icmpOutRedirects
+}
+tp54()
+{
+ get_snmp_variable 2c icmp.icmpOutEchos
+}
+tp55()
+{
+ get_snmp_variable 2c icmp.icmpOutEchoReps
+}
+tp56()
+{
+ get_snmp_variable 2c icmp.icmpOutTimestamps
+}
+tp57()
+{
+ get_snmp_variable 2c icmp.icmpOutTimestampReps
+}
+tp58()
+{
+ get_snmp_variable 2c icmp.icmpOutAddrMasks
+}
+tp59()
+{
+ get_snmp_variable 2c icmp.icmpOutAddrMaskReps
+}
+tp60()
+{
+ get_snmp_variable 2c tcp.tcpActiveOpens
+}
+tp61()
+{
+ get_snmp_variable 2c tcp.tcpRtoAlgorithm
+}
+tp62()
+{
+ get_snmp_variable 2c tcp.tcpRtoMin
+}
+tp63()
+{
+ get_snmp_variable 2c tcp.tcpRtoMax
+}
+tp64()
+{
+ get_snmp_variable 2c tcp.tcpMaxConn
+}
+tp65()
+{
+ get_snmp_variable 2c tcp.tcpActiveOpens
+}
+tp66()
+{
+ get_snmp_variable 2c tcp.tcpPassiveOpens
+}
+tp67()
+{
+ get_snmp_variable 2c tcp.tcpAttemptFails
+}
+tp68()
+{
+ get_snmp_variable 2c tcp.tcpEstabResets
+}
+tp69()
+{
+ get_snmp_variable 2c tcp.tcpCurrEstab
+}
+tp70()
+{
+ get_snmp_variable 2c tcp.tcpInSegs
+}
+tp71()
+{
+ get_snmp_variable 2c tcp.tcpOutSegs
+}
+tp72()
+{
+ get_snmp_variable 2c tcp.tcpRetransSegs
+}
+tp73()
+{
+ get_snmp_variable 2c tcp.tcpInErrs
+}
+tp74()
+{
+ get_snmp_variable 2c tcp.tcpOutRsts
+}
+tp75()
+{
+ get_snmp_table 2c tcp.tcpConnTable
+}
+tp76()
+{
+ get_snmp_variable 2c udp.udpInDatagrams
+}
+tp77()
+{
+ get_snmp_variable 2c udp.udpNoPorts
+}
+tp78()
+{
+ get_snmp_variable 2c udp.udpInErrors
+}
+tp79()
+{
+ get_snmp_variable 2c udp.udpOutDatagrams
+}
+tp80()
+{
+ get_snmp_table 2c udp.udpTable
+}
+tp81()
+{
+ get_snmp_variable 2c snmp.snmpInPkts
+}
+tp82()
+{
+ get_snmp_variable 2c snmp.snmpOutPkts
+}
+tp83()
+{
+ get_snmp_variable 2c snmp.snmpInBadVersions
+}
+tp84()
+{
+ get_snmp_variable 2c snmp.snmpInBadCommunityNames
+}
+tp85()
+{
+ get_snmp_variable 2c snmp.snmpInBadCommunityUses
+}
+tp86()
+{
+ get_snmp_variable 2c snmp.snmpInASNParseErrs
+}
+tp87()
+{
+ get_snmp_variable 2c snmp.snmpInTooBigs
+}
+tp88()
+{
+ get_snmp_variable 2c snmp.snmpInNoSuchNames
+}
+tp89()
+{
+ get_snmp_variable 2c snmp.snmpInBadValues
+}
+tp90()
+{
+ get_snmp_variable 2c snmp.snmpInReadOnlys
+}
+tp91()
+{
+ get_snmp_variable 2c snmp.snmpInGenErrs
+}
+tp92()
+{
+ get_snmp_variable 2c snmp.snmpInTotalReqVars
+}
+tp93()
+{
+ get_snmp_variable 2c snmp.snmpInTotalSetVars
+}
+tp94()
+{
+ get_snmp_variable 2c snmp.snmpInGetRequests
+}
+tp95()
+{
+ get_snmp_variable 2c snmp.snmpInGetNexts
+}
+tp96()
+{
+ get_snmp_variable 2c snmp.snmpInSetRequests
+}
+tp97()
+{
+ get_snmp_variable 2c snmp.snmpInGetResponses
+}
+tp98()
+{
+ get_snmp_variable 2c snmp.snmpInTraps
+}
+tp99()
+{
+ get_snmp_variable 2c snmp.snmpOutTooBigs
+}
+tp100()
+{
+ get_snmp_variable 2c snmp.snmpOutNoSuchNames
+}
+tp101()
+{
+ get_snmp_variable 2c snmp.snmpOutBadValues
+}
+tp102()
+{
+ get_snmp_variable 2c snmp.snmpOutGenErrs
+}
+tp103()
+{
+ get_snmp_variable 2c snmp.snmpOutGetRequests
+}
+tp104()
+{
+ get_snmp_variable 2c snmp.snmpOutGetNexts
+}
+tp105()
+{
+ get_snmp_variable 2c snmp.snmpOutSetRequests
+}
+tp106()
+{
+ get_snmp_variable 2c snmp.snmpOutGetResponses
+}
+tp107()
+{
+ get_snmp_variable 2c snmp.snmpOutTraps
+}
+tp108()
+{
+ get_snmp_variable 2c snmp.snmpEnableAuthenTraps
+}
+
diff --git a/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib3.sh b/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib3.sh
new file mode 100644
index 0000000000..e1038c9dbc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/rfc1213/testmib3.sh
@@ -0,0 +1,448 @@
+#!/bin/sh
+#
+# Test for RFC-1213MIB variable
+#
+#
+
+HEADER RFC-1213 MIB SNMPv3 access
+
+iclist="ic1 " # list invocable components
+
+ic1="tp1 tp2 tp3 tp4 tp5 tp6 tp7 tp8 tp9 tp10 tp11 tp12 tp13 tp14 tp15 tp16 tp17 tp18 tp19 tp20 tp21 tp22 tp23 tp24 tp25 tp26 tp27 tp28 tp29 tp30 tp31 tp32 tp33 tp34 tp35 tp36 tp37 tp38 tp39 tp40 tp41 tp42 tp43 tp44 tp45 tp46 tp47 tp48 tp49 tp50 tp51 tp52 tp53 tp54 tp55 tp56 tp57 tp58 tp59 tp60 tp61 tp62 tp63 tp64 tp65 tp66 tp67 tp68 tp69 tp70 tp71 tp72 tp73 tp74 tp75 tp76 tp77 tp78 tp79 tp80 tp81 tp82 tp83 tp84 tp85 tp86 tp87 tp88 tp89 tp90 tp91 tp92 tp93 tp94 tp95 tp96 tp97 tp98 tp99 tp100 tp101 tp102 tp103 tp104 tp105 tp106 tp107 tp108"
+
+configv3
+
+tp1()
+{
+ get_snmpv3_variable 3 system.sysDescr
+}
+tp2()
+{
+ get_snmpv3_variable 3 system.sysObjectID
+}
+tp3()
+{
+ get_snmpv3_variable 3 system.sysUpTime
+}
+tp4()
+{
+ get_snmpv3_variable 3 system.sysContact
+}
+tp5()
+{
+ get_snmpv3_variable 3 system.sysName
+}
+tp6()
+{
+ get_snmpv3_variable 3 system.sysLocation
+}
+tp7()
+{
+ get_snmpv3_variable 3 interfaces.ifNumber
+}
+tp8()
+{
+ get_snmpv3_table 3 interfaces.ifTable
+}
+tp9()
+{
+ get_snmpv3_table 3 at.atTable
+}
+tp10()
+{
+ get_snmpv3_variable 3 ip.ipInReceives
+}
+tp11()
+{
+ get_snmpv3_variable 3 ip.ipForwarding
+}
+tp12()
+{
+ get_snmpv3_variable 3 ip.ipDefaultTTL
+}
+tp13()
+{
+ get_snmpv3_variable 3 ip.ipInReceives
+}
+tp14()
+{
+ get_snmpv3_variable 3 ip.ipInHdrErrors
+}
+tp15()
+{
+ get_snmpv3_variable 3 ip.ipInAddrErrors
+}
+tp16()
+{
+ get_snmpv3_variable 3 ip.ipForwDatagrams
+}
+tp17()
+{
+ get_snmpv3_variable 3 ip.ipInUnknownProtos
+}
+tp18()
+{
+ get_snmpv3_variable 3 ip.ipInDiscards
+}
+tp19()
+{
+ get_snmpv3_variable 3 ip.ipInDelivers
+}
+tp20()
+{
+ get_snmpv3_variable 3 ip.ipOutRequests
+}
+tp21()
+{
+ get_snmpv3_variable 3 ip.ipOutDiscards
+}
+tp22()
+{
+ get_snmpv3_variable 3 ip.ipOutNoRoutes
+}
+tp23()
+{
+ get_snmpv3_variable 3 ip.ipReasmTimeout
+}
+tp24()
+{
+ get_snmpv3_variable 3 ip.ipReasmReqds
+}
+tp25()
+{
+ get_snmpv3_variable 3 ip.ipReasmOKs
+}
+tp26()
+{
+ get_snmpv3_variable 3 ip.ipReasmFails
+}
+tp27()
+{
+ get_snmpv3_variable 3 ip.ipFragOKs
+}
+tp28()
+{
+ get_snmpv3_variable 3 ip.ipFragFails
+}
+tp29()
+{
+ get_snmpv3_variable 3 ip.ipFragCreates
+}
+tp30()
+{
+ get_snmpv3_variable 3 ip.ipRoutingDiscards
+}
+tp31()
+{
+ get_snmpv3_table 3 ip.ipAddrTable
+}
+tp32()
+{
+ get_snmpv3_table 3 ip.ipRouteTable
+}
+tp33()
+{
+ get_snmpv3_table 3 ip.ipNetToMediaTable
+}
+tp34()
+{
+ get_snmpv3_variable 3 icmp.icmpInMsgs
+}
+tp35()
+{
+ get_snmpv3_variable 3 icmp.icmpInErrors
+}
+tp36()
+{
+ get_snmpv3_variable 3 icmp.icmpInDestUnreachs
+}
+tp37()
+{
+ get_snmpv3_variable 3 icmp.icmpInTimeExcds
+}
+tp38()
+{
+ get_snmpv3_variable 3 icmp.icmpInParmProbs
+}
+tp39()
+{
+ get_snmpv3_variable 3 icmp.icmpInSrcQuenchs
+}
+tp40()
+{
+ get_snmpv3_variable 3 icmp.icmpInRedirects
+}
+tp41()
+{
+ get_snmpv3_variable 3 icmp.icmpInEchos
+}
+tp42()
+{
+ get_snmpv3_variable 3 icmp.icmpInEchoReps
+}
+tp43()
+{
+ get_snmpv3_variable 3 icmp.icmpInTimestamps
+}
+tp44()
+{
+ get_snmpv3_variable 3 icmp.icmpInTimestampReps
+}
+tp45()
+{
+ get_snmpv3_variable 3 icmp.icmpInAddrMasks
+}
+tp46()
+{
+ get_snmpv3_variable 3 icmp.icmpInAddrMaskReps
+}
+tp47()
+{
+ get_snmpv3_variable 3 icmp.icmpOutMsgs
+}
+tp48()
+{
+ get_snmpv3_variable 3 icmp.icmpOutErrors
+}
+tp49()
+{
+ get_snmpv3_variable 3 icmp.icmpOutDestUnreachs
+}
+tp50()
+{
+ get_snmpv3_variable 3 icmp.icmpOutTimeExcds
+}
+tp51()
+{
+ get_snmpv3_variable 3 icmp.icmpOutParmProbs
+}
+tp52()
+{
+ get_snmpv3_variable 3 icmp.icmpOutSrcQuenchs
+}
+tp53()
+{
+ get_snmpv3_variable 3 icmp.icmpOutRedirects
+}
+tp54()
+{
+ get_snmpv3_variable 3 icmp.icmpOutEchos
+}
+tp55()
+{
+ get_snmpv3_variable 3 icmp.icmpOutEchoReps
+}
+tp56()
+{
+ get_snmpv3_variable 3 icmp.icmpOutTimestamps
+}
+tp57()
+{
+ get_snmpv3_variable 3 icmp.icmpOutTimestampReps
+}
+tp58()
+{
+ get_snmpv3_variable 3 icmp.icmpOutAddrMasks
+}
+tp59()
+{
+ get_snmpv3_variable 3 icmp.icmpOutAddrMaskReps
+}
+tp60()
+{
+ get_snmpv3_variable 3 tcp.tcpActiveOpens
+}
+tp61()
+{
+ get_snmpv3_variable 3 tcp.tcpRtoAlgorithm
+}
+tp62()
+{
+ get_snmpv3_variable 3 tcp.tcpRtoMin
+}
+tp63()
+{
+ get_snmpv3_variable 3 tcp.tcpRtoMax
+}
+tp64()
+{
+ get_snmpv3_variable 3 tcp.tcpMaxConn
+}
+tp65()
+{
+ get_snmpv3_variable 3 tcp.tcpActiveOpens
+}
+tp66()
+{
+ get_snmpv3_variable 3 tcp.tcpPassiveOpens
+}
+tp67()
+{
+ get_snmpv3_variable 3 tcp.tcpAttemptFails
+}
+tp68()
+{
+ get_snmpv3_variable 3 tcp.tcpEstabResets
+}
+tp69()
+{
+ get_snmpv3_variable 3 tcp.tcpCurrEstab
+}
+tp70()
+{
+ get_snmpv3_variable 3 tcp.tcpInSegs
+}
+tp71()
+{
+ get_snmpv3_variable 3 tcp.tcpOutSegs
+}
+tp72()
+{
+ get_snmpv3_variable 3 tcp.tcpRetransSegs
+}
+tp73()
+{
+ get_snmpv3_variable 3 tcp.tcpInErrs
+}
+tp74()
+{
+ get_snmpv3_variable 3 tcp.tcpOutRsts
+}
+tp75()
+{
+ get_snmpv3_table 3 tcp.tcpConnTable
+}
+tp76()
+{
+ get_snmpv3_variable 3 udp.udpInDatagrams
+}
+tp77()
+{
+ get_snmpv3_variable 3 udp.udpNoPorts
+}
+tp78()
+{
+ get_snmpv3_variable 3 udp.udpInErrors
+}
+tp79()
+{
+ get_snmpv3_variable 3 udp.udpOutDatagrams
+}
+tp80()
+{
+ get_snmpv3_table 3 udp.udpTable
+}
+tp81()
+{
+ get_snmpv3_variable 3 snmp.snmpInPkts
+}
+tp82()
+{
+ get_snmpv3_variable 3 snmp.snmpOutPkts
+}
+tp83()
+{
+ get_snmpv3_variable 3 snmp.snmpInBadVersions
+}
+tp84()
+{
+ get_snmpv3_variable 3 snmp.snmpInBadCommunityNames
+}
+tp85()
+{
+ get_snmpv3_variable 3 snmp.snmpInBadCommunityUses
+}
+tp86()
+{
+ get_snmpv3_variable 3 snmp.snmpInASNParseErrs
+}
+tp87()
+{
+ get_snmpv3_variable 3 snmp.snmpInTooBigs
+}
+tp88()
+{
+ get_snmpv3_variable 3 snmp.snmpInNoSuchNames
+}
+tp89()
+{
+ get_snmpv3_variable 3 snmp.snmpInBadValues
+}
+tp90()
+{
+ get_snmpv3_variable 3 snmp.snmpInReadOnlys
+}
+tp91()
+{
+ get_snmpv3_variable 3 snmp.snmpInGenErrs
+}
+tp92()
+{
+ get_snmpv3_variable 3 snmp.snmpInTotalReqVars
+}
+tp93()
+{
+ get_snmpv3_variable 3 snmp.snmpInTotalSetVars
+}
+tp94()
+{
+ get_snmpv3_variable 3 snmp.snmpInGetRequests
+}
+tp95()
+{
+ get_snmpv3_variable 3 snmp.snmpInGetNexts
+}
+tp96()
+{
+ get_snmpv3_variable 3 snmp.snmpInSetRequests
+}
+tp97()
+{
+ get_snmpv3_variable 3 snmp.snmpInGetResponses
+}
+tp98()
+{
+ get_snmpv3_variable 3 snmp.snmpInTraps
+}
+tp99()
+{
+ get_snmpv3_variable 3 snmp.snmpOutTooBigs
+}
+tp100()
+{
+ get_snmpv3_variable 3 snmp.snmpOutNoSuchNames
+}
+tp101()
+{
+ get_snmpv3_variable 3 snmp.snmpOutBadValues
+}
+tp102()
+{
+ get_snmpv3_variable 3 snmp.snmpOutGenErrs
+}
+tp103()
+{
+ get_snmpv3_variable 3 snmp.snmpOutGetRequests
+}
+tp104()
+{
+ get_snmpv3_variable 3 snmp.snmpOutGetNexts
+}
+tp105()
+{
+ get_snmpv3_variable 3 snmp.snmpOutSetRequests
+}
+tp106()
+{
+ get_snmpv3_variable 3 snmp.snmpOutGetResponses
+}
+tp107()
+{
+ get_snmpv3_variable 3 snmp.snmpOutTraps
+}
+tp108()
+{
+ get_snmpv3_variable 3 snmp.snmpEnableAuthenTraps
+}
+
+
diff --git a/cleopatre/application/spidnetsnmp/testing/scapitest.c b/cleopatre/application/spidnetsnmp/testing/scapitest.c
new file mode 100644
index 0000000000..9d6305e2c4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/scapitest.c
@@ -0,0 +1,489 @@
+/*
+ * scapitest.c
+ *
+ * Expected SUCCESSes: 2 + 10 + 1 for all tests.
+ *
+ * Returns:
+ * Number of FAILUREs.
+ *
+ *
+ * ASSUMES No key management functions return non-zero success codes.
+ *
+ * XXX Split into individual modules?
+ * XXX Error/fringe conditions should be tested.
+ *
+ *
+ * Test of sc_random. SUCCESSes: 2.
+ * REQUIRES a human to spot check for obvious non-randomness...
+ *
+ * Test of sc_generate_keyed_hash and sc_check_keyed_hash. SUCCESSes: 10.
+ *
+ * Test of sc_encrypt and sc_decrypt. SUCCESSes: 1.
+ */
+
+static char *rcsid = "$Id: scapitest.c 6918 2002-04-20 07:30:29Z hardaker $"; /* */
+
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include "asn1.h"
+#include "snmp_api.h"
+#include "keytools.h"
+#include "tools.h"
+#include "scapi.h"
+#include "transform_oids.h"
+#include "callback.h"
+
+#include <stdlib.h>
+
+extern char *optarg;
+extern int optind, optopt, opterr;
+
+#define DEBUG /* */
+
+
+
+/*
+ * Globals, &c...
+ */
+char *local_progname;
+
+#define USAGE "Usage: %s [-h][-acHr]"
+#define OPTIONLIST "achHr"
+
+int doalltests = 0, docrypt = 0, dokeyedhash = 0, dorandom = 0;
+
+#define ALLOPTIONS (doalltests + docrypt + dokeyedhash + dorandom)
+
+
+
+#define LOCAL_MAXBUF (1024 * 8)
+#define NL "\n"
+
+#define OUTPUT(o) fprintf(stdout, "\n\n%s\n\n", o);
+
+#define SUCCESS(s) \
+{ \
+ if (!failcount) \
+ fprintf(stdout, "\nSUCCESS: %s\n", s); \
+}
+
+#define FAILED(e, f) \
+{ \
+ if (e != SNMPERR_SUCCESS) { \
+ fprintf(stdout, "\nFAILED: %s\n", f); \
+ failcount += 1; \
+ } \
+}
+
+
+#define BIGSTRING \
+ " A port may be a pleasant retreat for any mind grown weary of" \
+ "the struggle for existence. The vast expanse of sky, the" \
+ "mobile architecture of the clouds, the chameleon coloration" \
+ "of the sea, the beacons flashing on the shore, together make" \
+ "a prism which is marvellously calculated to entertain but not" \
+ "fatigue the eye. The lofty ships with their complex webs of" \
+ "rigging, swayed to and fro by the swell in harmonious dance," \
+ "all help to maintain a taste for rhythm and beauty in the" \
+ "mind. And above all there is a mysterious, aristrocratic kind" \
+ "of pleasure to be had, for those who have lost all curiosity" \
+ "or ambition, as they strech on the belvedere or lean over the" \
+ "mole to watch the arrivals and departures of other men, those" \
+ "who still have sufficient strength of purpose in them, the" \
+ "urge to travel or enrich themselves." \
+ " -- Baudelaire" \
+ " From _The_Poems_in_Prose_, \"The Port\" (XLI)."
+
+#define BIGSECRET "Shhhh... Don't tell *anyone* about this. Not a soul."
+#define BKWDSECRET ".luos a toN .siht tuoba *enoyna* llet t'noD ...hhhhS"
+
+#define MLCOUNT_MAX 6 /* MAC Length Count Maximum. */
+
+
+
+/*
+ * Prototypes.
+ */
+void usage(FILE * ofp);
+
+int test_docrypt(void);
+int test_dokeyedhash(void);
+int test_dorandom(void);
+
+
+
+
+int
+main(int argc, char **argv)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+ char ch;
+
+ local_progname = argv[0];
+
+ /*
+ * Parse.
+ */
+ while ((ch = getopt(argc, argv, OPTIONLIST)) != EOF) {
+ switch (ch) {
+ case 'a':
+ doalltests = 1;
+ break;
+ case 'c':
+ docrypt = 1;
+ break;
+ case 'H':
+ dokeyedhash = 1;
+ break;
+ case 'r':
+ dorandom = 1;
+ break;
+ case 'h':
+ rval = 0;
+ default:
+ usage(stdout);
+ exit(rval);
+ }
+
+ argc -= 1;
+ argv += 1;
+ optind = 1;
+ } /* endwhile getopt */
+
+ if ((argc > 1)) {
+ usage(stdout);
+ exit(1000);
+
+ } else if (ALLOPTIONS != 1) {
+ usage(stdout);
+ exit(1000);
+ }
+
+
+ /*
+ * Test stuff.
+ */
+ rval = sc_init();
+ FAILED(rval, "sc_init().");
+
+
+ if (docrypt || doalltests) {
+ failcount += test_docrypt();
+ }
+ if (dokeyedhash || doalltests) {
+ failcount += test_dokeyedhash();
+ }
+ if (dorandom || doalltests) {
+ failcount += test_dorandom();
+ }
+
+
+ /*
+ * Cleanup.
+ */
+ rval = sc_shutdown(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+ NULL, NULL);
+ FAILED(rval, "sc_shutdown().");
+
+ return failcount;
+
+} /* end main() */
+
+
+
+
+
+void
+usage(FILE * ofp)
+{
+ fprintf(ofp,
+ USAGE
+ "" NL
+ " -a All tests." NL
+ " -c Test of sc_encrypt()/sc_decrypt()."
+ NL
+ " -h Help."
+ NL
+ " -H Test sc_{generate,check}_keyed_hash()."
+ NL
+ " -r Test sc_random()."
+ NL "" NL, local_progname);
+
+} /* end usage() */
+
+
+
+
+#ifdef EXAMPLE
+/*******************************************************************-o-******
+ * test_dosomething
+ *
+ * Test template.
+ *
+ * Returns:
+ * Number of failures.
+ */
+int
+test_dosomething(void)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0;
+
+ EM0(1, "UNIMPLEMENTED"); /* EM(1); /* */
+
+ test_dosomething_quit:
+ return failcount;
+
+} /* end test_dosomething() */
+#endif /* EXAMPLE */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_dorandom
+ *
+ * One large request, one set of short requests.
+ *
+ * Returns:
+ * Number of failures.
+ *
+ * XXX probably should split up into individual options.
+ */
+int
+test_dorandom(void)
+{
+ int rval = SNMPERR_SUCCESS,
+ failcount = 0,
+ origrequest = (1024 * 2),
+ origrequest_short = 19, nbytes = origrequest, shortcount = 7, i;
+ char buf[LOCAL_MAXBUF];
+
+ OUTPUT("Random test -- large request:");
+
+ rval = sc_random(buf, &nbytes);
+ FAILED(rval, "sc_random().");
+
+ if (nbytes != origrequest) {
+ FAILED(SNMPERR_GENERR,
+ "sc_random() returned different than requested.");
+ }
+
+ dump_chunk("scapitest", NULL, buf, nbytes);
+
+ SUCCESS("Random test -- large request.");
+
+
+ OUTPUT("Random test -- short requests:");
+ origrequest_short = 16;
+
+ for (i = 0; i < shortcount; i++) {
+ nbytes = origrequest_short;
+ rval = sc_random(buf, &nbytes);
+ FAILED(rval, "sc_random().");
+
+ if (nbytes != origrequest_short) {
+ FAILED(SNMPERR_GENERR,
+ "sc_random() returned different " "than requested.");
+ }
+
+ dump_chunk("scapitest", NULL, buf, nbytes);
+ } /* endfor */
+
+ SUCCESS("Random test -- short requests.");
+
+
+ return failcount;
+
+} /* end test_dorandom() */
+
+
+
+/*******************************************************************-o-******
+ * test_dokeyedhash
+ *
+ * Returns:
+ * Number of failures.
+ *
+ *
+ * Test keyed hashes with a variety of MAC length requests.
+ *
+ *
+ * NOTE Both tests intentionally use the same secret
+ *
+ * FIX Get input or output from some other package which hashes...
+ * XXX Could cut this in half with a little indirection...
+ */
+int
+test_dokeyedhash(void)
+{
+ int rval = SNMPERR_SUCCESS, failcount = 0, bigstring_len = strlen(BIGSTRING), secret_len = strlen(BIGSECRET), properlength, mlcount = 0, /* MAC Length count. */
+ hblen; /* Hash Buffer length. */
+
+ u_int hashbuf_len[MLCOUNT_MAX] = {
+ LOCAL_MAXBUF,
+ BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1),
+ BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5),
+ BYTESIZE(SNMP_TRANS_AUTHLEN_HMAC96),
+ 7,
+ 0,
+ };
+
+ u_char hashbuf[LOCAL_MAXBUF];
+ char *s;
+
+ test_dokeyedhash_again:
+
+ OUTPUT("Keyed hash test using MD5 --");
+
+ memset(hashbuf, 0, LOCAL_MAXBUF);
+ hblen = hashbuf_len[mlcount];
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACMD5);
+
+ rval =
+ sc_generate_keyed_hash(usmHMACMD5AuthProtocol,
+ USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+ secret_len, BIGSTRING, bigstring_len,
+ hashbuf, &hblen);
+ FAILED(rval, "sc_generate_keyed_hash().");
+
+ if (hashbuf_len[mlcount] > properlength) {
+ if (hblen != properlength) {
+ FAILED(SNMPERR_GENERR, "Wrong MD5 hash length returned. (1)");
+ }
+
+ } else if (hblen != hashbuf_len[mlcount]) {
+ FAILED(SNMPERR_GENERR, "Wrong MD5 hash length returned. (2)");
+ }
+
+ rval =
+ sc_check_keyed_hash(usmHMACMD5AuthProtocol,
+ USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+ secret_len, BIGSTRING, bigstring_len, hashbuf,
+ hblen);
+ FAILED(rval, "sc_check_keyed_hash().");
+
+ binary_to_hex(hashbuf, hblen, &s);
+ fprintf(stdout, "hash buffer (len=%d, request=%d): %s\n",
+ hblen, hashbuf_len[mlcount], s);
+ SNMP_FREE(s);
+
+ SUCCESS("Keyed hash test using MD5.");
+
+
+
+ OUTPUT("Keyed hash test using SHA1 --");
+
+ memset(hashbuf, 0, LOCAL_MAXBUF);
+ hblen = hashbuf_len[mlcount];
+ properlength = BYTESIZE(SNMP_TRANS_AUTHLEN_HMACSHA1);
+
+ rval =
+ sc_generate_keyed_hash(usmHMACSHA1AuthProtocol,
+ USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+ secret_len, BIGSTRING, bigstring_len,
+ hashbuf, &hblen);
+ FAILED(rval, "sc_generate_keyed_hash().");
+
+ if (hashbuf_len[mlcount] > properlength) {
+ if (hblen != properlength) {
+ FAILED(SNMPERR_GENERR,
+ "Wrong SHA1 hash length returned. (1)");
+ }
+
+ } else if (hblen != hashbuf_len[mlcount]) {
+ FAILED(SNMPERR_GENERR, "Wrong SHA1 hash length returned. (2)");
+ }
+
+ rval =
+ sc_check_keyed_hash(usmHMACSHA1AuthProtocol,
+ USM_LENGTH_OID_TRANSFORM, BIGSECRET,
+ secret_len, BIGSTRING, bigstring_len, hashbuf,
+ hblen);
+ FAILED(rval, "sc_check_keyed_hash().");
+
+ binary_to_hex(hashbuf, hblen, &s);
+ fprintf(stdout, "hash buffer (len=%d, request=%d): %s\n",
+ hblen, hashbuf_len[mlcount], s);
+ SNMP_FREE(s);
+
+ SUCCESS("Keyed hash test using SHA1.");
+
+
+
+ /*
+ * Run the basic hash tests but vary the size MAC requests.
+ */
+ if (hashbuf_len[++mlcount] != 0) {
+ goto test_dokeyedhash_again;
+ }
+
+
+ return failcount;
+
+} /* end test_dokeyedhash() */
+
+
+
+
+
+/*******************************************************************-o-******
+ * test_docrypt
+ *
+ * Returns:
+ * Number of failures.
+ */
+int
+test_docrypt(void)
+{
+ int rval = SNMPERR_SUCCESS,
+ failcount = 0,
+ bigstring_len = strlen(BIGSTRING),
+ secret_len = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES),
+ iv_len = BYTESIZE(SNMP_TRANS_PRIVLEN_1DES_IV);
+
+ u_int buf_len = LOCAL_MAXBUF, cryptbuf_len = LOCAL_MAXBUF;
+
+ char buf[LOCAL_MAXBUF],
+ cryptbuf[LOCAL_MAXBUF], secret[LOCAL_MAXBUF], iv[LOCAL_MAXBUF];
+
+ OUTPUT("Test 1DES-CBC --");
+
+
+ memset(buf, 0, LOCAL_MAXBUF);
+
+ memcpy(secret, BIGSECRET, secret_len);
+ memcpy(iv, BKWDSECRET, iv_len);
+
+
+ rval = sc_encrypt(usmDESPrivProtocol, USM_LENGTH_OID_TRANSFORM,
+ secret, secret_len,
+ iv, iv_len,
+ BIGSTRING, bigstring_len, cryptbuf, &cryptbuf_len);
+ FAILED(rval, "sc_encrypt().");
+
+ rval = sc_decrypt(usmDESPrivProtocol, USM_LENGTH_OID_TRANSFORM,
+ secret, secret_len,
+ iv, iv_len, cryptbuf, cryptbuf_len, buf, &buf_len);
+ FAILED(rval, "sc_decrypt().");
+
+ if (buf_len != bigstring_len) {
+ FAILED(SNMPERR_GENERR, "Decrypted buffer is the wrong length.");
+ }
+ if (memcmp(buf, BIGSTRING, bigstring_len)) {
+ FAILED(SNMPERR_GENERR,
+ "Decrypted buffer is not equal to original plaintext.");
+ }
+
+
+ SUCCESS("Test 1DES-CBC --");
+
+ return failcount;
+
+} /* end test_docrypt() */
diff --git a/cleopatre/application/spidnetsnmp/testing/test_keychange.sh b/cleopatre/application/spidnetsnmp/testing/test_keychange.sh
new file mode 100755
index 0000000000..9259fe5f23
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/test_keychange.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# test_keychange.sh
+#
+# Number of SUCCESSes: 3
+#
+#
+# Run test of KeyChange TC against data given by Bert Wijnen in email.
+#
+# NOTE The snmp_debug flag bit DEBUG_RANDOMZEROS in file snmplib/debug.h
+# MUST be set before compiling and linking libsnmp.a to testing/ktest
+# for this to succeed.
+#
+
+
+. eval_tools.sh
+
+VERIFY ktest
+
+STARTTEST
+
+
+#------------------------------------ -o-
+# Declarations.
+#
+DATAFILE_PREFIX=data.keychange-
+DATAFILE_SUFFIXES="md5 sha1 sha1-des"
+
+oldkul=
+newkul=
+keychangestring=
+
+
+
+#------------------------------------ -o-
+# Test.
+#
+for dfs in $DATAFILE_SUFFIXES; do
+ OUTPUT "== Test of KeyChange TC correctness for \"$dfs\"."
+
+ set x `awk '{ print $1 }' ${DATAFILE_PREFIX}$dfs`
+ shift
+
+ [ $# -lt 3 ] && FAILED 1 \
+ "Wrong number of lines ($#) in datafile \"$DATAFILE_PREFIX}$dfs\"."
+
+ oldkey=$1
+ newkey=$2
+ keychangestring=$3
+
+ CAPTURE "ktest -k -O $oldkey -N $newkey"
+ FAILED $? "ktest"
+
+ CHECKEXACT $keychangestring
+ [ $? -eq 1 ]
+ FAILED $? "Proper KeyChange string was not generated."
+
+
+ SUCCESS "KeyChange TC correctness test for \"$dfs\"."
+done
+
+
+
+
+#------------------------------------ -o-
+# Cleanup, exit.
+#
+STOPTEST
+
+exit $failcount
+
diff --git a/cleopatre/application/spidnetsnmp/testing/test_kul.sh b/cleopatre/application/spidnetsnmp/testing/test_kul.sh
new file mode 100755
index 0000000000..70b7b76873
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/test_kul.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# test_kul.sh
+#
+# Number of SUCCESSes: 2
+#
+# Run key localization tests and compare with data given in the USM
+# documentation.
+#
+# FIX CHECKEXACT() will produce 2 lines when SCAPI is built with
+# SNMP_TESTING_CODE, but only 1 line without the #define. The script
+# assumes SNMP_TESTING_CODE is defined.
+#
+#
+
+
+. eval_tools.sh
+
+VERIFY ktest
+
+STARTTEST
+
+
+#------------------------------------ -o-
+# Declarations.
+#
+DATAFILE_PREFIX=data.kul-
+DATAFILE_SUFFIXES="md5 sha1"
+
+P=
+Ku=
+engineID=
+kul=
+
+
+
+#------------------------------------ -o-
+# Test.
+#
+for dfs in $DATAFILE_SUFFIXES; do
+ OUTPUT "== Test of key localization correctness with transform \"$dfs\"."
+
+ set x `awk '{ print $1 }' ${DATAFILE_PREFIX}$dfs`
+ shift
+
+ [ $# -lt 4 ] && FAILED 1 \
+ "Wrong number of lines ($#) in datafile \"$DATAFILE_PREFIX}$dfs\"."
+
+ P=$1
+ Ku=$2
+ engineID=$3
+ kul=$4
+
+ CAPTURE "ktest -l -P $P -E $engineID "
+ FAILED $? "ktest"
+
+ CHECKEXACT $Ku
+ [ $? -eq 2 ]
+ FAILED $? "Master key was not generated."
+
+ CHECKEXACT $kul
+ [ $? -eq 2 ]
+ FAILED $? "Localized key was not generated."
+
+
+ SUCCESS "Key localization correctness test with transform \"$dfs\"."
+done
+
+
+
+
+#------------------------------------ -o-
+# Cleanup, exit.
+#
+STOPTEST
+
+exit $failcount
+
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Sv1config b/cleopatre/application/spidnetsnmp/testing/tests/Sv1config
new file mode 100644
index 0000000000..f3c045baac
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Sv1config
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+snmp_version=v1
+. ./Svanyconfig
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Sv2cconfig b/cleopatre/application/spidnetsnmp/testing/tests/Sv2cconfig
new file mode 100644
index 0000000000..375e0876b7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Sv2cconfig
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+snmp_version=v2c
+. ./Svanyconfig
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Sv3config b/cleopatre/application/spidnetsnmp/testing/tests/Sv3config
new file mode 100644
index 0000000000..43a7fb2a2d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Sv3config
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+[ "x$SNMP_SMUX_SOCKET" = "x" ] && SNMP_SMUX_SOCKET=1.0.0.0
+
+CONFIGAGENT [snmp] persistentdir $SNMP_TMP_PERSISTENTDIR
+CONFIGAGENT smuxsocket $SNMP_SMUX_SOCKET
+
+# XXX: auto-switch to a supported protocol instead.
+if test "x$DEFAUTHTYPE" = "x"; then
+ if grep '^#define NETSNMP_USE_OPENSSL 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null ; then
+ DEFAUTHTYPE="SHA"
+ else
+ DEFAUTHTYPE="MD5"
+ fi
+fi
+
+if test "x$DEFPRIVTYPE" = "x"; then
+ # XXX: HAVE_AES depends on cpp logic, so we need to test for lower-level stuff
+ if grep '^#define NETSNMP_USE_OPENSSL 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null ; then
+ if grep '^#define HAVE_OPENSSL_AES_H 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null ; then
+ if grep '^#define HAVE_AES_CFB128_ENCRYPT 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null ; then
+ DEFPRIVTYPE="AES"
+ else
+ DEFPRIVTYPE="DES"
+ fi
+ else
+ DEFPRIVTYPE="DES"
+ fi
+ else
+ DEFPRIVTYPE=""
+ fi
+fi
+
+CONFIGAGENT createUser initial $DEFAUTHTYPE initial_test_pass_auth $DEFPRIVTYPE
+CONFIGAGENT createUser template $DEFAUTHTYPE template_test_pass_auth $DEFPRIVTYPE
+CONFIGAGENT rwuser initial noauth
+CONFIGAGENT rwuser newtestuser
+
+NOAUTHTESTARGS="-l nanp -u initial -v 3"
+AUTHTESTARGS="-l anp -u initial -v 3 -a $DEFAUTHTYPE -A initial_test_pass_auth"
+PRIVTESTARGS="-l ap -u initial -v 3 -a $DEFAUTHTYPE -A initial_test_pass_auth -x $DEFPRIVTYPE -X initial_test_pass_auth"
+
+AUTHNOPASSTESTARGS="-l anp -u initial -v 3 -a $DEFAUTHTYPE"
+PRIVNOPASSTESTARGS="-l ap -u initial -v 3 -a $DEFAUTHTYPE -x $DEFPRIVTYPE"
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigagent b/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigagent
new file mode 100644
index 0000000000..72aaffa5b8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigagent
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# SNMPv3 USM config for snmpd
+#
+
+## common SNMPv3 USM config
+. ./Sv3usmconfigbase
+
+## standard config
+CONFIGAGENT [snmp] persistentdir $SNMP_TMP_PERSISTENTDIR
+[ "x$SNMP_SMUX_SOCKET" = "x" ] && SNMP_SMUX_SOCKET=1.0.0.0
+CONFIGAGENT smuxsocket $SNMP_SMUX_SOCKET
+[ "x$CREATEAUTHUSER" != "x" ] && CONFIGAGENT $CREATEAUTHUSER
+[ "x$CREATEAUTHUSER2" != "x" ] && CONFIGAGENT $CREATEAUTHUSER2
+[ "x$CREATEPRIVUSER" != "x" ] && CONFIGAGENT $CREATEPRIVUSER
+[ "x$CREATEPRIVUSER2" != "x" ] && CONFIGAGENT $CREATEPRIVUSER2
+CONFIGAGENT rwuser $TESTAUTHUSER auth
+CONFIGAGENT rwuser $TESTPRIVUSER priv
+
+CONFIGAGENT_ENGINEID() {
+ AGENT_ENGINEID=0x80001f88801ff4905ea7804943
+ CONFIGAGENT oldEngineID $AGENT_ENGINEID
+}
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigbase b/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigbase
new file mode 100644
index 0000000000..f2418943f1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigbase
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# SNMPv3 base config
+#
+# Input+Output variables:
+# DEFSECURITYLEVEL noAuthNoPriv|authNoPriv|authPriv
+# DEFAUTHTYPE MD5|SHA
+# DEFPRIVTYPE DES|AES
+# TESTNOAUTHUSER <myuser>
+# TEST(AUTH|PRIV)USER[2] <myuser>
+# TEST(AUTH|PRIV)PASS[2] <mypass>
+#
+# Input variables:
+# CREATEUSERENGINEID <engineid>
+#
+# Output variables:
+# CREATEAUTHUSER[2]
+# CREATEPRIVUSER[2]
+# CREATENOAUTHUSER
+# TESTNOAUTHARGS
+# TESTAUTHARGS[NOPASS][2]
+# TESTPRIVARGS[NOPASS][2]
+#
+
+## Defaults
+[ "x$DEFSECURITYLEVEL" = "x" ] && DEFSECURITYLEVEL=authPriv
+
+## auto-probe best auth type
+if grep '^#define NETSNMP_USE_OPENSSL 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null ; then
+ MAXAUTHTYPE=SHA
+else
+ # MD5 is always available internally
+ MAXAUTHTYPE=MD5
+fi
+
+## auto-probe best priv type
+# XXX: HAVE_AES depends on cpp logic, so we need to test for lower-level stuff
+if grep '^#define NETSNMP_USE_OPENSSL 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null; then
+ if grep '^#define HAVE_OPENSSL_AES_H 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null && \
+ grep '^#define HAVE_AES_CFB128_ENCRYPT 1' $SNMP_UPDIR/include/net-snmp/net-snmp-config.h $SNMP_UPDIR/include/net-snmp/agent/mib_module_config.h > /dev/null ; then
+ MAXPRIVTYPE=AES
+ else
+ MAXPRIVTYPE=DES
+ fi
+else
+ MAXPRIVTYPE=""
+fi
+
+CREATEUSERCMD="createUser"
+[ "x$CREATEUSERENGINEID" != "x" ] && CREATEUSERCMD="$CREATEUSERCMD -e $CREATEUSERENGINEID"
+
+## auth setup
+if [ "x$DEFSECURITYLEVEL" = "xauthPriv" -o "x$DEFSECURITYLEVEL" = "xauthNoPriv" ]; then
+ [ "x$MAXAUTHTYPE" = "x" ] && SKIP
+ [ "x$DEFAUTHTYPE" = "xSHA" -a "x$MAXAUTHTYPE" != "xSHA" ] && SKIP
+ [ "x$DEFAUTHTYPE" = "x" ] && DEFAUTHTYPE=$MAXAUTHTYPE
+ # user/pass setup (XXX: randomize)
+ [ "x$TESTAUTHUSER" = "x" ] && TESTAUTHUSER=initial_auth
+ [ "x$TESTAUTHUSER2" = "x" ] && TESTAUTHUSER2=template_auth
+ [ "x$TESTAUTHPASS" = "x" ] && TESTAUTHPASS=initial_test_pass_auth
+ [ "x$TESTAUTHPASS2" = "x" ] && TESTAUTHPASS2=template_test_pass_auth
+ CREATEAUTHUSER="$CREATEUSERCMD $TESTAUTHUSER $DEFAUTHTYPE $TESTAUTHPASS"
+ CREATEAUTHUSER2="$CREATEUSERCMD $TESTAUTHUSER2 $DEFAUTHTYPE $TESTAUTHPASS2"
+ # command args
+ TESTAUTHARGSNOPASS="-v 3 -l anp -u $TESTAUTHUSER -a $DEFAUTHTYPE"
+ TESTAUTHARGSNOPASS2="-v 3 -l anp -u $TESTAUTHUSER2 -a $DEFAUTHTYPE"
+ TESTAUTHARGS="$TESTAUTHARGSNOPASS -A $TESTAUTHPASS"
+ TESTAUTHARGS2="$TESTAUTHARGSNOPASS2 -A $TESTAUTHPASS2"
+fi
+
+## priv setup
+if [ "x$DEFSECURITYLEVEL" = "xauthPriv" ]; then
+ [ "x$MAXPRIVTYPE" = "x" ] && SKIP
+ [ "x$DEFPRIVTYPE" = "xAES" -a "x$MAXPRIVTYPE" != "xAES" ] && SKIP
+ [ "x$DEFPRIVTYPE" = "x" ] && DEFPRIVTYPE=$MAXPRIVTYPE
+ # user/pass setup (XXX: randomize)
+ [ "x$TESTPRIVUSER" = "x" ] && TESTPRIVUSER=initial_priv
+ [ "x$TESTPRIVUSER2" = "x" ] && TESTPRIVUSER2=template_priv
+ [ "x$TESTPRIVPASS" = "x" ] && TESTPRIVPASS=initial_test_pass_priv
+ [ "x$TESTPRIVPASS2" = "x" ] && TESTPRIVPASS2=template_test_pass_priv
+ CREATEPRIVUSER="$CREATEUSERCMD $TESTPRIVUSER $DEFAUTHTYPE $TESTAUTHPASS $DEFPRIVTYPE $TESTPRIVPASS"
+ CREATEPRIVUSER2="$CREATEUSERCMD $TESTPRIVUSER2 $DEFAUTHTYPE $TESTAUTHPASS2 $DEFPRIVTYPE $TESTPRIVPASS2"
+ # command args
+ TESTPRIVARGSNOPASS="-v 3 -l ap -u $TESTPRIVUSER -a $DEFAUTHTYPE -x $DEFPRIVTYPE"
+ TESTPRIVARGSNOPASS2="-v 3 -l ap -u $TESTPRIVUSER2 -a $DEFAUTHTYPE -x $DEFPRIVTYPE"
+ TESTPRIVARGS="$TESTPRIVARGSNOPASS -A $TESTAUTHPASS -X $TESTPRIVPASS"
+ TESTPRIVARGS2="$TESTPRIVARGSNOPASS2 -A $TESTAUTHPASS2 -X $TESTPRIVPASS2"
+fi
+
+## noauth setup
+[ "x$TESTNOAUTHUSER" = "x" ] && TESTNOAUTHUSER=initial
+TESTNOAUTHARGS="-v 3 -l nanp -u $TESTNOAUTHUSER"
+CREATENOAUTHUSER="$CREATEUSERCMD $TESTNOAUTHUSER"
+
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigtrapd b/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigtrapd
new file mode 100644
index 0000000000..4938959a6a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Sv3usmconfigtrapd
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# SNMPv3 USM config for snmptrapd
+#
+
+TRAPD_ENGINEID=0x80001f88802b3d0e06bbdf4e43
+
+## common SNMPv3 USM config
+. ./Sv3usmconfigbase
+
+## standard config
+CONFIGTRAPD [snmp] persistentDir $SNMP_TMP_PERSISTENTDIR
+CONFIGTRAPD oldEngineID $TRAPD_ENGINEID
+[ "x$CREATENOAUTHUSER" != "x" ] && CONFIGTRAPD $CREATENOAUTHUSER
+[ "x$CREATEAUTHUSER" != "x" ] && CONFIGTRAPD $CREATEAUTHUSER
+[ "x$CREATEAUTHUSER2" != "x" ] && CONFIGTRAPD $CREATEAUTHUSER2
+[ "x$CREATEPRIVUSER" != "x" ] && CONFIGTRAPD $CREATEPRIVUSER
+[ "x$CREATEPRIVUSER2" != "x" ] && CONFIGTRAPD $CREATEPRIVUSER2
+
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Sv3vacmconfig b/cleopatre/application/spidnetsnmp/testing/tests/Sv3vacmconfig
new file mode 100644
index 0000000000..3d7bf953dc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Sv3vacmconfig
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# generically set up the user "initial1" and "initial2" for snmp v3
+# access to the agent.
+
+# Configuration:
+#initial1 can access .1.3.6.1.2.1.1.1, deny others
+#initial2 can access all except .1.3.6.1.2.1.1.1
+
+# XXX: do autoselection of supported algorithms
+SKIPIF NETSNMP_DISABLE_MD5
+SKIPIF NETSNMP_DISABLE_DES
+
+CONFIGAGENT [snmp] persistentdir $SNMP_TMP_PERSISTENTDIR
+
+CONFIGAGENT createUser initial1 MD5 initial_test_pass_auth DES
+CONFIGAGENT createUser initial2 MD5 initial_test_pass_auth DES
+
+
+CONFIGAGENT group testcommunitygroup1 usm initial1
+CONFIGAGENT group testcommunitygroup2 usm initial2
+
+CONFIGAGENT view system1 included .1.3.6.1.2.1.1.1
+CONFIGAGENT view system2 included .1
+CONFIGAGENT view system2 excluded .1.3.6.1.2.1.1.1
+CONFIGAGENT 'access testcommunitygroup1 "" any auth exact system1 none none'
+CONFIGAGENT 'access testcommunitygroup2 "" any auth exact system2 none none'
+
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Svacmconfig b/cleopatre/application/spidnetsnmp/testing/tests/Svacmconfig
new file mode 100644
index 0000000000..cdcc35b8ad
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Svacmconfig
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# standard V1 configuration: testcommunity1 testcommunity2
+# testcommunity1 can access .1.3.6.1.2.1.1.1, others are denied
+# generically set up the community "testcommunity1 and testcommunity2" for various snmp
+# version access to the agent.
+
+if [ "x$snmp_version" = "x" ]; then
+ snmp_version="any"
+fi
+
+CONFIGAGENT [snmp] persistentdir $SNMP_TMP_PERSISTENTDIR
+
+CONFIGAGENT rocommunity testrocommunity 127.0.0.1 .1.3.6.1.2.1.1.5.0
+CONFIGAGENT rwcommunity testrwcommunity 127.0.0.1 .1.3.6.1.2.1.1.5.0
+
+CONFIGAGENT com2sec testcommunitysec1 default testcommunity1
+CONFIGAGENT com2sec testcommunitysec2 default testcommunity2
+
+if [ "$SNMP_TRANSPORT_SPEC" = "udp6" -o "$SNMP_TRANSPORT_SPEC" = "tcp6" ];then
+CONFIGAGENT com2sec6 testcommunitysec1 default testcommunity1
+CONFIGAGENT com2sec6 testcommunitysec2 default testcommunity2
+fi
+
+if [ "$SNMP_TRANSPORT_SPEC" = "unix" ];then
+CONFIGAGENT com2secunix testcommunitysec1 testcommunity1
+CONFIGAGENT com2secunix testcommunitysec2 testcommunity2
+fi
+
+CONFIGAGENT group testcommunitygroup1 $snmp_version testcommunitysec1
+CONFIGAGENT group testcommunitygroup2 $snmp_version testcommunitysec2
+
+CONFIGAGENT view system1 included .1.3.6.1.2.1.1.1
+CONFIGAGENT view system2 included .1
+CONFIGAGENT view system2 excluded .1.3.6.1.2.1.1.1
+CONFIGAGENT 'access testcommunitygroup1 "" any noauth exact system1 none none'
+CONFIGAGENT 'access testcommunitygroup2 "" any noauth exact system2 none none'
+
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/Svanyconfig b/cleopatre/application/spidnetsnmp/testing/tests/Svanyconfig
new file mode 100644
index 0000000000..ad4d3b5b67
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/Svanyconfig
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# generically set up the community "testcommunity" for various snmp
+# version access to the agent.
+
+if [ "x$snmp_version" = "x" ]; then
+ snmp_version="any"
+fi
+
+[ "x$SNMP_SMUX_SOCKET" = "x" ] && SNMP_SMUX_SOCKET=1.0.0.0
+
+CONFIGAGENT [snmp] persistentdir $SNMP_TMP_PERSISTENTDIR
+CONFIGAGENT smuxsocket $SNMP_SMUX_SOCKET
+
+CONFIGAGENT com2sec testcommunitysec default testcommunity
+if [ "$SNMP_TRANSPORT_SPEC" = "udp6" -o "$SNMP_TRANSPORT_SPEC" = "tcp6" ];then
+ CONFIGAGENT com2sec6 testcommunitysec default testcommunity
+fi
+
+if [ "$SNMP_TRANSPORT_SPEC" = "unix" ];then
+ CONFIGAGENT com2secunix testcommunitysec testcommunity
+fi
+
+CONFIGAGENT group testcommunitygroup $snmp_version testcommunitysec
+CONFIGAGENT view all included .1 80
+CONFIGAGENT 'access testcommunitygroup "" any noauth exact all none none'
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T001snmpv1get b/cleopatre/application/spidnetsnmp/testing/tests/T001snmpv1get
new file mode 100644
index 0000000000..22cb060693
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T001snmpv1get
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv1 support
+
+SKIPIF NETSNMP_DISABLE_SNMPV1
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv1config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+CAPTURE "snmpgetnext -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3"
+
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.1"
+
+CHECKORDIE "Error in packet"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECKORDIE "Timeout"
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T014snmpv2cget b/cleopatre/application/spidnetsnmp/testing/tests/T014snmpv2cget
new file mode 100644
index 0000000000..271f978244
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T014snmpv2cget
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c get of system.sysUpTime.0
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T015snmpv2cgetnext b/cleopatre/application/spidnetsnmp/testing/tests/T015snmpv2cgetnext
new file mode 100644
index 0000000000..6c3fdf65c9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T015snmpv2cgetnext
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c getnext of system.sysUpTime
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpgetnext -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T0160snmpv2cbulkget b/cleopatre/application/spidnetsnmp/testing/tests/T0160snmpv2cbulkget
new file mode 100755
index 0000000000..ec2c42710b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T0160snmpv2cbulkget
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c bulkget of system components
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2 configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpbulkget $SNMP_FLAGS -v2c -On -Cn1 -Cr2 -c testcommunity $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4 .1.3.6.1.2.1.1"
+
+STOPAGENT
+
+CHECKORDIE ".1.3.6.1.2.1.1.4.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.2.0 = OID:"
+
+CHECK ".1.3.6.1.2.1.1.3.0"
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=1
+ FINISHED
+fi
+
+CHECK ".1.3.6.1.2.1.1.5.0"
+EXPECTRESULT 0
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=1
+ FINISHED
+fi
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T016snmpv2cgetfail b/cleopatre/application/spidnetsnmp/testing/tests/T016snmpv2cgetfail
new file mode 100644
index 0000000000..4bc2412615
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T016snmpv2cgetfail
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+#
+# test snmpv2c get support by reading a variable
+#
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv2c get with wrong community
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Timeout"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T017snmpv2ctov1getfail b/cleopatre/application/spidnetsnmp/testing/tests/T017snmpv2ctov1getfail
new file mode 100644
index 0000000000..8a97942396
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T017snmpv2ctov1getfail
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#
+# test snmpv2c get support by reading a variable
+#
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv2c get against SNMPv1 agent
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIF NETSNMP_DISABLE_SNMPV1
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv1config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Timeout"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T018snmpv1tov2cgetfail b/cleopatre/application/spidnetsnmp/testing/tests/T018snmpv1tov2cgetfail
new file mode 100644
index 0000000000..f36cd4d686
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T018snmpv1tov2cgetfail
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv1 get against SNMPv2c agent
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIF NETSNMP_DISABLE_SNMPV1
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c notavalidcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Timeout"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T019snmpv2cnosuch b/cleopatre/application/spidnetsnmp/testing/tests/T019snmpv2cnosuch
new file mode 100644
index 0000000000..e69ab9a91d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T019snmpv2cnosuch
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c get of system.sysUpTime.1
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V2C configuration: testcomunnity
+. ./Sv2cconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.1"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.1 = No Such Instance"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T020snmpv3get b/cleopatre/application/spidnetsnmp/testing/tests/T020snmpv3get
new file mode 100644
index 0000000000..58c6ce379f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T020snmpv3get
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using noAuthNoPriv of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# configure the agent to accept user initial with noAuthNoPriv
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS $NOAUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T021snmpv3getnext b/cleopatre/application/spidnetsnmp/testing/tests/T021snmpv3getnext
new file mode 100755
index 0000000000..2b9f6464df
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T021snmpv3getnext
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 getnext using initial of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# configure the agent to accept user initial with noAuthNoPriv
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpgetnext -On $SNMP_FLAGS $NOAUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT system.sysUpTime"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T0220snmpv3bulkget b/cleopatre/application/spidnetsnmp/testing/tests/T0220snmpv3bulkget
new file mode 100755
index 0000000000..8a8ecb765e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T0220snmpv3bulkget
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 bulkget of system
+
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration:
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpbulkget $SNMP_FLAGS -On -Cn1 -Cr2 $NOAUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4 .1.3.6.1.2.1.1"
+
+STOPAGENT
+
+CHECKORDIE ".1.3.6.1.2.1.1.4.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = STRING:"
+CHECKORDIE ".1.3.6.1.2.1.1.2.0 = OID:"
+
+CHECK ".1.3.6.1.2.1.1.3.0"
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=1
+ FINISHED
+fi
+
+CHECK ".1.3.6.1.2.1.1.5.0"
+EXPECTRESULT 0
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=1
+ FINISHED
+fi
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T022snmpv3getMD5 b/cleopatre/application/spidnetsnmp/testing/tests/T022snmpv3getMD5
new file mode 100755
index 0000000000..9e7960d343
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T022snmpv3getMD5
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using MD5/noPriv of .1.3.6.1.2.1.1.3.0
+
+SKIPIF NETSNMP_DISABLE_MD5
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+DEFAUTHTYPE="MD5"
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5AES b/cleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5AES
new file mode 100644
index 0000000000..773c98043d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5AES
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using MD5/AES of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+SKIPIFNOT HAVE_AES_CFB128_ENCRYPT
+SKIPIF NETSNMP_DISABLE_MD5
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+DEFAUTHTYPE=MD5
+DEFPRIVTYPE=AES
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS $PRIVTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5DES b/cleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5DES
new file mode 100755
index 0000000000..0689deafae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T023snmpv3getMD5DES
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using MD5/DES of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+SKIPIF NETSNMP_DISABLE_MD5
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+DEFAUTHTYPE=MD5
+DEFPRIVTYPE=DES
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS $PRIVTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T024snmpv3getSHA1 b/cleopatre/application/spidnetsnmp/testing/tests/T024snmpv3getSHA1
new file mode 100755
index 0000000000..9c1474dc3b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T024snmpv3getSHA1
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using SHA/noPriv of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT NETSNMP_USE_OPENSSL
+
+#
+# Begin test
+#
+
+# standard V3 configuration for templateSHA user
+DEFAUTHTYPE="SHA"
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T025snmpv3getSHADES b/cleopatre/application/spidnetsnmp/testing/tests/T025snmpv3getSHADES
new file mode 100755
index 0000000000..94fbaca3bd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T025snmpv3getSHADES
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using SHA/DES of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+SKIPIF NETSNMP_DISABLE_DES
+
+#
+# Begin test
+#
+
+# standard V3 configuration for templateSHA user
+DEFAUTHTYPE="SHA"
+DEFPRIVTYPE="DES"
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS $PRIVTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T026snmpv3getSHAAES b/cleopatre/application/spidnetsnmp/testing/tests/T026snmpv3getSHAAES
new file mode 100644
index 0000000000..766513ace3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T026snmpv3getSHAAES
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 get using SHA/AES of .1.3.6.1.2.1.1.3.0
+
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+SKIPIFNOT HAVE_AES_CFB128_ENCRYPT
+
+#
+# Begin test
+#
+
+# standard V3 configuration for templateSHA user
+DEFPRIVTYPE="AES"
+DEFAUTHTYPE="SHA"
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS $PRIVTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T028snmpv3getfail b/cleopatre/application/spidnetsnmp/testing/tests/T028snmpv3getfail
new file mode 100755
index 0000000000..99095e1f2f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T028snmpv3getfail
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER for failure of SNMPv3 get using unknown user.
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -l nanp -u unknownuser $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+CHECK "Unknown user name"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T030snmpv3usercreation b/cleopatre/application/spidnetsnmp/testing/tests/T030snmpv3usercreation
new file mode 100644
index 0000000000..259c59a714
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T030snmpv3usercreation
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 agent USM user management with snmpusm
+
+SKIPIF NETSNMP_DISABLE_SET_SUPPORT
+SKIPIFNOT USING_SNMPV3_USMUSER_MODULE
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+
+#
+# Begin test
+#
+
+# standard SNMPv3 USM agent configuration
+DEFSECURITYLEVEL=authPriv
+. ./Sv3usmconfigagent
+
+# test user
+NEWUSER=newtestuser
+NEWAUTHPASS=newauthpass
+NEWPRIVPASS=newprivpass
+NEWAUTHPRIVPASS=newauthprivpass
+
+# configure agent
+CONFIGAGENT rwuser $NEWUSER
+
+# Start the agent
+STARTAGENT
+
+## usmUserTable management
+
+## 1) create, clone, test, delete
+
+# create new (vanilla) user
+CAPTURE "snmpusm $SNMP_FLAGS $TESTPRIVARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT create $NEWUSER"
+CHECKORDIE "User successfully created"
+
+# clone
+CAPTURE "snmpusm $SNMP_FLAGS $TESTPRIVARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT cloneFrom $NEWUSER $TESTPRIVUSER"
+CHECKORDIE "User successfully cloned"
+
+# test (authPriv)
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $TESTAUTHPASS -x $DEFPRIVTYPE -X $TESTPRIVPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+# delete
+CAPTURE "snmpusm $SNMP_FLAGS $TESTPRIVARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT delete $NEWUSER"
+CHECKORDIE "User successfully deleted"
+
+## 2) create w/ clone, passwd (auth), passwd (priv), test (authPriv+authNoPriv)
+
+# create+clone template user
+CAPTURE "snmpusm $SNMP_FLAGS $TESTPRIVARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT create $NEWUSER $TESTPRIVUSER2"
+CHECKORDIE "User successfully created"
+
+# change auth passphrase of new user
+CAPTURE "snmpusm $SNMP_FLAGS $TESTPRIVARGS -Ca $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $TESTAUTHPASS2 $NEWAUTHPASS $NEWUSER"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# change priv passphrase of new user
+CAPTURE "snmpusm $SNMP_FLAGS $TESTPRIVARGS -Cx $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $TESTPRIVPASS2 $NEWPRIVPASS $NEWUSER"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# test (authNoPriv)
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -u $NEWUSER -l anp -a $DEFAUTHTYPE -A $NEWAUTHPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+# test (authPriv)
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $NEWAUTHPASS -x $DEFPRIVTYPE -X $NEWPRIVPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+## 3) passwd (priv), passwd (auth+priv), test
+
+# change priv passphrase (to auth passphrase) by the user himself
+CAPTURE "snmpusm $SNMP_FLAGS -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $NEWAUTHPASS -x $DEFPRIVTYPE -X $NEWPRIVPASS -Cx $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $NEWPRIVPASS $NEWAUTHPASS"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# change both passphrases at once
+CAPTURE "snmpusm $SNMP_FLAGS -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $NEWAUTHPASS -x $DEFPRIVTYPE -X $NEWAUTHPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $NEWAUTHPASS $NEWAUTHPRIVPASS"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# test (authPriv)
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $NEWAUTHPRIVPASS -x $DEFPRIVTYPE -X $NEWAUTHPRIVPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+## 5) persistency I: reconfigure (SIGHUP), re-test
+
+HUPAGENT
+DELAY
+
+# test (authPriv)
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $NEWAUTHPRIVPASS -x $DEFPRIVTYPE -X $NEWAUTHPRIVPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+## 5) persistency II: stop, start, re-test
+
+STOPAGENT
+DELAY
+# make sure it picks up persistent config and uses a new logfile
+SNMPCONFPATH=${SNMP_TMPDIR}:${SNMP_TMP_PERSISTENTDIR}
+export SNMPCONFPATH
+SNMP_CONFIG_FILE="does-not-exist"
+SNMP_SNMPD_LOG_FILE=${SNMP_TMPDIR}/snmpd2.log
+STARTAGENT
+
+# test (authPriv)
+CAPTURE "snmpget -On $SNMP_FLAGS -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $NEWAUTHPRIVPASS -x $DEFPRIVTYPE -X $NEWAUTHPRIVPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+## stop agent and finish
+STOPAGENT
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T035snmpv3trapdusermgmt b/cleopatre/application/spidnetsnmp/testing/tests/T035snmpv3trapdusermgmt
new file mode 100644
index 0000000000..f82b0621da
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T035snmpv3trapdusermgmt
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 snmptrapd USM user management with snmpusm
+
+SKIPIFNOT USING_AGENTX_MASTER_MODULE
+SKIPIFNOT USING_AGENTX_SUBAGENT_MODULE
+SKIPIFNOT USING_SNMPV3_USMUSER_MODULE
+SKIPIF NETSNMP_SNMPTRAPD_DISABLE_AGENTX
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+
+#
+# Begin test
+#
+
+# configure AgentX socket
+if [ "x$SNMP_TRANSPORT_SPEC" = "xunix" ]; then
+ AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+ TRAPD_FLAGS="$TRAPD_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+else
+ AGENT_FLAGS="$AGENT_FLAGS -x tcp:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT}"
+ TRAPD_FLAGS="$TRAPD_FLAGS -x tcp:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT}"
+fi
+
+# standard SNMPv3 USM agent configuration
+DEFSECURITYLEVEL=authPriv
+. ./Sv3usmconfigagent
+
+# save agent access
+AGENT_TESTAUTHARGS=$TESTAUTHARGS
+AGENT_TESTPRIVARGS=$TESTPRIVARGS
+
+# configure agent as AgentX master
+CONFIGAGENT master agentx
+
+# Start the master agent
+STARTAGENT
+
+# standard SNMPv3 USM snmptrapd configuration
+. ./Sv3usmconfigtrapd
+
+# configure snmptrapd
+NEWAUTHKEY=0x7458ead7a0b5a753e21bfcb87f6c9803ebef68cf
+NEWPRIVKEY=0x98e2696d1cf34d904dfcae76bf01c473
+NEWUSER=newtestuser
+NEWAUTHPASS=newauthpass
+NEWPRIVPASS=newprivpass
+NEWUSER2=newtestuser_vanilla
+CONFIGTRAPD authuser log $NEWUSER auth
+
+# start snmptrapd
+STARTTRAPD
+
+# delay to let it connect and register all MIBs
+DELAY
+
+## verify snmptrapd usmUserTable management
+
+SNMPUSM_TRAPD_CONTEXT_ARGS="-n snmptrapd -CE $TRAPD_ENGINEID"
+
+## 1) create, clone, passwd auth, passwd priv, test
+
+# create vanilla user
+CAPTURE "snmpusm $SNMP_FLAGS $AGENT_TESTAUTHARGS $SNMPUSM_TRAPD_CONTEXT_ARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT create $NEWUSER2"
+CHECKORDIE "User successfully created"
+
+# clone template user
+CAPTURE "snmpusm $SNMP_FLAGS $AGENT_TESTAUTHARGS $SNMPUSM_TRAPD_CONTEXT_ARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT create $NEWUSER $TESTPRIVUSER"
+CHECKORDIE "User successfully created"
+
+# change auth passphrase of new user
+CAPTURE "snmpusm $SNMP_FLAGS $AGENT_TESTAUTHARGS $SNMPUSM_TRAPD_CONTEXT_ARGS -Ca $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $TESTAUTHPASS $NEWAUTHPASS $NEWUSER"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# change priv passphrase of new user
+CAPTURE "snmpusm $SNMP_FLAGS $AGENT_TESTPRIVARGS $SNMPUSM_TRAPD_CONTEXT_ARGS -Cx $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $TESTPRIVPASS $NEWPRIVPASS $NEWUSER"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# test (anp)
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u $NEWUSER -l anp -a $DEFAUTHTYPE -A $NEWAUTHPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_anp"
+DELAY
+CHECKTRAPDORDIE "received_inform_anp"
+
+# test (ap)
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -A $NEWAUTHPASS -x $DEFPRIVTYPE -X $NEWPRIVPASS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_ap"
+DELAY
+CHECKTRAPDORDIE "received_inform_ap"
+
+## 2) change localized auth key, test, change localized priv key, test
+
+# change localized auth key
+CAPTURE "snmpusm $SNMP_FLAGS $AGENT_TESTAUTHARGS $SNMPUSM_TRAPD_CONTEXT_ARGS -Ca -Ck $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $NEWAUTHPASS $NEWAUTHKEY $NEWUSER"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# test (anp)
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u $NEWUSER -l anp -a $DEFAUTHTYPE -3k $NEWAUTHKEY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_anp2"
+DELAY
+CHECKTRAPDORDIE "received_inform_anp2"
+
+# change localized priv key
+CAPTURE "snmpusm $SNMP_FLAGS $AGENT_TESTPRIVARGS $SNMPUSM_TRAPD_CONTEXT_ARGS -Cx -Ck $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT passwd $NEWPRIVPASS $NEWPRIVKEY $NEWUSER"
+CHECKORDIE "SNMPv3 Key(s) successfully changed"
+
+# test (ap)
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -3k $NEWAUTHKEY -x $DEFPRIVTYPE -3K $NEWPRIVKEY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_ap2"
+DELAY
+CHECKTRAPDORDIE "received_inform_ap2"
+
+## 3) persistency I: reconfigure (SIGHUP), re-test
+
+# reconfigure snmptrapd
+HUPTRAPD
+
+# test (ap)
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u $NEWUSER -l ap -a $DEFAUTHTYPE -3k $NEWAUTHKEY -x $DEFPRIVTYPE -3K $NEWPRIVKEY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_ap3"
+DELAY
+CHECKTRAPDORDIE "received_inform_ap3"
+
+## stop daemons and finish
+STOPTRAPD
+STOPAGENT
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3inform b/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3inform
new file mode 100644
index 0000000000..e762d13f5e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3inform
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+DEFSECURITYLEVEL=noAuthNoPriv
+
+HEADER "SNMPv3 informs ($DEFSECURITYLEVEL) received and sent by tools"
+
+#
+# Begin test
+#
+
+CONFIGTRAPD createUser testuser
+CONFIGTRAPD authuser log testuser $DEFSECURITYLEVEL
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u testuser -l nanp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_$DEFSECURITYLEVEL"
+
+STOPTRAPD
+
+CHECKTRAPD "received_inform_$DEFSECURITYLEVEL"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informauth b/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informauth
new file mode 100644
index 0000000000..ab67ff54fa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informauth
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+DEFSECURITYLEVEL=authNoPriv
+
+HEADER "SNMPv3 informs ($DEFSECURITYLEVEL) received and sent by tools"
+
+#
+# Begin test
+#
+
+. ./Sv3usmconfigtrapd
+CONFIGTRAPD authuser log $TESTAUTHUSER $DEFSECURITYLEVEL
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d $TESTAUTHARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_$DEFSECURITYLEVEL"
+
+STOPTRAPD
+
+CHECKTRAPD "received_inform_$DEFSECURITYLEVEL"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informpriv b/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informpriv
new file mode 100644
index 0000000000..cbbf2f3fbb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T049snmpv3informpriv
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+DEFSECURITYLEVEL=authPriv
+
+HEADER "SNMPv3 informs ($DEFSECURITYLEVEL) received and sent by tools"
+
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+
+#
+# Begin test
+#
+
+. ./Sv3usmconfigtrapd
+CONFIGTRAPD authuser log $TESTPRIVUSER $DEFSECURITYLEVEL
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d $TESTPRIVARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_inform_$DEFSECURITYLEVEL"
+
+STOPTRAPD
+
+CHECKTRAPD "received_inform_$DEFSECURITYLEVEL"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T050snmpv3trap b/cleopatre/application/spidnetsnmp/testing/tests/T050snmpv3trap
new file mode 100644
index 0000000000..819d151677
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T050snmpv3trap
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 traps received and sent by tools
+
+SKIPIFNOT NETSNMP_USE_OPENSSL
+SKIPIFNOT NETSNMP_ENABLE_SCAPI_AUTHPRIV
+
+#
+# Begin test
+#
+
+CREATEUSERENGINEID=0x80001f88802b3d0e06bbdf4321
+. ./Sv3usmconfigtrapd
+CONFIGTRAPD authuser log $TESTNOAUTHUSER noAuthNoPriv
+CONFIGTRAPD authuser log $TESTAUTHUSER authNoPriv
+CONFIGTRAPD authuser log $TESTPRIVUSER authPriv
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -d -e $CREATEUSERENGINEID $TESTNOAUTHARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_trap_nanp"
+DELAY
+CAPTURE "snmptrap -d -e $CREATEUSERENGINEID $TESTAUTHARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_trap_anp"
+DELAY
+CAPTURE "snmptrap -d -e $CREATEUSERENGINEID $TESTPRIVARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s received_trap_ap"
+DELAY
+
+STOPTRAPD
+
+CHECKTRAPD "received_trap_nanp"
+CHECKTRAPD "received_trap_anp"
+CHECKTRAPD "received_trap_ap"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T051snmpv2ctrap b/cleopatre/application/spidnetsnmp/testing/tests/T051snmpv2ctrap
new file mode 100644
index 0000000000..ac4a312202
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T051snmpv2ctrap
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c traps received and sent by tools
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+#
+# Begin test
+#
+
+CONFIGTRAPD authcommunity log testcommunity
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -d -v 2c -c testcommunity $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "coldStart"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T052snmpv2cinform b/cleopatre/application/spidnetsnmp/testing/tests/T052snmpv2cinform
new file mode 100644
index 0000000000..2464dd2825
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T052snmpv2cinform
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2c informs received and sent by tools
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+#
+# Begin test
+#
+
+CONFIGTRAPD authcommunity log testcommunity
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 2c -c testcommunity $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "Received"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T053agentv1trap b/cleopatre/application/spidnetsnmp/testing/tests/T053agentv1trap
new file mode 100644
index 0000000000..0c8b5959bc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T053agentv1trap
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv1 traps are sent by snmpd API
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv3config
+CONFIGAGENT trapsink localhost public $SNMP_SNMPTRAPD_PORT
+
+CONFIGTRAPD authcommunity log public
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+AGENT_FLAGS="$AGENT_FLAGS -Dexample,header_generic,add_trap"
+STARTAGENT
+
+CAPTURE "snmpset -On $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::ucdavis.254.7.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "Enterprise Specific Trap (99)"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T054agentv2ctrap b/cleopatre/application/spidnetsnmp/testing/tests/T054agentv2ctrap
new file mode 100644
index 0000000000..d0dc07ee5d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T054agentv2ctrap
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv2c traps are sent by snmpd API
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv3config
+CONFIGAGENT trap2sink localhost public $SNMP_SNMPTRAPD_PORT
+CONFIGTRAPD authcommunity log public
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+AGENT_FLAGS="$AGENT_FLAGS"
+STARTAGENT
+
+#DELAY
+CAPTURE "snmpset -On -t 3 -r 0 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::ucdavis.254.8.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "life the universe and everything"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T055agentv1mintrap b/cleopatre/application/spidnetsnmp/testing/tests/T055agentv1mintrap
new file mode 100644
index 0000000000..c5d10f56e7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T055agentv1mintrap
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv1 traps are sent by snmpd without notification mib support
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv3config
+CONFIGAGENT trapsink localhost public $SNMP_SNMPTRAPD_PORT
+CONFIGTRAPD authcommunity log public
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+# initialize only the example mib, and not the notification mib stuff
+AGENT_FLAGS="$AGENT_FLAGS -Dexample,header_generic,add_trap,mib_init,callback -I example,usmUser,usmConf,vacm_vars"
+STARTAGENT
+
+CAPTURE "snmpset -On $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::ucdavis.254.7.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "Enterprise Specific Trap (99)"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T056agentv2cmintrap b/cleopatre/application/spidnetsnmp/testing/tests/T056agentv2cmintrap
new file mode 100644
index 0000000000..f5b6b0fc32
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T056agentv2cmintrap
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmpv2c traps are sent by snmpd without notification mib support
+
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv3config
+CONFIGAGENT trap2sink localhost public $SNMP_SNMPTRAPD_PORT
+CONFIGTRAPD authcommunity log public
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+# initialize only the example mib, and not the notification mib stuff
+AGENT_FLAGS="$AGENT_FLAGS -Dexample,header_generic,add_trap,mib_init,callback -I example,usmUser,usmConf,vacm_vars"
+STARTAGENT
+
+#DELAY
+CAPTURE "snmpset -On -t 3 -r 0 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::ucdavis.254.8.0 i 1"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "life the universe and everything"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest b/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest
new file mode 100644
index 0000000000..3369faf014
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmptrapd authorization failure of non authorized users
+
+#
+# Begin test
+#
+
+CONFIGTRAPD createUser testuser
+CONFIGTRAPD authuser log testuser noAuthNoPriv
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u nottestuser -l nanp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "coldStart"
+EXPECTRESULT 0
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=1
+ FINISHED
+fi
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest2 b/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest2
new file mode 100644
index 0000000000..a5a02cf9ef
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest2
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmptrapd discards of unauthorized notification types
+
+#
+# Begin test
+#
+
+CONFIGTRAPD createUser testuser
+CONFIGTRAPD authuser log testuser noAuthNoPriv .1.3.6.1.6.3.1.1.5.2
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u testuser -l nanp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "coldStart"
+EXPECTRESULT 0
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=1
+ FINISHED
+fi
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest3 b/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest3
new file mode 100644
index 0000000000..2ccb5cb803
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T057trapdauthtest3
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER snmptrapd discards of incorrect view types
+
+#
+# Begin test
+#
+
+CONFIGTRAPD createUser testuser
+CONFIGTRAPD authuser execute testuser noAuthNoPriv
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -v 3 -u testuser -l nanp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s blah"
+
+STOPTRAPD
+
+CHECKTRAPD "coldStart"
+EXPECTRESULT 0
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=1
+ FINISHED
+fi
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T058agentauthtrap b/cleopatre/application/spidnetsnmp/testing/tests/T058agentauthtrap
new file mode 100644
index 0000000000..7be3a7be40
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T058agentauthtrap
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER authentication failure traps are sent by snmpd
+
+SKIPIF NETSNMP_DISABLE_SNMPV1
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv1config
+# add in a v1 trap sink
+CONFIGAGENT trapsink $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT public
+CONFIGAGENT authtrapenable 1
+CONFIGTRAPD authcommunity log public
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+STARTAGENT
+
+# give the agent more time to start up. We only want to fire one
+# request (retries = 0) to make sure only one trap is sent.
+#DELAY
+CAPTURE "snmpget -On -r 0 -t 5 $SNMP_FLAGS -v 1 -c wrongcommunity $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+STOPAGENT
+
+STOPTRAPD
+
+CHECKTRAPD "Authentication Failure Trap"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T059trapdtraphandle b/cleopatre/application/spidnetsnmp/testing/tests/T059trapdtraphandle
new file mode 100755
index 0000000000..1ff652763b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T059trapdtraphandle
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+TRAPHANDLE_LOGFILE=${SNMP_TMPDIR}/traphandle.log
+
+# "inline" trap handler
+if [ "x$2" = "xtraphandle" ]; then
+ cat - >>$TRAPHANDLE_LOGFILE
+ exit 0
+fi
+
+HEADER snmptrapd traphandle: launching external shell script
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+#
+# Begin test
+#
+
+snmp_version=v2c
+TESTCOMMUNITY=testcommunity
+
+CONFIGTRAPD [snmp] persistentDir $SNMP_TMP_PERSISTENTDIR
+CONFIGTRAPD authcommunity execute $TESTCOMMUNITY
+CONFIGTRAPD doNotLogTraps true
+CONFIGTRAPD traphandle default $0 $1 traphandle
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+## 1) test notification handler
+
+CAPTURE "snmptrap -d -Ci -t $SNMP_SLEEP -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s handled_inform_$snmp_version"
+DELAY
+CHECKORDIE "handled_inform_$snmp_version" $TRAPHANDLE_LOGFILE
+
+## 2) persistency: reconfigure (SIGHUP), re-test
+
+HUPTRAPD
+CAPTURE "snmptrap -d -Ci -t $SNMP_SLEEP -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 .1.3.6.1.6.3.1.1.5.1 system.sysContact.0 s handled_inform2_$snmp_version"
+DELAY
+CHECKORDIE "handled_inform2_$snmp_version" $TRAPHANDLE_LOGFILE
+
+## stop
+STOPTRAPD
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T060trapdperl b/cleopatre/application/spidnetsnmp/testing/tests/T060trapdperl
new file mode 100755
index 0000000000..63a6f4c411
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T060trapdperl
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER 'snmptrapd embedded perl support (NetSNMP::TrapReceiver)'
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT NETSNMP_EMBEDDED_PERL
+
+#
+# Begin test
+#
+
+snmp_version=v2c
+TESTCOMMUNITY=testcommunity
+TESTOID=.1.3.6.1.6.3.1.1.5.1
+TESTOID2=.1.3.6.1.6.3.1.1.5.2
+EMBPERL_LOGFILE=${SNMP_TMPDIR}/embperl.log
+
+echo "use blib qw(${SNMP_UPDIR}/perl);" > ${SNMP_TMPDIR}/snmp_perl_trapd.pl
+echo "use NetSNMP::TrapReceiver;" >> ${SNMP_TMPDIR}/snmp_perl_trapd.pl
+
+CONFIGTRAPD authcommunity execute $TESTCOMMUNITY
+CONFIGTRAPD perlInitFile ${SNMP_TMPDIR}/snmp_perl_trapd.pl
+CONFIGTRAPD 'perl sub my_receiver { open LOG,">>'$EMBPERL_LOGFILE'"; print LOG "handled_by_embperl"; close LOG };'
+CONFIGTRAPD 'perl sub my_receiver2 { open LOG,">>'$EMBPERL_LOGFILE'"; print LOG "handled_again_by_embperl"; close LOG };'
+CONFIGTRAPD 'perl NetSNMP::TrapReceiver::register("'$TESTOID'", \&my_receiver) || warn "register_perl_handler_failed";'
+CONFIGTRAPD 'perl NetSNMP::TrapReceiver::register("'$TESTOID2'", \&my_receiver2) || warn "register_second_perl_handler_failed";'
+CONFIGTRAPD 'perl print STDERR "registered_perl_handler_ok";'
+CONFIGTRAPD agentxsocket /dev/null
+
+STARTTRAPD
+
+## 1) trigger embedded perl notification handler
+
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 $TESTOID system.sysContact.0 s handled_trap_$snmp_version"
+
+## 2) persistency: reconfigure (SIGHUP), re-trigger
+
+HUPTRAPD
+CAPTURE "snmptrap -Ci -t $SNMP_SLEEP -d -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPTRAPD_PORT 0 $TESTOID2 system.sysContact.0 s handled_trap2_$snmp_version"
+
+## stop
+STOPTRAPD
+
+
+CHECKORDIE "handled_by_embperl" $EMBPERL_LOGFILE
+CHECKORDIE "handled_again_by_embperl" $EMBPERL_LOGFILE
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T061agentperl b/cleopatre/application/spidnetsnmp/testing/tests/T061agentperl
new file mode 100755
index 0000000000..27e5b31260
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T061agentperl
@@ -0,0 +1,94 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER 'snmpd embedded perl support (using NetSNMP::agent)'
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT NETSNMP_EMBEDDED_PERL
+
+#
+# Begin test
+#
+
+snmp_version=v2c
+TESTCOMMUNITY=testcommunity
+. ./Sv2cconfig
+
+TESTOID=.1.3.6.1.4.1.8872.9999.9999.1.0
+TESTOID2=.1.3.6.1.4.1.8872.9999.9999.2.0
+EMBPERL_AGENT=${SNMP_TMPDIR}/hello.pl
+cat >$EMBPERL_AGENT <<END
+#!/usr/bin/env perl
+# minimal embedded perl agent
+
+my \$regat = '.1.3.6.1.4.1.8872.9999.9999'; # netSnmpPlayPen
+my \$myoid = \$regat . ".1.0"; # the "hello world" OID
+my \$myoid2 = \$regat . ".2.0"; # the "hello again world" OID
+
+use NetSNMP::OID qw(:all);
+use NetSNMP::agent qw(:all);
+use NetSNMP::ASN qw(:all);
+use SNMP;
+
+my \$regoid = new NetSNMP::OID(\$regat);
+\$agent->register("hello", \$regoid, \&my_snmp_handler);
+
+sub my_snmp_handler {
+ my (\$handler, \$registration_info, \$request_info, \$requests) = @_;
+ for(my \$request = \$requests; \$request; \$request = \$request->next()) {
+ if (\$request_info->getMode() == MODE_GET) {
+ if (\$request->getOID() == new NetSNMP::OID(\$myoid)) {
+ \$request->setValue(ASN_OCTET_STR, "hello world");
+ last;
+ } elsif (\$request->getOID() == new NetSNMP::OID(\$myoid2)) {
+ \$request->setValue(ASN_OCTET_STR, "hello again world");
+ last;
+ }
+ }
+ }
+}
+END
+
+echo "use blib qw(${SNMP_UPDIR}/perl);" > ${SNMP_TMPDIR}/snmp_perl.pl
+echo 'use NetSNMP::agent;' >> ${SNMP_TMPDIR}/snmp_perl.pl
+echo '$agent = new NetSNMP::agent('"'dont_init_agent' => 1, 'dont_init_lib' => 1);" >> ${SNMP_TMPDIR}/snmp_perl.pl
+
+CONFIGAGENT perlInitFile ${SNMP_TMPDIR}/snmp_perl.pl
+CONFIGAGENT "perl do '$EMBPERL_AGENT';"
+CONFIGAGENT 'perl print STDERR "registered_perl_agent_ok";'
+
+# make sure that NetSNMP::agent's agent.so can load (uninstalled) libnetsnmp*.so
+_ld_lib_path="${SNMP_UPDIR}/snmplib/.libs:${SNMP_UPDIR}/agent/.libs:${SNMP_UPDIR}/agent/helpers/.libs"
+if [ "x$LD_LIBRARY_PATH" != "x" ]; then
+ LD_LIBRARY_PATH="${_ld_lib_path}:${LD_LIBRARY_PATH}"
+else
+ LD_LIBRARY_PATH="${_ld_lib_path}"
+fi
+if [ "x$DYLD_LIBRARY_PATH" != "x" ]; then
+ DYLD_LIBRARY_PATH="${_ld_lib_path}:${DYLD_LIBRARY_PATH}"
+else
+ DYLD_LIBRARY_PATH="${_ld_lib_path}"
+fi
+if [ "x$SHLIB_PATH" != "x" ]; then
+ SHLIB_PATH="${_ld_lib_path}:${SHLIB_PATH}"
+else
+ SHLIB_PATH="${_ld_lib_path}"
+fi
+export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH
+
+STARTAGENT
+
+## 1) SNMP GET against embedded perl mib module
+CAPTURE "snmpget -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT $TESTOID"
+CHECK "hello world"
+
+## 2) persistency: reconfigure (HUP), re-test
+HUPAGENT
+CAPTURE "snmpget -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT $TESTOID2"
+CHECK "hello again world"
+
+## stop
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T065agentextend b/cleopatre/application/spidnetsnmp/testing/tests/T065agentextend
new file mode 100644
index 0000000000..8ac5201502
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T065agentextend
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER "extending agent functionality with extend"
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_AGENT_EXTEND_MODULE
+
+# make sure snmpget can be executed
+SNMPGET="${SNMP_UPDIR}/apps/snmpget"
+[ -x "$SNMPGET" ] || SKIP
+
+snmp_version=v2c
+TESTCOMMUNITY=testcommunity
+. ./Sv2cconfig
+
+#
+# Begin test
+#
+
+CONFIGAGENT extend hello /usr/bin/env echo hello_world
+
+STARTAGENT
+
+# NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."hello" = STRING: "hello_world"
+CAPTURE "$SNMPGET $SNMP_FLAGS -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT 1.3.6.1.4.1.8072.1.3.2.3.1.1.\"hello\""
+CHECKORDIE "hello_world"
+
+#NET-SNMP-EXTEND-MIB::nsExtendOutputFull."hello" = STRING: "hello_world"
+CAPTURE "$SNMPGET $SNMP_FLAGS -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.4.1.8072.1.3.2.3.1.2.\"hello\""
+CHECKORDIE "hello_world"
+
+#NET-SNMP-EXTEND-MIB::nsExtendOutLine."hello".1 = STRING: "hello_world"
+CAPTURE "$SNMPGET $SNMP_FLAGS -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.4.1.8072.1.3.2.4.1.2.\"hello\".1"
+CHECKORDIE "hello_world"
+
+#NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."hello" = INTEGER: 1
+CAPTURE "$SNMPGET $SNMP_FLAGS -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.4.1.8072.1.3.2.3.1.3.\"hello\""
+CHECKORDIE "INTEGER: 1"
+
+#NET-SNMP-EXTEND-MIB::nsExtendResult."hello" = INTEGER: 0
+CAPTURE "$SNMPGET $SNMP_FLAGS -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.4.1.8072.1.3.2.3.1.4.\"hello\""
+CHECKORDIE "INTEGER: 0"
+
+STOPAGENT
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T100agenthup b/cleopatre/application/spidnetsnmp/testing/tests/T100agenthup
new file mode 100755
index 0000000000..505efb4f5a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T100agenthup
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER that the agent responds properly to a kill -HUP
+
+SKIPIF NETSNMP_DISABLE_SNMPV1
+
+SKIPIFNOT HAVE_SIGNAL
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcomunnity
+. ./Sv1config
+
+STARTAGENT
+
+# add a agent configuration line that wouldn't have been there when
+# the started up.
+CONFIGAGENT syslocation not-anywhere-in-particular
+
+# kill -HUP the agent to get it to re-read the .conf file.
+DELAY
+kill -HUP `cat $SNMP_SNMPD_PID_FILE` > /dev/null 2>&1
+DELAY
+
+# And see if it has the new value.
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT system.sysLocation.0"
+
+STOPAGENT
+
+CHECK "not-anywhere-in-particular"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T110agentxget b/cleopatre/application/spidnetsnmp/testing/tests/T110agentxget
new file mode 100644
index 0000000000..449280f5b7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T110agentxget
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX GET support
+
+SKIPIFNOT USING_AGENTX_MASTER_MODULE
+SKIPIFNOT USING_AGENTX_SUBAGENT_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+# Start the agent without initializing the system mib.
+if [ "x$SNMP_TRANSPORT_SPEC" = "xunix" ];then
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+else
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x tcp:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT}"
+fi
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+CAPTURE "snmpget -On $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+ # test the agentx subagent by first running it...
+
+ SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+ SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+ AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I system_mib"
+ SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+ STARTAGENT
+
+ # test to see that the agent now supports setting the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 3 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+ CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+ # stop the subagent
+ STOPAGENT
+
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T111agentxset b/cleopatre/application/spidnetsnmp/testing/tests/T111agentxset
new file mode 100644
index 0000000000..2b89dfda7b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T111agentxset
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX SET support
+
+SKIPIFNOT USING_AGENTX_MASTER_MODULE
+SKIPIFNOT USING_AGENTX_SUBAGENT_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+# Start the agent without initializing the system mib.
+if [ "x$SNMP_TRANSPORT_SPEC" = "xunix" ];then
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+else
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x tcp:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT}"
+fi
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -DAgentX"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+CAPTURE "snmpget -On -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0"
+
+CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+ # test the AgentX subagent by first running it...
+
+ SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+ SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+ AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I system_mib"
+ SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+ echo "psyscontact testcontact" >> $SNMP_CONFIG_FILE
+ STARTAGENT
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0"
+
+ CHECK ".1.3.6.1.2.1.1.4.0 = STRING: testcontact"
+
+ if test "$snmp_last_test_result" = 1; then
+
+ # test to see that the agent now supports setting the system mib
+ CAPTURE "snmpset -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0 s newtestcontact"
+
+ CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+
+ if test "$snmp_last_test_result" = 1; then
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0"
+
+ CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+ fi
+ fi
+
+ # stop the subagent
+ STOPAGENT
+
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T112agentxsetfail b/cleopatre/application/spidnetsnmp/testing/tests/T112agentxsetfail
new file mode 100644
index 0000000000..50cc20a9ed
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T112agentxsetfail
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX illegal SET handling support
+
+SKIPIFNOT USING_AGENTX_MASTER_MODULE
+SKIPIFNOT USING_AGENTX_SUBAGENT_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+
+# Start the agent without initializing the system mib.
+if [ "x$SNMP_TRANSPORT_SPEC" = "xunix" ];then
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+else
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x tcp:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT}"
+fi
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -DAgentX"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+CAPTURE "snmpget -On -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT system.sysContact.0"
+
+CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+ # test the AgentX subagent by first running it...
+
+ SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+ SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+ AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I system_mib"
+ SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+ STARTAGENT
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0"
+
+ # we don't know the real value, unfortunately, so we test for what
+ # we should *not* get back.
+ CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+ if test "$snmp_last_test_result" = 0; then
+
+ # test to see that the agent now supports setting the system mib
+ CAPTURE "snmpset -On -Ir $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0 i 4"
+
+ CHECK "wrongType"
+
+ fi
+
+ # stop the subagent
+ STOPAGENT
+
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T113agentxtrap b/cleopatre/application/spidnetsnmp/testing/tests/T113agentxtrap
new file mode 100644
index 0000000000..07f1e82f0e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T113agentxtrap
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER AgentX trap sending support
+
+SKIPIFNOT USING_AGENTX_MASTER_MODULE
+SKIPIFNOT USING_AGENTX_SUBAGENT_MODULE
+SKIPIFNOT USING_EXAMPLES_EXAMPLE_MODULE
+
+#
+# Begin test
+#
+
+# start the trap demon
+CONFIGTRAPD authcommunity log public
+STARTTRAPD
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# configure the trap receiver.
+CONFIGAGENT trapsink localhost public $SNMP_SNMPTRAPD_PORT
+
+# Start the agent without initializing the example mib.
+if [ "x$SNMP_TRANSPORT_SPEC" = "xunix" ];then
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x $SNMP_TMPDIR/agentx_socket"
+else
+ORIG_AGENT_FLAGS="$AGENT_FLAGS -x tcp:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT}"
+fi
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -example"
+STARTAGENT
+
+# test to see that the current agent doesn't support the example mib
+CAPTURE "snmpget -On -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::ucdavis.254.1.0"
+
+CHECK "No Such Object"
+
+if test "$snmp_last_test_result" = 1; then
+ # test the AgentX subagent by first running it...
+
+ SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+ SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+ AGENT_FLAGS="$ORIG_AGENT_FLAGS -X -I example -Dadd"
+ SNMP_CONFIG_FILE="$SNMP_TMPDIR/bogus.conf"
+
+ STARTAGENT
+
+ # test to see that the agent now supports the example mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::ucdavis.254.1.0"
+
+ CHECK "life the universe and everything"
+
+ if test "$snmp_last_test_result" = 1; then
+
+ # test to see that the agent now sends a trap from the exmaple mib
+ CAPTURE "snmpset -On -r 0 -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT UCD-SNMP-MIB::ucdavis.254.8.0 i 1"
+ DELAY
+ CHECKTRAPD "life the universe and everything"
+
+ fi
+
+ # stop the subagent
+ STOPAGENT
+
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+fi
+
+# stop the master agent
+STOPAGENT
+
+# stop the trap demon
+STOPTRAPD
+
+# all done (whew)
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T115agentxperl b/cleopatre/application/spidnetsnmp/testing/tests/T115agentxperl
new file mode 100755
index 0000000000..f611215183
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T115agentxperl
@@ -0,0 +1,133 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER 'AgentX subagent in Perl (using NetSNMP::agent)'
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+SKIPIFNOT USING_AGENTX_MASTER_MODULE
+SKIPIFNOT USING_AGENTX_SUBAGENT_MODULE
+# make sure the toolkit has been configured --with-perl-modules
+[ -d ${SNMP_UPDIR}/perl/blib/arch/auto/NetSNMP/agent ] || SKIP
+
+#
+# Begin test
+#
+
+snmp_version=v2c
+TESTCOMMUNITY=testcommunity
+. ./Sv2cconfig
+
+TESTOID=.1.3.6.1.4.1.8872.9999.9999.1.0
+TESTOID2=.1.3.6.1.4.1.8872.9999.9999.2.0
+AGENTX_SOCKET=${SNMP_TMPDIR}/agentx_socket
+PERL_SUBAGENT=${SNMP_TMPDIR}/hello.pl
+PERL_SUBAGENT_CONF=${SNMP_TMPDIR}/hello.conf
+
+cat >$PERL_SUBAGENT <<END
+#!${SNMP_PERLPROG}
+# minimal AgentX subagent in Perl
+
+use blib qw(${SNMP_UPDIR}/perl);
+use NetSNMP::OID qw(:all);
+use NetSNMP::agent qw(:all);
+use NetSNMP::ASN qw(:all);
+use NetSNMP::agent::default_store;
+use NetSNMP::default_store qw(:all);
+use SNMP;
+
+## double-fork daemon
+my \$pid;
+unless (\$pid = fork) {
+ unless (fork) {
+ ## start main code
+ my \$regat = '.1.3.6.1.4.1.8872.9999.9999'; # netSnmpPlayPen
+ my \$myoid = \$regat . ".1.0"; # the "hello world" OID
+ my \$myoid2 = \$regat . ".2.0"; # the "hello again world" OID
+
+ my \$pidfile = shift; # take PID file as first argument
+ open(PIDFILE, ">\$pidfile") or die "Couldn't open \$pidfile";
+ print PIDFILE \$\$;
+ close(PIDFILE);
+
+sub my_snmp_handler {
+ my (\$handler, \$registration_info, \$request_info, \$requests) = @_;
+ for(my \$request = \$requests; \$request; \$request = \$request->next()) {
+ if (\$request_info->getMode() == MODE_GET) {
+ if (\$request->getOID() == new NetSNMP::OID(\$myoid)) {
+ \$request->setValue(ASN_OCTET_STR, "hello world");
+ last;
+ } elsif (\$request->getOID() == new NetSNMP::OID(\$myoid2)) {
+ \$request->setValue(ASN_OCTET_STR, "hello again world");
+ last;
+ }
+ }
+ }
+}
+sub shut_it_down { \$running = 0; }
+
+ netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_ROOT_ACCESS, 1);
+ my \$agent = new NetSNMP::agent('Name' => 'hello', 'AgentX' => 1);
+ my \$regoid = new NetSNMP::OID(\$regat);
+ \$agent->register("hello", \$regoid, \&my_snmp_handler);
+
+ \$SIG{'INT'} = \&shut_it_down;
+ \$SIG{'QUIT'} = \&shut_it_down;
+ \$running = 1;
+ while(\$running) {
+ \$agent->agent_check_and_process(1);
+ }
+ \$agent->shutdown();
+ ## end main code
+ exit 0;
+ }
+ exit 0;
+}
+waitpid(\$pid, 0);
+END
+
+echo "agentxsocket $AGENTX_SOCKET" > $PERL_SUBAGENT_CONF
+
+CONFIGAGENT master agentx
+CONFIGAGENT agentxsocket $AGENTX_SOCKET
+
+STARTAGENT
+
+# make sure that we can fulfill all library dependencies
+_ld_lib_path="${SNMP_UPDIR}/snmplib/.libs:${SNMP_UPDIR}/agent/.libs:${SNMP_UPDIR}/agent/helpers/.libs"
+if [ "x$LD_LIBRARY_PATH" != "x" ]; then
+ LD_LIBRARY_PATH="${_ld_lib_path}:${LD_LIBRARY_PATH}"
+else
+ LD_LIBRARY_PATH="${_ld_lib_path}"
+fi
+if [ "x$DYLD_LIBRARY_PATH" != "x" ]; then
+ DYLD_LIBRARY_PATH="${_ld_lib_path}:${DYLD_LIBRARY_PATH}"
+else
+ DYLD_LIBRARY_PATH="${_ld_lib_path}"
+fi
+if [ "x$SHLIB_PATH" != "x" ]; then
+ SHLIB_PATH="${_ld_lib_path}:${SHLIB_PATH}"
+else
+ SHLIB_PATH="${_ld_lib_path}"
+fi
+export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH
+
+# start perl subagent
+/usr/bin/env SNMPCONFPATH="${SNMP_TMPDIR}:${SNMP_TMP_PERSISTENTDIR}" $SNMP_PERLPROG $PERL_SUBAGENT $SNMP_AGENTX_PID_FILE >$SNMP_AGENTX_LOG_FILE 2>&1
+DELAY
+
+## 1) SNMP GET against mib object implemented by the perl subagent
+CAPTURE "snmpget -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT $TESTOID"
+CHECK "hello world"
+
+## 2) persistency: reconfigure master agent (HUP), re-test
+HUPAGENT
+CAPTURE "snmpget -$snmp_version -c $TESTCOMMUNITY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT $TESTOID2"
+CHECK "hello again world"
+
+## stop
+STOPAGENT
+STOPPROG $SNMP_AGENTX_PID_FILE
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T120proxyget b/cleopatre/application/spidnetsnmp/testing/tests/T120proxyget
new file mode 100644
index 0000000000..d10177bb58
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T120proxyget
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER Proxy GET support
+
+SKIPIFNOT USING_UCD_SNMP_PROXY_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+# XXX: ucd-snmp/proxy doesn't properly support TCP -- remove this once it does
+[ "x$SNMP_TRANSPORT_SPEC" = "xtcp" ] && SKIP
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# config the proxy
+CONFIGAGENT proxy -t 2 -r 1 -v 2c -c testcommunity $SNMP_TRANSPORT_SPEC:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT} system
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -Dproxy"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+#CAPTURE "snmpget -On -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+#CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+#if test "$snmp_last_test_result" = 1; then
+ # test the proxy subagent by first running it...
+
+ SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+ SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+ SNMP_CONFIG_FILE="$SNMP_TMPDIR/proxy.conf"
+ echo "rwcommunity testcommunity" >> $SNMP_CONFIG_FILE
+ AGENT_FLAGS=$ORIG_AGENT_FLAGS
+ ORIG_SNMP_SNMPD_PORT=$SNMP_SNMPD_PORT
+ SNMP_SNMPD_PORT="${SNMP_AGENTX_PORT}"
+ STARTAGENT
+ SNMP_SNMPD_PORT=$ORIG_SNMP_SNMPD_PORT
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+ CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks:"
+
+ # stop the subagent
+ STOPAGENT
+
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+#fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T121proxyset b/cleopatre/application/spidnetsnmp/testing/tests/T121proxyset
new file mode 100644
index 0000000000..8429284152
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T121proxyset
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER Proxy SET support
+
+SKIPIFNOT USING_UCD_SNMP_PROXY_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+# XXX: ucd-snmp/proxy doesn't properly support TCP -- remove this once it does
+[ "x$SNMP_TRANSPORT_SPEC" = "xtcp" ] && SKIP
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# config the proxy
+CONFIGAGENT proxy -t 2 -r 1 -v 2c -c testcommunity $SNMP_TRANSPORT_SPEC:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT} system
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -Dproxy"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+#CAPTURE "snmpget -On -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+#CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+#if test "$snmp_last_test_result" = 1; then
+ # test the proxy subagent by first running it...
+
+ SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+ SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+ SNMP_CONFIG_FILE="$SNMP_TMPDIR/proxy.conf"
+ echo "rwcommunity testcommunity" >> $SNMP_CONFIG_FILE
+ echo "psyscontact testcontact" >> $SNMP_CONFIG_FILE
+ AGENT_FLAGS="$ORIG_AGENT_FLAGS -Dmib_init"
+ ORIG_SNMP_SNMPD_PORT=$SNMP_SNMPD_PORT
+ SNMP_SNMPD_PORT="${SNMP_AGENTX_PORT}"
+ STARTAGENT
+ SNMP_SNMPD_PORT=$ORIG_SNMP_SNMPD_PORT
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0"
+
+ CHECK ".1.3.6.1.2.1.1.4.0 = STRING: testcontact"
+
+ if test "$snmp_last_test_result" = 1; then
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpset -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0 s newtestcontact"
+
+ CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+
+ if test "$snmp_last_test_result" = 1; then
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0"
+
+ CHECK ".1.3.6.1.2.1.1.4.0 = STRING: newtestcontact"
+ fi
+ fi
+
+ # stop the subagent
+ STOPAGENT
+
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+#fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T122proxysetfail b/cleopatre/application/spidnetsnmp/testing/tests/T122proxysetfail
new file mode 100644
index 0000000000..f1a057bd9f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T122proxysetfail
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER Proxy illegal SET handling support
+
+SKIPIFNOT USING_UCD_SNMP_PROXY_MODULE
+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+# XXX: ucd-snmp/proxy doesn't properly support TCP -- remove this once it does
+[ "x$SNMP_TRANSPORT_SPEC" = "xtcp" ] && SKIP
+
+#
+# Begin test
+#
+
+# standard V3 configuration for initial user
+. ./Sv3config
+# config the proxy
+CONFIGAGENT proxy -t 2 -r 1 -v 2c -c testcommunity $SNMP_TRANSPORT_SPEC:${SNMP_TEST_DEST}${SNMP_AGENTX_PORT} system
+
+# Start the agent without initializing the system mib.
+ORIG_AGENT_FLAGS="$AGENT_FLAGS"
+AGENT_FLAGS="$ORIG_AGENT_FLAGS -I -system_mib -Dproxy"
+STARTAGENT
+
+# test to see that the current agent doesn't support the system mib
+#CAPTURE "snmpget -On -t 3 $SNMP_FLAGS $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+#CHECK ".1.3.6.1.2.1.1.3.0 = No Such Object"
+
+#if test "$snmp_last_test_result" = 1; then
+ # test the proxy subagent by first running it...
+
+ SNMP_SNMPD_PID_FILE_ORIG=$SNMP_SNMPD_PID_FILE
+ SNMP_SNMPD_LOG_FILE_ORIG=$SNMP_SNMPD_LOG_FILE
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE.num2
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE.num2
+ SNMP_CONFIG_FILE="$SNMP_TMPDIR/proxy.conf"
+ echo "rwcommunity testcommunity" >> $SNMP_CONFIG_FILE
+# echo "syscontact testcontact" >> $SNMP_CONFIG_FILE
+ AGENT_FLAGS="$ORIG_AGENT_FLAGS -Dmib_init"
+ ORIG_SNMP_SNMPD_PORT=$SNMP_SNMPD_PORT
+ SNMP_SNMPD_PORT="${SNMP_AGENTX_PORT}"
+ STARTAGENT
+ SNMP_SNMPD_PORT=$ORIG_SNMP_SNMPD_PORT
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpget -On $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0"
+
+
+ # we don't know the real value, unfortunately, so we test for what
+ # we should *not* get back.
+ CHECK ".1.3.6.1.2.1.1.4.0 = No Such Object"
+
+ if test "$snmp_last_test_result" = 0; then
+
+ # test to see that the agent now supports the system mib
+ CAPTURE "snmpset -On -Ir $SNMP_FLAGS -t 5 $AUTHTESTARGS $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT sysContact.0 i 42"
+
+ # 5.0.x snmpset shows error on single line
+ #CHECK ".1.3.6.1.2.1.1.4.0 = Wrong Type"
+ # 5.1.x snmpset shows error on multiple lines
+ CHECK "Reason: wrongType"
+ CHECK "Failed object: .1.3.6.1.2.1.1.4.0"
+
+ fi
+
+ # stop the subagent
+ STOPAGENT
+
+ SNMP_SNMPD_PID_FILE=$SNMP_SNMPD_PID_FILE_ORIG
+ SNMP_SNMPD_LOG_FILE=$SNMP_SNMPD_LOG_FILE_ORIG
+#fi
+
+# stop the master agent
+STOPAGENT
+
+# all done (whew)
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T130snmpv1vacmget b/cleopatre/application/spidnetsnmp/testing/tests/T130snmpv1vacmget
new file mode 100644
index 0000000000..71bdc711e9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T130snmpv1vacmget
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv1 vacm acceptance support
+SKIPIF NETSNMP_DISABLE_SNMPV1
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity1 testcommunity2
+# testcommunity1 can access .1.3.6.1.2.1.1.1, others are denied
+# testcommunity2 can access all except .1.3.6.1.2.1.1.1
+# This case test for successful access
+snmp_version=v1
+. ./Svacmconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity1 -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.1.0"
+
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = STRING:"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity2 -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks: "
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T131snmpv2cvacmget b/cleopatre/application/spidnetsnmp/testing/tests/T131snmpv2cvacmget
new file mode 100644
index 0000000000..9d481f2352
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T131snmpv2cvacmget
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2 vacm acceptance support
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+#
+# Begin test
+#
+
+
+# standard V1 configuration: testcommunity1 testcommunity2
+# testcommunity1 can access .1.3.6.1.2.1.1.1, others are denied
+# testcommunity2 can access all except .1.3.6.1.2.1.1.1
+# This case test for successful access
+
+snmp_version=v2c
+. ./Svacmconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity1 -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.1.0"
+
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = STRING:"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity2 -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks: "
+
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T132snmpv3vacmget b/cleopatre/application/spidnetsnmp/testing/tests/T132snmpv3vacmget
new file mode 100644
index 0000000000..8ce93640ad
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T132snmpv3vacmget
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 vacm acceptance support
+
+#
+# Begin test
+#
+
+# Configuration:
+#initial1 can access .1.3.6.1.2.1.1.1, deny others
+#initial2 can access all except .1.3.6.1.2.1.1.1
+#This case test for successful access
+
+snmp_version=v3
+. ./Sv3vacmconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v3 -a MD5 -A initial_test_pass_auth -u initial1 -l anp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.1.0"
+
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = STRING:"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v3 -a MD5 -A initial_test_pass_auth -u initial2 -l anp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECK ".1.3.6.1.2.1.1.3.0 = Timeticks: "
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T140snmpv1vacmgetfail b/cleopatre/application/spidnetsnmp/testing/tests/T140snmpv1vacmgetfail
new file mode 100644
index 0000000000..0510008463
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T140snmpv1vacmgetfail
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv1 vacm denial support
+
+SKIPIF NETSNMP_DISABLE_SNMPV1
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity1 testcommunity2
+# testcommunity1 can access .1.3.6.1.2.1.1.1, others are denied
+# testcommunity2 can access all except .1.3.6.1.2.1.1.1
+# This case test for denied access
+
+snmp_version=v1
+. ./Svacmconfig
+
+STARTAGENT
+
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity1 -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECKORDIE "Reason: (noSuchName) There is no such variable name in this MIB."
+
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity2 -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.1.0"
+
+CHECKORDIE "Reason: (noSuchName) There is no such variable name in this MIB."
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T141snmpv2cvacmgetfail b/cleopatre/application/spidnetsnmp/testing/tests/T141snmpv2cvacmgetfail
new file mode 100644
index 0000000000..43f6b0afb2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T141snmpv2cvacmgetfail
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv2 vacm denial support
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+#
+# Begin test
+#
+
+
+# standard V1 configuration: testcommunity1 testcommunity2
+# testcommunity1 can access .1.3.6.1.2.1.1.1, others are denied
+# testcommunity2 can access all except .1.3.6.1.2.1.1.1
+# This case test for denied access
+
+snmp_version=v2c
+. ./Svacmconfig
+
+STARTAGENT
+
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity1 -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = No Such Object available on this agent at this OID"
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity2 -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.1.0"
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = No Such Object available on this agent at this OID"
+
+CAPTURE "snmpset -On $SNMP_FLAGS -c testcommunity1 -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.5.0 s dummy"
+CHECKORDIE "Reason: noAccess"
+
+CAPTURE "snmpset -On $SNMP_FLAGS -c testcommunity2 -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.5.0 s dummy"
+CHECKORDIE "Reason: noAccess"
+
+CAPTURE "snmpset -On $SNMP_FLAGS -c testrwcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.5.0 s dummy"
+CHECKORDIE ".1.3.6.1.2.1.1.5.0 = STRING: dummy"
+
+CAPTURE "snmpset -On $SNMP_FLAGS -c testrocommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.5.0 s dummy"
+CHECKORDIE "Reason: noAccess"
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T142snmpv3vacmgetfail b/cleopatre/application/spidnetsnmp/testing/tests/T142snmpv3vacmgetfail
new file mode 100644
index 0000000000..8f7eb9ceb9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T142snmpv3vacmgetfail
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER SNMPv3 vacm denial support
+
+#
+# Begin test
+#
+
+# Configuration:
+#initial1 can access .1.3.6.1.2.1.1.1, deny others
+#initial2 can access all except .1.3.6.1.2.1.1.1
+#This case test for denied access
+
+snmp_version=v3
+. ./Sv3vacmconfig
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v3 -a MD5 -A initial_test_pass_auth -u initial1 -l anp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.3.0"
+
+CHECKORDIE ".1.3.6.1.2.1.1.3.0 = No Such Object available on this agent at this OID"
+
+
+CAPTURE "snmpget -On $SNMP_FLAGS -v3 -a MD5 -A initial_test_pass_auth -u initial2 -l anp $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.1.0"
+
+CHECKORDIE ".1.3.6.1.2.1.1.1.0 = No Such Object available on this agent at this OID"
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T150solarishostcpu b/cleopatre/application/spidnetsnmp/testing/tests/T150solarishostcpu
new file mode 100644
index 0000000000..a28e939c20
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T150solarishostcpu
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER 1st CPU on Solaris using HOST-RESOURCES
+
+if test "x`uname -s`" != "xSunOS" ; then
+ SKIP
+fi
+
+SKIPIF NETSNMP_DISABLE_SNMPV1
+SKIPIFNOT USING_HOST_HR_DEVICE_MODULE
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv1config
+
+STARTAGENT
+
+# ask for the description of the first CPU in the system
+
+CAPTURE "snmpgetnext -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.25.3.2.1.3.767"
+
+CHECKORDIE " = STRING: CPU "
+
+STOPAGENT
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T151solarishostdisk b/cleopatre/application/spidnetsnmp/testing/tests/T151solarishostdisk
new file mode 100644
index 0000000000..f9811f5c11
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T151solarishostdisk
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER initial load device on Solaris using HOST-RESOURCES
+
+if test `uname -s` != "SunOS" ; then
+ # a bogus skip for !suns
+ SKIPIFNOT XXXYYYZZZ
+fi
+
+SKIPIFNOT USING_HOST_HR_SYSTEM_MODULE
+SKIPIF NETSNMP_DISABLE_SNMPV1
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv1config
+
+STARTAGENT
+
+# ask for the index of the initial device (hrSystemInitialLoadDevice.0)
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.25.1.3.0"
+
+STOPAGENT
+
+CHECKORDIE "^.1.3.6.1.2.1.25.1.3.0 = INTEGER:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T152hostuptime b/cleopatre/application/spidnetsnmp/testing/tests/T152hostuptime
new file mode 100644
index 0000000000..1e90d3faa7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T152hostuptime
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER uptime using HOST-RESOURCES
+
+SKIPIFNOT USING_HOST_HR_SYSTEM_MODULE
+
+SKIPIF NETSNMP_DISABLE_SNMPV1
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv1config
+
+STARTAGENT
+
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.25.1.1.0"
+
+STOPAGENT
+
+CHECKORDIE "^.1.3.6.1.2.1.25.1.1.0 = Timeticks:"
+
+FINISHED
+
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T153solarisswap b/cleopatre/application/spidnetsnmp/testing/tests/T153solarisswap
new file mode 100644
index 0000000000..04e2e3c4a5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T153solarisswap
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER swap on Solaris using HOST-RESOURCES
+
+if test `uname -s` != "SunOS" ; then
+ # a bogus skip for !suns
+ SKIPIFNOT XXXYYYZZZ
+fi
+
+SKIPIFNOT USING_HOST_HR_STORAGE_MODULE
+
+SKIPIF NETSNMP_DISABLE_SNMPV1
+
+#
+# Begin test
+#
+
+# standard V1 configuration: testcommunity
+. ./Sv1config
+
+STARTAGENT
+
+# ask for hrStorageSize.10 which reports overall swap size
+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 1 $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.25.2.3.1.5.10"
+
+STOPAGENT
+
+CHECKORDIE "^.1.3.6.1.2.1.25.2.3.1.5.10 = INTEGER:"
+
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T160snmpnetstat b/cleopatre/application/spidnetsnmp/testing/tests/T160snmpnetstat
new file mode 100644
index 0000000000..186a305e31
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T160snmpnetstat
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+# snmpnetstat test only works with UDP or TCP
+if [ "x$SNMP_TRANSPORT_SPEC" = "x" -o "x$SNMP_TRANSPORT_SPEC" = "xudp" ]; then
+ proto=udp
+ SKIPIFNOT USING_MIBII_UDPTABLE_MODULE
+elif [ "x$SNMP_TRANSPORT_SPEC" = "xtcp" ]; then
+ proto=tcp
+ SKIPIFNOT USING_MIBII_TCPTABLE_MODULE
+else
+ HEADER "if snmpnetstat finds the running agent in udpTable/tcpTable"
+ SKIP
+fi
+
+HEADER "if snmpnetstat finds the running agent in ${proto}Table"
+
+# on some systems the agent needs to be run as root to access udpTable/tcpTable
+# - else force skip
+case "x`uname -s`" in
+ xAIX) [ "x`id -u`" != "x0" ] && SKIP;;
+ xHP-UX) [ "x`id -u`" != "x0" ] && SKIP;;
+ xIRIX*) [ "x`id -u`" != "x0" ] && SKIP;;
+ xNetBSD) [ "x`id -u`" != "x0" ] && SKIP;;
+ xOpenBSD) [ "x`id -u`" != "x0" ] && SKIP;;
+ xOSF1) [ "x`id -u`" != "x0" ] && SKIP;;
+esac
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+# make sure snmpnetstat can be executed
+SNMPNETSTAT="${SNMP_UPDIR}/apps/snmpnetstat/snmpnetstat"
+[ -x "$SNMPNETSTAT" ] || SKIP
+
+snmp_version=v2c
+. ./Sv2cconfig
+
+#
+# Begin test
+#
+
+STARTAGENT
+
+CAPTURE "$SNMPNETSTAT -Cn -Cp $proto -$snmp_version -c testcommunity $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT"
+CHECKEXACT "127.0.0.1.$SNMP_SNMPD_PORT"
+# multiple occurrences (especially in tcpTable) are fine
+if [ "$snmp_last_test_result" != 0 ] ; then
+ return_value=0
+fi
+FINISHED
+
+
+STOPAGENT
+FINISHED
diff --git a/cleopatre/application/spidnetsnmp/testing/tests/T200snmpv2cwalkall b/cleopatre/application/spidnetsnmp/testing/tests/T200snmpv2cwalkall
new file mode 100644
index 0000000000..78fac68eb7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/testing/tests/T200snmpv2cwalkall
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. ../eval_tools.sh
+
+HEADER "full snmpwalk (SNMPv2c) against agent (may take time)"
+
+if test `uname -s` = "HP-UX" ; then
+ if test `id -u` != "0" ; then
+ # The agent needs to be run as root - else force skip
+ SKIP
+ fi
+fi
+
+SKIPIF NETSNMP_DISABLE_SNMPV2C
+
+# make sure snmpwalk can be executed
+SNMPWALK="${SNMP_UPDIR}/apps/snmpwalk"
+[ -x "$SNMPWALK" ] || SKIP
+
+snmp_version=v2c
+. ./Sv2cconfig
+
+#
+# Begin test
+#
+
+# higher timeout/retry values for safety
+TIMEOUT=10
+RETRY=5
+
+STARTAGENT
+
+CAPTURE "$SNMPWALK $SNMP_FLAGS -$snmp_version -c testcommunity -t $TIMEOUT -r $RETRY $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1"
+CHECKANDDIE "= Wrong Type (should be "
+CHECKORDIE "No more variables left in this MIB View"
+
+STOPAGENT
+FINISHED