Merge branch 'dev/next' of https://github.com/Tripwire/tripwire-open-source into dev/next

This commit is contained in:
Brian Cox 2017-09-06 12:11:14 -07:00
commit 159e735ebc
131 changed files with 2133 additions and 800 deletions

4
.gitignore vendored
View File

@ -3,7 +3,6 @@ config.h
config.h.in~ config.h.in~
config.log config.log
config.status config.status
compile
autom4te.cache/ autom4te.cache/
bin/ bin/
lib/ lib/
@ -21,6 +20,9 @@ src/test-harness/twtest
**/*.dll **/*.dll
**/*.exe **/*.exe
**/*~ **/*~
**/*#
**/*.bak **/*.bak
**/.DS_Store **/.DS_Store
**/*.gcno
**/*.gcda
releases/ releases/

View File

@ -17,3 +17,9 @@ check:
rm -Rf $(top_srcdir)/bin/TWTestData rm -Rf $(top_srcdir)/bin/TWTestData
cd $(top_srcdir)/src/test-harness && perl ./twtest.pl cd $(top_srcdir)/src/test-harness && perl ./twtest.pl
cd $(top_srcdir)/bin && ./twtest all cd $(top_srcdir)/bin && ./twtest all
test: check
.PHONY: targets
targets:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs

View File

@ -813,6 +813,12 @@ check:
cd $(top_srcdir)/src/test-harness && perl ./twtest.pl cd $(top_srcdir)/src/test-harness && perl ./twtest.pl
cd $(top_srcdir)/bin && ./twtest all cd $(top_srcdir)/bin && ./twtest all
test: check
.PHONY: targets
targets:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

348
compile Executable file
View File

@ -0,0 +1,348 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2016-01-11.22; # UTC
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@ -6,6 +6,9 @@
/* Compile with debug code */ /* Compile with debug code */
#undef DEBUG #undef DEBUG
/* Enable use of /dev/urandom */
#undef ENABLE_DEV_URANDOM
/* this is the prefix for STL exception functions */ /* this is the prefix for STL exception functions */
#undef EXCEPTION_NAMESPACE #undef EXCEPTION_NAMESPACE
@ -24,6 +27,12 @@
/* Has /dev/urandom */ /* Has /dev/urandom */
#undef HAVE_DEV_URANDOM #undef HAVE_DEV_URANDOM
/* Define to 1 if you have the `door_create' function. */
#undef HAVE_DOOR_CREATE
/* Define to 1 if you have the <door.h> header file. */
#undef HAVE_DOOR_H
/* Define to 1 if you have the <fcntl.h> header file. */ /* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
@ -63,6 +72,12 @@
/* Define to 1 if you have the <openssl/sha.h> header file. */ /* Define to 1 if you have the <openssl/sha.h> header file. */
#undef HAVE_OPENSSL_SHA_H #undef HAVE_OPENSSL_SHA_H
/* Define to 1 if you have the `port_create' function. */
#undef HAVE_PORT_CREATE
/* Define to 1 if you have the <port.h> header file. */
#undef HAVE_PORT_H
/* Define to 1 if you have the `posix_fadvise' function. */ /* Define to 1 if you have the `posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE #undef HAVE_POSIX_FADVISE

88
configure vendored
View File

@ -750,6 +750,9 @@ enable_silent_rules
enable_extrawarnings enable_extrawarnings
enable_static enable_static
enable_debug enable_debug
enable_coverage
enable_profiling
enable_urandom
enable_dependency_tracking enable_dependency_tracking
enable_commoncrypto enable_commoncrypto
enable_iconv enable_iconv
@ -1395,6 +1398,9 @@ Optional Features:
—-disable-extrawarnings do not compile with -Wextra warnings enabled —-disable-extrawarnings do not compile with -Wextra warnings enabled
--enable-static compile static binaries --enable-static compile static binaries
--enable-debug compile with debuging enabled --enable-debug compile with debuging enabled
--enable-coverage enable code coverage
--enable-profiling enable profiling
--enable-urandom use /dev/urandom
--enable-dependency-tracking --enable-dependency-tracking
do not reject slow dependency extractors do not reject slow dependency extractors
--disable-dependency-tracking --disable-dependency-tracking
@ -3497,6 +3503,42 @@ $as_echo "#define NDEBUG 1" >>confdefs.h
fi fi
# Check whether --enable-coverage was given.
if test "${enable_coverage+set}" = set; then :
enableval=$enable_coverage;
fi
if test "x$enable_coverage" = xyes
then
CFLAGS="${CFLAGS} --coverage"
CXXFLAGS="${CXXFLAGS} --coverage"
LDFLAGS="${LDFLAGS} --coverage"
fi
# Check whether --enable-profiling was given.
if test "${enable_profiling+set}" = set; then :
enableval=$enable_profiling;
fi
if test "x$enable_profiling" = xyes
then
CFLAGS="${CFLAGS} -pg"
CXXFLAGS="${CXXFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg"
fi
# Check whether --enable-urandom was given.
if test "${enable_urandom+set}" = set; then :
enableval=$enable_urandom;
fi
if test "x$enable_urandom" = xyes
then
$as_echo "#define ENABLE_DEV_URANDOM 1" >>confdefs.h
fi
ac_ext=c ac_ext=c
ac_cpp='$CPP $CPPFLAGS' ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -6186,6 +6228,52 @@ done
fi fi
for ac_header in door.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "door.h" "ac_cv_header_door_h" "$ac_includes_default"
if test "x$ac_cv_header_door_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_DOOR_H 1
_ACEOF
for ac_func in door_create
do :
ac_fn_c_check_func "$LINENO" "door_create" "ac_cv_func_door_create"
if test "x$ac_cv_func_door_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_DOOR_CREATE 1
_ACEOF
fi
done
fi
done
for ac_header in port.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "port.h" "ac_cv_header_port_h" "$ac_includes_default"
if test "x$ac_cv_header_port_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PORT_H 1
_ACEOF
for ac_func in port_create
do :
ac_fn_c_check_func "$LINENO" "port_create" "ac_cv_func_port_create"
if test "x$ac_cv_func_port_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PORT_CREATE 1
_ACEOF
fi
done
fi
done
if test -c "/dev/random"; then if test -c "/dev/random"; then

View File

@ -44,6 +44,28 @@ else
AC_DEFINE(NDEBUG, 1, [Compile without debug code]) AC_DEFINE(NDEBUG, 1, [Compile without debug code])
fi fi
AC_ARG_ENABLE(coverage, [ --enable-coverage enable code coverage])
if test "x$enable_coverage" = xyes
then
CFLAGS="${CFLAGS} --coverage"
CXXFLAGS="${CXXFLAGS} --coverage"
LDFLAGS="${LDFLAGS} --coverage"
fi
AC_ARG_ENABLE(profiling, [ --enable-profiling enable profiling])
if test "x$enable_profiling" = xyes
then
CFLAGS="${CFLAGS} -pg"
CXXFLAGS="${CXXFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg"
fi
AC_ARG_ENABLE(urandom, [ --enable-urandom use /dev/urandom])
if test "x$enable_urandom" = xyes
then
AC_DEFINE(ENABLE_DEV_URANDOM, 1, [Enable use of /dev/urandom])
fi
dnl ################### dnl ###################
dnl Checks for programs dnl Checks for programs
dnl ################### dnl ###################
@ -134,6 +156,12 @@ then
AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h) AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h)
fi fi
dnl check for door support (Solaris)
AC_CHECK_HEADERS(door.h, [AC_CHECK_FUNCS(door_create)])
dnl check for event port support (Solaris)
AC_CHECK_HEADERS(port.h, [AC_CHECK_FUNCS(port_create)])
dnl ############################################## dnl ##############################################
dnl check for various RNG/PRNG devices dnl check for various RNG/PRNG devices
dnl ############################################## dnl ##############################################

View File

@ -28,7 +28,7 @@ fi
## The usage message. ## The usage message.
##------------------------------------------------------- ##-------------------------------------------------------
USAGE="install.sh [<configfile>] [-n] [-f] [-s <sitepassphrase>] [-l <localpassphrase>]" USAGE="install.sh [<configfile>] [-n] [-f] [-s <sitepassphrase>] [-l <localpassphrase>] [-d <installdir>]"
##------------------------------------------------------- ##-------------------------------------------------------
## Figure out how to do an echo without newline. ## Figure out how to do an echo without newline.
@ -104,8 +104,10 @@ fi
## Miscellaneous configuration parameters. ## Miscellaneous configuration parameters.
##------------------------------------------------------- ##-------------------------------------------------------
# prefix # set a few location variables if caller didn't pass them to us
prefix="${prefix:=/usr}" prefix="${prefix:=/usr/local}"
sysconfdir="${sysconfdir:=/usr/local/etc}"
path_to_vi="${path_to_vi:=/usr/bin/vi}"
# License File name # License File name
TWLICENSEFILE="COPYING" TWLICENSEFILE="COPYING"
@ -178,6 +180,13 @@ while [ "x$1" != "x" ] ; do
exit 1 ;; exit 1 ;;
*) TW_LOCAL_PASS="$2"; shift ;; *) TW_LOCAL_PASS="$2"; shift ;;
esac ;; esac ;;
-d) case "$2" in
"" | -*)
echo "Error: missing install dir with -d option." 1>&2
echo "$USAGE"
exit 1 ;;
*) prefix="$2"; sysconfdir="$2/bin"; shift ;;
esac ;;
-*) echo "Error: unknown argument $1" 1>&2 -*) echo "Error: unknown argument $1" 1>&2
echo "$USAGE" echo "$USAGE"
exit 1 ;; exit 1 ;;

18
lcov.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
if [ -d ./lcov ]; then
rm -Rf ./lcov
fi
if [ -e ./lcov.dat ]; then
rm ./lcov.dat
fi
if [ -e ./lcov.tgz ]; then
rm ./lcov.tgz
fi
lcov --capture --directory src --output-file ./lcov.dat
genhtml ./lcov.dat --output-directory lcov
tar -zcvf lcov.tgz lcov

View File

@ -8,3 +8,7 @@ install:
uninstall: uninstall:
true true
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-rm -rf test-harness/twtest

View File

@ -519,7 +519,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive clean: clean-recursive
clean-am: clean-generic mostlyclean-am clean-am: clean-generic clean-local mostlyclean-am
distclean: distclean-recursive distclean: distclean-recursive
-rm -f Makefile -rm -f Makefile
@ -586,16 +586,17 @@ uninstall-am:
.MAKE: $(am__recursive_targets) install-am install-strip .MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
check-am clean clean-generic cscopelist-am ctags ctags-am \ check-am clean clean-generic clean-local cscopelist-am ctags \
distclean distclean-generic distclean-tags distdir dvi dvi-am \ ctags-am distclean distclean-generic distclean-tags distdir \
html html-am info info-am install install-am install-data \ dvi dvi-am html html-am info info-am install install-am \
install-data-am install-dvi install-dvi-am install-exec \ install-data install-data-am install-dvi install-dvi-am \
install-exec-am install-html install-html-am install-info \ install-exec install-exec-am install-html install-html-am \
install-info-am install-man install-pdf install-pdf-am \ install-info install-info-am install-man install-pdf \
install-ps install-ps-am install-strip installcheck \ install-pdf-am install-ps install-ps-am install-strip \
installcheck-am installdirs installdirs-am maintainer-clean \ installcheck installcheck-am installdirs installdirs-am \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ maintainer-clean maintainer-clean-generic mostlyclean \
pdf-am ps ps-am tags tags-am uninstall uninstall-am mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am
.PRECIOUS: Makefile .PRECIOUS: Makefile
@ -606,6 +607,11 @@ install:
uninstall: uninstall:
true true
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-rm -rf test-harness/twtest
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

View File

@ -35,6 +35,7 @@ libcore_a_LIBADD = @CORE_CRYPT_O@
libcore_a_DEPENDENCIES = @CORE_CRYPT_O@ libcore_a_DEPENDENCIES = @CORE_CRYPT_O@
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(AR) ru ../../lib/libtripwire.a $(libcore_a_OBJECTS) $(libcore_a_LIBADD) $(AR) ru ../../lib/libtripwire.a $(libcore_a_OBJECTS) $(libcore_a_LIBADD)

View File

@ -358,6 +358,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
libcore_a_LIBADD = @CORE_CRYPT_O@ libcore_a_LIBADD = @CORE_CRYPT_O@
libcore_a_DEPENDENCIES = @CORE_CRYPT_O@ libcore_a_DEPENDENCIES = @CORE_CRYPT_O@
CLEANFILES = *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -544,6 +545,7 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

View File

@ -111,6 +111,12 @@ iCodeConverter* iCodeConverter::GetInstance()
return m_pInst; return m_pInst;
} }
void iCodeConverter::Finit()
{
delete m_pInst;
m_pInst = 0;
}
iCodeConverter* iCodeConverter::CreateConverter() iCodeConverter* iCodeConverter::CreateConverter()
{ {
cDebug d("iCodeConverter::CreateConverter()"); cDebug d("iCodeConverter::CreateConverter()");

View File

@ -93,6 +93,8 @@ class iCodeConverter
public: public:
static iCodeConverter* GetInstance(); // Singleton static iCodeConverter* GetInstance(); // Singleton
static void Finit();
/// Subclass Responsibilities /// Subclass Responsibilities

View File

@ -60,5 +60,8 @@ cCore::cCore()
iCodeConverter::GetInstance(); iCodeConverter::GetInstance();
} }
cCore::~cCore()
{
iCodeConverter::Finit();
}

View File

@ -54,6 +54,7 @@ TSS_BeginPackage( cCore )
public: public:
cCore(); cCore();
~cCore();
TSS_EndPackage( cCore ) TSS_EndPackage( cCore )

0
src/core/displayencoder.cpp Executable file → Normal file
View File

10
src/core/hashtable.h Executable file → Normal file
View File

@ -254,10 +254,14 @@ inline void cHashTableIter<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::SeekNextV
{ {
if(mpCurNode) if(mpCurNode)
mpCurNode = mpCurNode->next; mpCurNode = mpCurNode->next;
//mCurIndex++;
while((! mpCurNode) && (mCurIndex < mHashTable.mTableSize)) // if we're out of range, bail out w/o incrementing index
if(mCurIndex >= mHashTable.mTableSize)
return;
while((! mpCurNode) && (++mCurIndex < mHashTable.mTableSize))
{ {
mpCurNode = mHashTable.mTable[++mCurIndex]; mpCurNode = mHashTable.mTable[mCurIndex];
} }
} }

View File

@ -78,7 +78,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <time.h> #include <time.h>
#if defined(HAVE_MALLOC_H) #if HAVE_MALLOC_H && !IS_AROS
#include <malloc.h> #include <malloc.h>
#endif #endif
#include <string.h> #include <string.h>

View File

@ -320,6 +320,8 @@
// which uses this syntax for UNC paths. So we'll allow leading double slashes there, but // which uses this syntax for UNC paths. So we'll allow leading double slashes there, but
// continue removing them on all other platforms // continue removing them on all other platforms
#define USE_DEV_URANDOM (HAVE_DEV_URANDOM && ENABLE_DEV_URANDOM)
//============================================================================= //=============================================================================
// Miscellaneous // Miscellaneous
// //

View File

@ -365,10 +365,12 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const
#ifdef S_ISSOCK #ifdef S_ISSOCK
else if(S_ISSOCK(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_SOCK; else if(S_ISSOCK(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_SOCK;
#endif #endif
#ifdef S_IFDOOR
#if HAVE_DOOR_CREATE
else if(S_ISDOOR(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_DOOR; else if(S_ISDOOR(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_DOOR;
#endif #endif
#ifdef S_ISPORT
#if HAVE_PORT_CREATE
else if(S_ISPORT(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_PORT; else if(S_ISPORT(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_PORT;
#endif #endif
@ -594,12 +596,14 @@ void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) cons
case S_IFLNK: case S_IFLNK:
szPerm[0] = _T('l'); szPerm[0] = _T('l');
break; break;
#ifdef S_IFDOOR
#if HAVE_DOOR_CREATE // Solaris doors
case S_IFDOOR: case S_IFDOOR:
szPerm[0] = _T('D'); szPerm[0] = _T('D');
break; break;
#endif #endif
#ifdef S_ISPORT
#if HAVE_PORT_CREATE // Solaris event ports
case S_IFPORT: case S_IFPORT:
szPerm[0] = _T('P'); szPerm[0] = _T('P');
break; break;

View File

@ -20,7 +20,7 @@ libcryptlib_a_HEADERS = \
ztrees.h ztrees.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = ../../lib/libcryptlib.a CLEANFILES = ../../lib/libcryptlib.a *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(LN) -f $(noinst_LIBRARIES) ../../lib/libcryptlib.a $(LN) -f $(noinst_LIBRARIES) ../../lib/libcryptlib.a

View File

@ -333,7 +333,7 @@ libcryptlib_a_HEADERS = \
queue.h rng.h sha.h smartptr.h words.h zbits.h zdeflate.h zinflate.h \ queue.h rng.h sha.h smartptr.h words.h zbits.h zdeflate.h zinflate.h \
ztrees.h ztrees.h
CLEANFILES = ../../lib/libcryptlib.a CLEANFILES = ../../lib/libcryptlib.a *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View File

@ -13,6 +13,7 @@ libdb_a_HEADERS = \
db.h dberrors.h hierdatabase.h hierdbnode.h hierdbpath.h stddb.h db.h dberrors.h hierdatabase.h hierdbnode.h hierdbpath.h stddb.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(AR) ru ../../lib/libtripwire.a $(libdb_a_OBJECTS) $(AR) ru ../../lib/libtripwire.a $(libdb_a_OBJECTS)

View File

@ -324,6 +324,7 @@ libdb_a_HEADERS = \
block.h blockfile.h blockrecordarray.h blockrecordfile.h \ block.h blockfile.h blockrecordarray.h blockrecordfile.h \
db.h dberrors.h hierdatabase.h hierdbnode.h hierdbpath.h stddb.h db.h dberrors.h hierdatabase.h hierdbnode.h hierdbpath.h stddb.h
CLEANFILES = *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -510,6 +511,7 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

View File

@ -27,6 +27,7 @@ libfco_a_HEADERS = \
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(AR) ru ../../lib/libtripwire.a $(libfco_a_OBJECTS) $(AR) ru ../../lib/libtripwire.a $(libfco_a_OBJECTS)

View File

@ -345,6 +345,7 @@ libfco_a_HEADERS = \
iterproxy.h parsergenreutil.h propset.h signature.h \ iterproxy.h parsergenreutil.h propset.h signature.h \
stdfco.h twfactory.h stdfco.h twfactory.h
CLEANFILES = *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -531,6 +532,7 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

View File

@ -92,4 +92,10 @@ void cFCOSpecAttr::TraceContents(int dl) const
} }
} }
bool cFCOSpecAttr::operator==(const cFCOSpecAttr& rhs) const
{
return ( (mEmailAddrs == rhs.mEmailAddrs)
&& (mName == rhs.mName)
&& (mSeverity == rhs.mSeverity));
}

View File

@ -76,6 +76,8 @@ public:
void TraceContents(int dl = -1) const; void TraceContents(int dl = -1) const;
bool operator==(const cFCOSpecAttr& rhs) const;
DECLARE_SERREFCOUNT() DECLARE_SERREFCOUNT()
private: private:
cFCOSpecAttr (const cFCOSpecAttr& rhs); // not impl cFCOSpecAttr (const cFCOSpecAttr& rhs); // not impl

View File

@ -17,6 +17,7 @@ libfs_a_HEADERS = \
fsvisitor.h stdfs.h fsvisitor.h stdfs.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(AR) ru ../../lib/libtripwire.a $(libfs_a_OBJECTS) $(AR) ru ../../lib/libtripwire.a $(libfs_a_OBJECTS)

View File

@ -331,6 +331,7 @@ libfs_a_HEADERS = \
fspropcalc.h fspropdisplayer.h fspropset.h fsstrings.h \ fspropcalc.h fspropdisplayer.h fspropset.h fsstrings.h \
fsvisitor.h stdfs.h fsvisitor.h stdfs.h
CLEANFILES = *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -517,6 +518,7 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

View File

@ -76,7 +76,12 @@ iFCOSpec* cFSFactory::CreateSpec(const TSTRING& name, iFCOSpecHelper* pHelper) c
iFCOPropDisplayer* cFSFactory::CreatePropDisplayer() const iFCOPropDisplayer* cFSFactory::CreatePropDisplayer() const
{ {
return new cFSPropDisplayer(); static iFCOPropDisplayer* gPropDisplayer = 0;
if (!gPropDisplayer)
gPropDisplayer = new cFSPropDisplayer();
return gPropDisplayer;
} }
iSerRefCountObj::CreateFunc cFSFactory::GetCreateFunc() const iSerRefCountObj::CreateFunc cFSFactory::GetCreateFunc() const

View File

@ -509,4 +509,9 @@ bool cFSPropDisplayer::AddGroupnameMapping( const int64& i64gid, const TSTRING&
return( ret.second = false ); // returns true if key didn't exist before return( ret.second = false ); // returns true if key didn't exist before
} }
bool cFSPropDisplayer::operator==(const cFSPropDisplayer& rhs) const
{
return (mpvPropsWeDisplay == rhs.mpvPropsWeDisplay
&& uidToUsername == rhs.uidToUsername
&& gidToGroupname == rhs.gidToGroupname);
}

View File

@ -114,6 +114,9 @@ public:
virtual bool GetLazy() const; virtual bool GetLazy() const;
virtual void Read (iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive) virtual void Read (iSerializer* pSerializer, int32 version = 0); // throw (eSerializer, eArchive)
virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive) virtual void Write(iSerializer* pSerializer) const; // throw (eSerializer, eArchive)
bool operator==(const cFSPropDisplayer& rhs) const; // for testing
private: private:
void AddMapping( const iFCOProp* const pProp, const TSTRING& tstrValue, const int propTypeEnum ); void AddMapping( const iFCOProp* const pProp, const TSTRING& tstrValue, const int propTypeEnum );
// pass in a property value and its string representation. for instance: ( FS::PROP_UID --> username ) // pass in a property value and its string representation. for instance: ( FS::PROP_UID --> username )

View File

@ -16,7 +16,7 @@ siggen_HEADERS = \
siggen.h siggencmdline.h siggenstrings.h stdsiggen.h siggen.h siggencmdline.h siggenstrings.h stdsiggen.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = ../../bin/siggen CLEANFILES = ../../bin/siggen *.gcno *.gcda
all: $(sbin_PROGRAMS) all: $(sbin_PROGRAMS)
@test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin

View File

@ -318,7 +318,7 @@ siggen_SOURCES = \
siggen_HEADERS = \ siggen_HEADERS = \
siggen.h siggencmdline.h siggenstrings.h stdsiggen.h siggen.h siggencmdline.h siggenstrings.h stdsiggen.h
CLEANFILES = ../../bin/siggen CLEANFILES = ../../bin/siggen *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View File

@ -28,39 +28,46 @@ sub initialize() {
# #
sub run() { sub run() {
my $twpassed = 1; my $twpassed = 1;
twtools::logStatus("*** Beginning $description\n"); twtools::logStatus("*** Beginning $description\n");
printf("%-30s", "-- $description"); printf("%-30s", "-- $description");
# lets see if the system 'cksum' agree's with siggen's crc32 value # lets see if the system 'cksum' agree's with siggen's crc32 value
# #
my ($crc32, undef) = split(/ /, `cksum $twtools::twrootdir/test`); my ($crc32, undef) = split(/ /, `cksum $twtools::twrootdir/test`);
my $siggen = `$twtools::twrootdir/bin/siggen -h -t -C $twtools::twrootdir/test`;
chomp $crc32; if ($crc32 eq "") {
chomp $siggen; ++$twtools::twskippedtests;
print "SKIPPED\n";
return;
}
# cksum issues results in decimal, so get siggen's result in base10. my $siggen = `$twtools::twrootdir/bin/siggen -h -t -C $twtools::twrootdir/test`;
$siggen = hex($siggen);
twtools::logStatus(" cksum reports: $crc32\n"); chomp $crc32;
twtools::logStatus("siggen reports: $siggen\n"); chomp $siggen;
$twpassed = ($crc32 eq $siggen); # cksum issues results in decimal, so get siggen's result in base10.
$siggen = hex($siggen);
######################################################### twtools::logStatus(" cksum reports: $crc32\n");
# twtools::logStatus("siggen reports: $siggen\n");
# See if the tests all succeeded...
# $twpassed = ($crc32 eq $siggen);
if ($twpassed) {
#########################################################
#
# See if the tests all succeeded...
#
if ($twpassed) {
print "PASSED\n"; print "PASSED\n";
++$twtools::twpassedtests; ++$twtools::twpassedtests;
} }
else { else {
++$twtools::twfailedtests; ++$twtools::twfailedtests;
print "*FAILED*\n"; print "*FAILED*\n";
} }
} }

View File

@ -35,12 +35,12 @@ sub PolicyFileString
# #
(rulename="RuleA", severity=30, emailto="elvis@mars") (rulename="RuleA", severity=30, emailto="elvis@mars")
{ {
$root -> \$(ReadOnly)+S; #read only plus SHA-1 $root -> \$(ReadOnly) +S -ab; #read only plus SHA-1 minus atime & blocks
} }
(rulename="RuleB", severity=200, emailto="elvis@mars") (rulename="RuleB", severity=200, emailto="elvis@mars")
{ {
$root2 -> \$(ReadOnly)+S; #read only plus SHA-1 $root2 -> \$(ReadOnly) +S -ab; #read only plus SHA-1 minus atime & blocks
} }
POLICY_END POLICY_END

View File

@ -31,8 +31,8 @@ sub PolicyFileString
return <<POLICY_END; return <<POLICY_END;
# Policy file generated by polupdate test # Policy file generated by polupdate test
# #
$root1 -> \$(ReadOnly)+M; #read only plus MD5 $root1 -> \$(ReadOnly) +M -ab; #read only plus MD5 minus atime & blocks
$root2 -> \$(ReadOnly)+M; #read only plus MD5 $root2 -> \$(ReadOnly) +M -ab; #read only plus MD5 minus atime & blocks
POLICY_END POLICY_END
@ -46,8 +46,8 @@ sub PolicyFileStringNew
return <<POLICY_END; return <<POLICY_END;
# Policy file generated by polupdate test # Policy file generated by polupdate test
# #
$root1 -> \$(ReadOnly)+S; #read only plus SHA1 $root1 -> \$(ReadOnly) +S -ab; #read only plus SHA1 minus atime & blocks
$root3 -> \$(ReadOnly)+S; #read only plus SHA1 $root3 -> \$(ReadOnly) +S -ab; #read only plus SHA1 minus atime & blocks
POLICY_END POLICY_END

View File

@ -54,7 +54,7 @@ BEGIN {
EMAILREPORTLEVEL => '3', EMAILREPORTLEVEL => '3',
REPORTLEVEL => '3', REPORTLEVEL => '3',
MAILMETHOD => 'SENDMAIL', MAILMETHOD => 'SENDMAIL',
SYSLOGREPORTING => 'false', SYSLOGREPORTING => 'true',
MAILPROGRAM => 'cat', MAILPROGRAM => 'cat',
MAILFROMADDRESS => 'taz@cat' MAILFROMADDRESS => 'taz@cat'
); );
@ -221,7 +221,7 @@ sub PrintPolicy {
my (@out) = `$twrootdir/bin/twadmin -m p -c $twrootdir/$twcfgloc -p $twrootdir/$twpolfileloc -S $twrootdir/$twsitekeyloc $params{opts} 2>&1`; my (@out) = `$twrootdir/bin/twadmin -m p -c $twrootdir/$twcfgloc -p $twrootdir/$twpolfileloc -S $twrootdir/$twsitekeyloc $params{opts} 2>&1`;
my ($result) = ${^CHILD_ERROR_NATIVE}; my ($result) = $?;
logStatus(@out); logStatus(@out);
@ -239,7 +239,7 @@ sub PrintConfig {
logStatus "printing config file...\n"; logStatus "printing config file...\n";
my (@out) = `$twrootdir/bin/twadmin -m f -c $twrootdir/$twcfgloc $params{opts} 2>&1`; my (@out) = `$twrootdir/bin/twadmin -m f -c $twrootdir/$twcfgloc $params{opts} 2>&1`;
my ($result) = ${^CHILD_ERROR_NATIVE}; my ($result) = $?;
logStatus(@out); logStatus(@out);
@ -275,7 +275,7 @@ sub GeneratePolicyFile {
my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc 2>&1`; my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $twrootdir/$twpolicyloc 2>&1`;
my ($result) = ${^CHILD_ERROR_NATIVE}; my ($result) = $?;
logStatus(@out); logStatus(@out);
@ -297,7 +297,7 @@ sub CreatePolicy {
my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text} 2>&1`; my (@out) = `$twrootdir/bin/twadmin -m P -c $twrootdir/$twcfgloc -Q $twsitepass -p $twrootdir/$twpolfileloc $params{policy-text} 2>&1`;
my ($result) = ${^CHILD_ERROR_NATIVE}; my ($result) = $?;
logStatus(@out); logStatus(@out);
@ -315,7 +315,7 @@ sub InitializeDatabase {
print "initializing database for '$twmsg' test...\n" if $verbose; print "initializing database for '$twmsg' test...\n" if $verbose;
my (@out) = `$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`; my (@out) = `$twrootdir/bin/tripwire -m i -P $twsitepass -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc 2>&1`;
my ($result) = ${^CHILD_ERROR_NATIVE}; my ($result) = $?;
logStatus(@out); logStatus(@out);
@ -335,7 +335,7 @@ sub UpdateDatabase {
print "updating database for '$twmsg' test...\n" if $verbose; print "updating database for '$twmsg' test...\n" if $verbose;
my (@out) = `$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{secure-mode} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc -r $params{report} 2>&1`; my (@out) = `$twrootdir/bin/tripwire -m u -a -P $twsitepass -Z $params{secure-mode} -p $twrootdir/$twpolfileloc -c $twrootdir/$twcfgloc -r $params{report} 2>&1`;
my ($result) = ${^CHILD_ERROR_NATIVE}; my ($result) = $?;
logStatus(@out); logStatus(@out);

View File

@ -20,7 +20,7 @@ tripwire_HEADERS = \
tripwirestrings.h tripwireutil.h twcmdline.h twcmdlineutil.h updatedb.h tripwirestrings.h tripwireutil.h twcmdline.h twcmdlineutil.h updatedb.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a *.gcno *.gcda
all: $(sbin_PROGRAMS) all: $(sbin_PROGRAMS)
@test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin

View File

@ -326,7 +326,7 @@ tripwire_HEADERS = \
stdtripwire.h syslog_trip.h tripwire.h tripwireerrors.h tripwiremsg.h \ stdtripwire.h syslog_trip.h tripwire.h tripwireerrors.h tripwiremsg.h \
tripwirestrings.h tripwireutil.h twcmdline.h twcmdlineutil.h updatedb.h tripwirestrings.h tripwireutil.h twcmdline.h twcmdlineutil.h updatedb.h
CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a CLEANFILES = ../../bin/tripwire ../../lib/libtripwire.a *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View File

@ -254,52 +254,66 @@ static void InitCmdLineCommon(cCmdLineParser& parser)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf) static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
{ {
TSTRING str; TSTRING str;
if(cf.Lookup(TSTRING(_T("POLFILE")), str)) if(cf.Lookup(TSTRING(_T("POLFILE")), str))
pModeInfo->mPolFile = str;
if(cf.Lookup(TSTRING(_T("DBFILE")), str))
pModeInfo->mDbFile = str;
if(cf.Lookup(TSTRING(_T("SITEKEYFILE")), str))
pModeInfo->mSiteKeyFile = str;
if(cf.Lookup(TSTRING(_T("LOCALKEYFILE")), str))
pModeInfo->mLocalKeyFile = str;
if(cf.Lookup(TSTRING(_T("REPORTFILE")), str))
pModeInfo->mReportFile = str;
if(cf.Lookup(TSTRING(_T("EDITOR")), str))
pModeInfo->mEditor = str;
if(cf.Lookup(TSTRING(_T("LATEPROMPTING")), str))
{ {
if (_tcsicmp(str.c_str(), _T("true")) == 0) pModeInfo->mPolFile = str;
pModeInfo->mbLatePassphrase = true;
}
if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str))
{
// We do not support reset access time on Unix, so we issue a warning.
// This used to be a fatal error, however this prevents
// cross platform config files.
cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL));
} }
if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str)) if(cf.Lookup(TSTRING(_T("DBFILE")), str))
{ {
if (_tcsicmp(str.c_str(), _T("true")) == 0) pModeInfo->mDbFile = str;
pModeInfo->mfLooseDirs = true; }
if(cf.Lookup(TSTRING(_T("SITEKEYFILE")), str))
{
pModeInfo->mSiteKeyFile = str;
}
if(cf.Lookup(TSTRING(_T("LOCALKEYFILE")), str))
{
pModeInfo->mLocalKeyFile = str;
}
if(cf.Lookup(TSTRING(_T("REPORTFILE")), str))
{
pModeInfo->mReportFile = str;
}
if(cf.Lookup(TSTRING(_T("EDITOR")), str))
{
pModeInfo->mEditor = str;
}
if(cf.Lookup(TSTRING(_T("LATEPROMPTING")), str))
{
if (_tcsicmp(str.c_str(), _T("true")) == 0)
pModeInfo->mbLatePassphrase = true;
} }
if(cf.Lookup(TSTRING(_T("RESETACCESSTIME")), str))
{
// We do not support reset access time on Unix, so we issue a warning.
// This used to be a fatal error, however this prevents
// cross platform config files.
cTWUtil::PrintErrorMsg(eTWInvalidConfigFileKey(_T("RESETACCESSTIME"), eError::NON_FATAL));
}
if(cf.Lookup(TSTRING(_T("LOOSEDIRECTORYCHECKING")), str))
{
if (_tcsicmp(str.c_str(), _T("true")) == 0)
pModeInfo->mfLooseDirs = true;
}
TSTRING temp_directory; TSTRING temp_directory;
cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory); cf.Lookup(TSTRING(_T("TEMPDIRECTORY")), temp_directory);
if (temp_directory.length() == 0) { if (temp_directory.empty())
{
#if IS_AROS #if IS_AROS
temp_directory = "T:"; temp_directory = "T:";
#else #else
temp_directory = "/tmp/"; temp_directory = "/tmp/";
#endif #endif
} }
// make sure we have a trailing slash -- thanks Jarno... // make sure we have a trailing slash -- thanks Jarno...
// //
if (temp_directory[_tcslen(str.c_str())-1] != '/') { if (*temp_directory.rbegin() != '/')
temp_directory += '/'; {
temp_directory.push_back('/');
} }
// make sure it exists... // make sure it exists...
// //
@ -308,41 +322,43 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
temp_directory = cDevicePath::AsNative(temp_directory); temp_directory = cDevicePath::AsNative(temp_directory);
#endif #endif
if (access(temp_directory.c_str(), F_OK) != 0) { if (access(temp_directory.c_str(), F_OK) != 0)
TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY );
TSTRING tmpStr = _T("Directory: ");
tmpStr += (temp_directory + _T("\n"));
tmpStr += errStr;
throw eTWInvalidTempDirectory(tmpStr);
}
else {
iFSServices::GetInstance()->SetTempDirName(temp_directory);
}
if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str)) {
if (str.length() != 0)
pModeInfo->mGlobalEmail = str;
}
//
// Set the report-viewing level if one has been specified, use
// default level otherwise.
//
if(cf.Lookup(TSTRING(_T("EMAILREPORTLEVEL")), str))
{ {
if (_tcsicmp(str.c_str(), _T("0")) == 0) TSTRING errStr = TSS_GetString( cCore, core::STR_BAD_TEMPDIRECTORY );
pModeInfo->mEmailReportLevel = cTextReportViewer::SINGLE_LINE; TSTRING tmpStr = _T("Directory: ");
else if (_tcsicmp(str.c_str(), _T("1")) == 0) tmpStr += (temp_directory + _T("\n"));
pModeInfo->mEmailReportLevel = cTextReportViewer::PARSEABLE; tmpStr += errStr;
else if (_tcsicmp(str.c_str(), _T("2")) == 0) throw eTWInvalidTempDirectory(tmpStr);
pModeInfo->mEmailReportLevel = cTextReportViewer::SUMMARY_ONLY; }
else if (_tcsicmp(str.c_str(), _T("3")) == 0) else
pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT; {
else if (_tcsicmp(str.c_str(), _T("4")) == 0) iFSServices::GetInstance()->SetTempDirName(temp_directory);
pModeInfo->mEmailReportLevel = cTextReportViewer::FULL_REPORT; }
else
if (cf.Lookup(TSTRING(_T("GLOBALEMAIL")), str))
{
if (str.length() != 0)
pModeInfo->mGlobalEmail = str;
}
//
// Set the report-viewing level if one has been specified, use
// default level otherwise.
//
if(cf.Lookup(TSTRING(_T("EMAILREPORTLEVEL")), str))
{
if (_tcsicmp(str.c_str(), _T("0")) == 0)
pModeInfo->mEmailReportLevel = cTextReportViewer::SINGLE_LINE;
else if (_tcsicmp(str.c_str(), _T("1")) == 0)
pModeInfo->mEmailReportLevel = cTextReportViewer::PARSEABLE;
else if (_tcsicmp(str.c_str(), _T("2")) == 0)
pModeInfo->mEmailReportLevel = cTextReportViewer::SUMMARY_ONLY;
else if (_tcsicmp(str.c_str(), _T("3")) == 0)
pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT;
else if (_tcsicmp(str.c_str(), _T("4")) == 0)
pModeInfo->mEmailReportLevel = cTextReportViewer::FULL_REPORT;
else
{ {
// They specified an illegal level, error. // They specified an illegal level, error.
TSTRING errStr = _T("Invalid Level: "); TSTRING errStr = _T("Invalid Level: ");
@ -350,24 +366,25 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
throw eTWInvalidReportLevelCfg( errStr ); throw eTWInvalidReportLevelCfg( errStr );
} }
} }
else else
// no level was specified in the configuration file, use default.
pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT;
// Decide what mail method should be used to email reports
if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str))
{ {
if (_tcsicmp(str.c_str(), _T("SENDMAIL")) == 0) // no level was specified in the configuration file, use default.
pModeInfo->mMailMethod = cMailMessage::MAIL_BY_PIPE; pModeInfo->mEmailReportLevel = cTextReportViewer::CONCISE_REPORT;
else if( _tcsicmp( str.c_str(), _T("SMTP") ) == 0 )
pModeInfo->mMailMethod = cMailMessage::MAIL_BY_SMTP;
else
pModeInfo->mMailMethod = cMailMessage::INVALID_METHOD;
} }
else
// Decide what mail method should be used to email reports
if(cf.Lookup(TSTRING(_T("MAILMETHOD")), str))
{ {
pModeInfo->mMailMethod = cMailMessage::NO_METHOD; if (_tcsicmp(str.c_str(), _T("SENDMAIL")) == 0)
pModeInfo->mMailMethod = cMailMessage::MAIL_BY_PIPE;
else if( _tcsicmp( str.c_str(), _T("SMTP") ) == 0 )
pModeInfo->mMailMethod = cMailMessage::MAIL_BY_SMTP;
else
pModeInfo->mMailMethod = cMailMessage::INVALID_METHOD;
}
else
{
pModeInfo->mMailMethod = cMailMessage::NO_METHOD;
} }
#if !SUPPORTS_NETWORKING #if !SUPPORTS_NETWORKING
@ -375,60 +392,76 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
throw eMailSMTPNotSupported(); throw eMailSMTPNotSupported();
#endif #endif
// Get the SMTP server // Get the SMTP server
if(cf.Lookup(TSTRING(_T("SMTPHOST")), str)) if(cf.Lookup(TSTRING(_T("SMTPHOST")), str))
pModeInfo->mSmtpHost = str;
else
pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default
// Get the SMTP port number
if(cf.Lookup(TSTRING(_T("SMTPPORT")), str))
{ {
int i = _ttoi( str.c_str() ); pModeInfo->mSmtpHost = str;
if( i < 0 || i > SHRT_MAX ) }
else
{
pModeInfo->mSmtpHost = _T("127.0.0.1"); // this is the default
}
// Get the SMTP port number
if(cf.Lookup(TSTRING(_T("SMTPPORT")), str))
{
int i = _ttoi( str.c_str() );
if( i < 0 || i > SHRT_MAX )
throw eTWInvalidPortNumber( str ); throw eTWInvalidPortNumber( str );
pModeInfo->mSmtpPort = static_cast<unsigned short>( i ); pModeInfo->mSmtpPort = static_cast<unsigned short>( i );
} }
else else
pModeInfo->mSmtpPort = 25; // this is the default
// Get the mail program to use if we're piping our email
if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str))
pModeInfo->mMailProgram = str;
else
pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified
// Get the mail program to use if we're piping our email
if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str))
{ {
if (_tcsicmp(str.c_str(), _T("true")) == 0) pModeInfo->mSmtpPort = 25; // this is the default
pModeInfo->mMailNoViolations = true;
else
pModeInfo->mMailNoViolations = false;
} }
else
pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified
if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str)) // Get the mail program to use if we're piping our email
pModeInfo->mMailFrom = str; if(cf.Lookup(TSTRING(_T("MAILPROGRAM")), str))
{
pModeInfo->mMailProgram = str;
}
else
{
pModeInfo->mMailProgram.erase(); // MAILPROGRAM is not required to be specified
}
// Get the mail program to use if we're piping our email
if(cf.Lookup(TSTRING(_T("MAILNOVIOLATIONS")), str))
{
if (_tcsicmp(str.c_str(), _T("true")) == 0)
pModeInfo->mMailNoViolations = true;
else
pModeInfo->mMailNoViolations = false;
}
else
{
pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified
}
if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str))
{
pModeInfo->mMailFrom = str;
}
// SYSLOG reporting // SYSLOG reporting
if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str)) if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str))
{ {
#if SUPPORTS_SYSLOG #if SUPPORTS_SYSLOG
if (_tcsicmp(str.c_str(), _T("true")) == 0) if (_tcsicmp(str.c_str(), _T("true")) == 0)
pModeInfo->mbLogToSyslog = true; pModeInfo->mbLogToSyslog = true;
else else
pModeInfo->mbLogToSyslog = false; pModeInfo->mbLogToSyslog = false;
#else #else
throw eTWSyslogNotSupported(); throw eTWSyslogNotSupported();
#endif #endif
} }
else else
pModeInfo->mbLogToSyslog = false; {
pModeInfo->mbLogToSyslog = false;
}
// Crossing file systems // Crossing file systems
if(cf.Lookup(TSTRING(_T("CROSSFILESYSTEMS")), str)) if(cf.Lookup(TSTRING(_T("CROSSFILESYSTEMS")), str))
{ {
if (_tcsicmp(str.c_str(), _T("true")) == 0) if (_tcsicmp(str.c_str(), _T("true")) == 0)
pModeInfo->mbCrossFileSystems = true; pModeInfo->mbCrossFileSystems = true;
@ -457,20 +490,20 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
iFSServices::GetInstance()->SetResolveNames(false); iFSServices::GetInstance()->SetResolveNames(false);
} }
// //
// turn all of the file names into full paths (they're relative to the exe dir) // turn all of the file names into full paths (they're relative to the exe dir)
// //
TSTRING fullPath; TSTRING fullPath;
if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mPolFile, cSystemInfo::GetExeDir() )) if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mPolFile, cSystemInfo::GetExeDir() ))
pModeInfo->mPolFile = fullPath; pModeInfo->mPolFile = fullPath;
if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mDbFile, cSystemInfo::GetExeDir() )) if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mDbFile, cSystemInfo::GetExeDir() ))
pModeInfo->mDbFile = fullPath; pModeInfo->mDbFile = fullPath;
if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mSiteKeyFile, cSystemInfo::GetExeDir() )) if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mSiteKeyFile, cSystemInfo::GetExeDir() ))
pModeInfo->mSiteKeyFile = fullPath; pModeInfo->mSiteKeyFile = fullPath;
if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mLocalKeyFile, cSystemInfo::GetExeDir() )) if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mLocalKeyFile, cSystemInfo::GetExeDir() ))
pModeInfo->mLocalKeyFile = fullPath; pModeInfo->mLocalKeyFile = fullPath;
if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mReportFile, cSystemInfo::GetExeDir() )) if(iFSServices::GetInstance()->FullPath( fullPath, pModeInfo->mReportFile, cSystemInfo::GetExeDir() ))
pModeInfo->mReportFile = fullPath; pModeInfo->mReportFile = fullPath;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -20,6 +20,7 @@ libtw_a_HEADERS = \
tw.h twerrors.h twinit.h twstrings.h twutil.h tw.h twerrors.h twinit.h twstrings.h twutil.h
DEFS = @DEFS@ -DCONFIG_DIR=\"$(sysconfdir)\" DEFS = @DEFS@ -DCONFIG_DIR=\"$(sysconfdir)\"
CLEANFILES = *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(AR) ru ../../lib/libtripwire.a $(libtw_a_OBJECTS) $(AR) ru ../../lib/libtripwire.a $(libtw_a_OBJECTS)

View File

@ -337,6 +337,7 @@ libtw_a_HEADERS = \
stdtw.h systeminfo.h textdbviewer.h textreportviewer.h \ stdtw.h systeminfo.h textdbviewer.h textreportviewer.h \
tw.h twerrors.h twinit.h twstrings.h twutil.h tw.h twerrors.h twinit.h twstrings.h twutil.h
CLEANFILES = *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -523,6 +524,7 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

View File

@ -17,7 +17,7 @@ twadmin_HEADERS = \
twadmincl.h twadminerrors.h twadminstrings.h twadmincl.h twadminerrors.h twadminstrings.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = ../../bin/twadmin CLEANFILES = ../../bin/twadmin *.gcno *.gcda
all: $(sbin_PROGRAMS) all: $(sbin_PROGRAMS)
@test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin

View File

@ -319,7 +319,7 @@ twadmin_HEADERS = \
keygeneration.h resource.h stdtwadmin.h twadmin.h \ keygeneration.h resource.h stdtwadmin.h twadmin.h \
twadmincl.h twadminerrors.h twadminstrings.h twadmincl.h twadminerrors.h twadminstrings.h
CLEANFILES = ../../bin/twadmin CLEANFILES = ../../bin/twadmin *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View File

@ -13,6 +13,7 @@ libtwcrypto_a_HEADERS = \
stdtwcrypto.h twcrypto.h twcryptoerrors.h stdtwcrypto.h twcrypto.h twcryptoerrors.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(AR) ru ../../lib/libtripwire.a $(libtwcrypto_a_OBJECTS) $(AR) ru ../../lib/libtripwire.a $(libtwcrypto_a_OBJECTS)

View File

@ -325,6 +325,7 @@ libtwcrypto_a_HEADERS = \
bytequeue.h crypto.h cryptoarchive.h keyfile.h \ bytequeue.h crypto.h cryptoarchive.h keyfile.h \
stdtwcrypto.h twcrypto.h twcryptoerrors.h stdtwcrypto.h twcrypto.h twcryptoerrors.h
CLEANFILES = *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -511,6 +512,7 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

View File

@ -1241,7 +1241,7 @@ cHashedKey192::~cHashedKey192()
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
#if HAVE_DEV_URANDOM #if USE_DEV_URANDOM
static bool randomize_by_device(const char* device_name, int8* destbuf, int len) static bool randomize_by_device(const char* device_name, int8* destbuf, int len)
{ {
static int rng_device = -1; static int rng_device = -1;
@ -1267,7 +1267,7 @@ static bool gRandomizeBytesSeeded = false;
void RandomizeBytes(int8* destbuf, int len) void RandomizeBytes(int8* destbuf, int len)
{ {
#if HAVE_DEV_URANDOM #if USE_DEV_URANDOM
if (randomize_by_device("/dev/urandom", destbuf, len)) if (randomize_by_device("/dev/urandom", destbuf, len))
return; return;

View File

@ -116,7 +116,10 @@ cCryptoArchive::~cCryptoArchive()
{ {
ASSERT(mAction == MA_UNSTARTED || mAction == MA_UNKNOWN || mAction == MA_FINISHED || mAction == MA_READING); ASSERT(mAction == MA_UNSTARTED || mAction == MA_UNKNOWN || mAction == MA_FINISHED || mAction == MA_READING);
// check we did not leave a buffer unwritten // check we did not leave a buffer unwritten
Finish();
// Finish() normally zeroes these out, but hey.
delete mpDeflator; delete mpDeflator;
delete mpInflator; delete mpInflator;
} }

View File

@ -15,6 +15,7 @@ libtwparser_a_HEADERS = \
yylex.h yyparse.h yylex.h yyparse.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = *.gcno *.gcda
all: $(noinst_LIBRARIES) all: $(noinst_LIBRARIES)
$(AR) ru ../../lib/libtripwire.a $(libtwparser_a_OBJECTS) $(AR) ru ../../lib/libtripwire.a $(libtwparser_a_OBJECTS)

View File

@ -328,6 +328,7 @@ libtwparser_a_HEADERS = \
stdtwparser.h twparser.h twparsererrors.h twparserstrings.h \ stdtwparser.h twparser.h twparsererrors.h twparserstrings.h \
yylex.h yyparse.h yylex.h yyparse.h
CLEANFILES = *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -514,6 +515,7 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

View File

@ -75,6 +75,16 @@ cGenreParseInfo::cGenreParseInfo()
InitPredefinedVariables(); InitPredefinedVariables();
} }
cGenreParseInfo::~cGenreParseInfo()
{
RuleListType::iterator itr;
for( itr = mRuleList.begin(); itr != mRuleList.end(); ++itr )
{
delete *itr;
}
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// AddStopPoint // AddStopPoint
@ -141,6 +151,8 @@ void cGenreParseInfo::InitPredefinedVariables()
{ {
mLocalPredefVarTable.Insert( sVarName, sValue ); mLocalPredefVarTable.Insert( sVarName, sValue );
} }
delete pGU;
} }

View File

@ -80,6 +80,7 @@ class cGenreParseInfo
{ {
public: public:
cGenreParseInfo(); cGenreParseInfo();
~cGenreParseInfo();
void AddStopPoint( const cFCOName& name ); void AddStopPoint( const cFCOName& name );
// adds the specified path as a stop point -- for now, we just queue it up, // adds the specified path as a stop point -- for now, we just queue it up,

90
src/twparser/yylex.cpp Executable file → Normal file
View File

@ -478,7 +478,7 @@ static int yy_base[] = {
}; };
#line 152 "..\\..\\mkslexyacc\\etc\\yylex.cpp" // #line 152 "..\\..\\mkslexyacc\\etc\\yylex.cpp"
// MKS LEX prototype scanner code // MKS LEX prototype scanner code
// Copyright 1991 by Mortice Kern Systems Inc. // Copyright 1991 by Mortice Kern Systems Inc.
@ -505,7 +505,7 @@ const int MIN_NUM_STATES = 20;
#define REJECT goto yy_reject #define REJECT goto yy_reject
#define yymore() goto yy_more #define yymore() goto yy_more
#line 10 "tokens.l" // #line 10 "tokens.l"
#include "stdtwparser.h" #include "stdtwparser.h"
@ -515,7 +515,7 @@ const int MIN_NUM_STATES = 20;
//#endif //#endif
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_MALLOC_H #if HAVE_MALLOC_H && !IS_AROS
#include <malloc.h> #include <malloc.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@ -563,7 +563,7 @@ std::string FormatSyntaxError( char ch, const char* pszAdditionalMsg = NULL )
// saves typing // saves typing
#define TRACE_RETURN(x) lextrace(_T(#x)); return x #define TRACE_RETURN(x) lextrace(_T(#x)); return x
#line 178 "..\\..\\mkslexyacc\\etc\\yylex.cpp" // #line 178 "..\\..\\mkslexyacc\\etc\\yylex.cpp"
// Constructor for yy_scan. Set up tables // Constructor for yy_scan. Set up tables
@ -762,7 +762,7 @@ yy_scan::yylex()
int yyoldi, yyoleng; /* base i, yyleng before look-ahead */ int yyoldi, yyoleng; /* base i, yyleng before look-ahead */
int yyeof; /* 1 if eof has already been read */ int yyeof; /* 1 if eof has already been read */
#line 375 "..\\..\\mkslexyacc\\etc\\yylex.cpp" // #line 375 "..\\..\\mkslexyacc\\etc\\yylex.cpp"
#ifdef YYEXIT #ifdef YYEXIT
@ -876,43 +876,43 @@ yy_scan::yylex()
YY_USER(); YY_USER();
switch (yy_la_act[yyfmin] & 0777) { switch (yy_la_act[yyfmin] & 0777) {
case 0: case 0:
#line 109 "tokens.l" // #line 109 "tokens.l"
{ {
BEGIN( globals ); BEGIN( globals );
} }
break; break;
case 1: case 1:
#line 114 "tokens.l" // #line 114 "tokens.l"
{ {
BEGIN(INITIAL); BEGIN(INITIAL);
return TWP_SECTION; return TWP_SECTION;
} }
break; break;
case 2: case 2:
#line 119 "tokens.l" // #line 119 "tokens.l"
{ TRACE_RETURN(TWP_ECHO); } { TRACE_RETURN(TWP_ECHO); }
break; break;
case 3: case 3:
#line 122 "tokens.l" // #line 122 "tokens.l"
{ {
lextrace(_T("eating spaces...")); /* eat spaces */ lextrace(_T("eating spaces...")); /* eat spaces */
} }
break; break;
case 4: case 4:
#line 125 "tokens.l" // #line 125 "tokens.l"
{ {
cParserHelper::IncrementLineNumber(); cParserHelper::IncrementLineNumber();
lextrace(_T("eating line continuation...")); /* eat line continuations */ lextrace(_T("eating line continuation...")); /* eat line continuations */
} }
break; break;
case 5: case 5:
#line 129 "tokens.l" // #line 129 "tokens.l"
{ {
lextrace(_T("eating comment...")); lextrace(_T("eating comment..."));
} }
break; break;
case 6: case 6:
#line 138 "tokens.l" // #line 138 "tokens.l"
{ {
// we must make copy of string, otherwise another lexeme will clobber it // we must make copy of string, otherwise another lexeme will clobber it
cDebug d("\t\t\t\tlexer::string"); cDebug d("\t\t\t\tlexer::string");
@ -931,7 +931,7 @@ yy_scan::yylex()
} }
break; break;
case 7: case 7:
#line 155 "tokens.l" // #line 155 "tokens.l"
{ {
// we must make copy of string, otherwise another lexeme will clobber it // we must make copy of string, otherwise another lexeme will clobber it
cDebug d("\t\t\t\tlexer::qstring"); cDebug d("\t\t\t\tlexer::qstring");
@ -960,19 +960,19 @@ yy_scan::yylex()
} }
break; break;
case 8: case 8:
#line 182 "tokens.l" // #line 182 "tokens.l"
{ TRACE_RETURN(TWP_SEMICOLON); } { TRACE_RETURN(TWP_SEMICOLON); }
break; break;
case 9: case 9:
#line 183 "tokens.l" // #line 183 "tokens.l"
{ TRACE_RETURN(TWP_EQUALS); } { TRACE_RETURN(TWP_EQUALS); }
break; break;
case 10: case 10:
#line 185 "tokens.l" // #line 185 "tokens.l"
{ cParserHelper::IncrementLineNumber(); } { cParserHelper::IncrementLineNumber(); }
break; break;
case 11: case 11:
#line 186 "tokens.l" // #line 186 "tokens.l"
{ {
std::string strError; std::string strError;
strError = FormatSyntaxError( yytext[0], "The global section only accepts statements of the form:\n variable = value;\n" ); strError = FormatSyntaxError( yytext[0], "The global section only accepts statements of the form:\n variable = value;\n" );
@ -981,102 +981,102 @@ yy_scan::yylex()
} /* catches anything that cannot be deemed a variable definition and exits. */ } /* catches anything that cannot be deemed a variable definition and exits. */
break; break;
case 12: case 12:
#line 196 "tokens.l" // #line 196 "tokens.l"
{ {
lextrace(_T("eating spaces...")); /* eat spaces */ lextrace(_T("eating spaces...")); /* eat spaces */
} }
break; break;
case 13: case 13:
#line 200 "tokens.l" // #line 200 "tokens.l"
{ {
cParserHelper::IncrementLineNumber(); cParserHelper::IncrementLineNumber();
lextrace(_T("eating line continuation...")); /* eat line continuations */ lextrace(_T("eating line continuation...")); /* eat line continuations */
} }
break; break;
case 14: case 14:
#line 205 "tokens.l" // #line 205 "tokens.l"
{ {
lextrace(_T("eating comment...")); lextrace(_T("eating comment..."));
} }
break; break;
case 15: case 15:
#line 209 "tokens.l" // #line 209 "tokens.l"
{ TRACE_RETURN(TWP_LBRACE); } { TRACE_RETURN(TWP_LBRACE); }
break; break;
case 16: case 16:
#line 210 "tokens.l" // #line 210 "tokens.l"
{ TRACE_RETURN(TWP_RBRACE); } { TRACE_RETURN(TWP_RBRACE); }
break; break;
case 17: case 17:
#line 213 "tokens.l" // #line 213 "tokens.l"
{ TRACE_RETURN(TWP_BANG); } { TRACE_RETURN(TWP_BANG); }
break; break;
case 18: case 18:
#line 215 "tokens.l" // #line 215 "tokens.l"
{ TRACE_RETURN(TWP_RARROW); } { TRACE_RETURN(TWP_RARROW); }
break; break;
case 19: case 19:
#line 216 "tokens.l" // #line 216 "tokens.l"
{ TRACE_RETURN(TWP_EQUALS); } { TRACE_RETURN(TWP_EQUALS); }
break; break;
case 20: case 20:
#line 218 "tokens.l" // #line 218 "tokens.l"
{ TRACE_RETURN(TWP_SEMICOLON); } { TRACE_RETURN(TWP_SEMICOLON); }
break; break;
case 21: case 21:
#line 219 "tokens.l" // #line 219 "tokens.l"
{ TRACE_RETURN(TWP_LPAREN); } { TRACE_RETURN(TWP_LPAREN); }
break; break;
case 22: case 22:
#line 220 "tokens.l" // #line 220 "tokens.l"
{ TRACE_RETURN(TWP_RPAREN); } { TRACE_RETURN(TWP_RPAREN); }
break; break;
case 23: case 23:
#line 221 "tokens.l" // #line 221 "tokens.l"
{ TRACE_RETURN(TWP_COMMA); } { TRACE_RETURN(TWP_COMMA); }
break; break;
case 24: case 24:
#line 222 "tokens.l" // #line 222 "tokens.l"
{ TRACE_RETURN(TWP_PIPE); } { TRACE_RETURN(TWP_PIPE); }
break; break;
case 25: case 25:
#line 226 "tokens.l" // #line 226 "tokens.l"
{ TRACE_RETURN(TWP_DOLLAR); } { TRACE_RETURN(TWP_DOLLAR); }
break; break;
case 26: case 26:
#line 227 "tokens.l" // #line 227 "tokens.l"
{ TRACE_RETURN(TWP_OROR); } { TRACE_RETURN(TWP_OROR); }
break; break;
case 27: case 27:
#line 230 "tokens.l" // #line 230 "tokens.l"
{ TRACE_RETURN(TWP_SECTION); } { TRACE_RETURN(TWP_SECTION); }
break; break;
case 28: case 28:
#line 231 "tokens.l" // #line 231 "tokens.l"
{ TRACE_RETURN(TWP_IFHOST); } { TRACE_RETURN(TWP_IFHOST); }
break; break;
case 29: case 29:
#line 232 "tokens.l" // #line 232 "tokens.l"
{ TRACE_RETURN(TWP_ELSE); } { TRACE_RETURN(TWP_ELSE); }
break; break;
case 30: case 30:
#line 233 "tokens.l" // #line 233 "tokens.l"
{ TRACE_RETURN(TWP_ENDIF); } { TRACE_RETURN(TWP_ENDIF); }
break; break;
case 31: case 31:
#line 234 "tokens.l" // #line 234 "tokens.l"
{ TRACE_RETURN(TWP_ERROR); } { TRACE_RETURN(TWP_ERROR); }
break; break;
case 32: case 32:
#line 235 "tokens.l" // #line 235 "tokens.l"
{ TRACE_RETURN(TWP_ECHO); } { TRACE_RETURN(TWP_ECHO); }
break; break;
case 33: case 33:
#line 236 "tokens.l" // #line 236 "tokens.l"
{ lextrace( _T( "@@end" ) ); return 0; } /* logical end of file */ { lextrace( _T( "@@end" ) ); return 0; } /* logical end of file */
break; break;
case 34: case 34:
#line 239 "tokens.l" // #line 239 "tokens.l"
{ {
// we must make copy of string, otherwise another lexeme will clobber it // we must make copy of string, otherwise another lexeme will clobber it
cDebug d("\t\t\t\tlexer::string"); cDebug d("\t\t\t\tlexer::string");
@ -1095,7 +1095,7 @@ yy_scan::yylex()
} }
break; break;
case 35: case 35:
#line 256 "tokens.l" // #line 256 "tokens.l"
{ {
// we must make copy of string, otherwise another lexeme will clobber it // we must make copy of string, otherwise another lexeme will clobber it
cDebug d("\t\t\t\tlexer::qstring"); cDebug d("\t\t\t\tlexer::qstring");
@ -1134,11 +1134,11 @@ yy_scan::yylex()
} }
break; break;
case 36: case 36:
#line 309 "tokens.l" // #line 309 "tokens.l"
{ cParserHelper::IncrementLineNumber(); } { cParserHelper::IncrementLineNumber(); }
break; break;
case 37: case 37:
#line 310 "tokens.l" // #line 310 "tokens.l"
{ {
std::string strError; std::string strError;
strError = FormatSyntaxError( yytext[0] ); strError = FormatSyntaxError( yytext[0] );
@ -1147,7 +1147,7 @@ yy_scan::yylex()
} /* catches anything else that's not in here and quits */ } /* catches anything else that's not in here and quits */
break; break;
#line 487 "..\\..\\mkslexyacc\\etc\\yylex.cpp" // #line 487 "..\\..\\mkslexyacc\\etc\\yylex.cpp"
} }
YY_SCANNER(); YY_SCANNER();
@ -1231,7 +1231,7 @@ yy_scan::unput(int c)
return c; return c;
} }
#line 321 "tokens.l" // #line 321 "tokens.l"

View File

@ -38,7 +38,7 @@
#endif #endif
#define YYNEWLINE 10 #define YYNEWLINE 10
#line 1 "..\\..\\mkslexyacc\\etc\\yylex.cpp" //#line 1 "..\\..\\mkslexyacc\\etc\\yylex.cpp"
// MKS LEX prototype scanner header // MKS LEX prototype scanner header
// Copyright 1991 by Mortice Kern Systems Inc. // Copyright 1991 by Mortice Kern Systems Inc.
// All rights reserved. // All rights reserved.

97
src/twparser/yyparse.cpp Executable file → Normal file
View File

@ -30,7 +30,7 @@
// info@tripwire.org or www.tripwire.org. // info@tripwire.org or www.tripwire.org.
// //
/* ..\. -LC -o ..\twparser\yyparse.cpp -P ..\..\mkslexyacc\etc\yyparse.cpp -D yyparse.h policy.y */ /* ..\. -LC -o ..\twparser\yyparse.cpp -P ..\..\mkslexyacc\etc\yyparse.cpp -D yyparse.h policy.y */
#line 74 "policy.y" // #line 74 "policy.y"
#include "stdtwparser.h" #include "stdtwparser.h"
@ -349,7 +349,7 @@ int yy_parse::yynrule = 55;
#line 2 "..\\..\\mkslexyacc\\etc\\yyparse.cpp" // #line 2 "..\\..\\mkslexyacc\\etc\\yyparse.cpp"
// C++ YACC parser code // C++ YACC parser code
// Copyright 1991 by Mortice Kern Systems Inc. All rights reserved. // Copyright 1991 by Mortice Kern Systems Inc. All rights reserved.
// //
@ -428,7 +428,7 @@ yy_parse::~yy_parse()
#endif #endif
} }
#ifdef YACC_WINDOWS #if 0 //YACC_WINDOWS
// The initial portion of the yacc parser. // The initial portion of the yacc parser.
// In an windows environment, it will load the desired // In an windows environment, it will load the desired
@ -533,7 +533,7 @@ yy_parse::yyparse(yy_scan* ps)
#endif /* YACC_WINDOWS */ #endif /* YACC_WINDOWS */
{ {
#ifdef YACC_WINDOWS #if 0 //YACC_WINDOWS
short far *yyp; // needed as res tables locked in far memory short far *yyp; // needed as res tables locked in far memory
short far *yyq; short far *yyq;
#else #else
@ -594,7 +594,7 @@ yyEncore:
#endif #endif
} }
#endif #endif
#ifdef YACC_WINDOWS #if 0 //YACC_WINDOWS
if (yystate >= Sizeof_yypact) /* simple state */ if (yystate >= Sizeof_yypact) /* simple state */
#else /* YACC_WINDOWS */ #else /* YACC_WINDOWS */
if (yystate >= (int)sizeof yypact/(int)sizeof yypact[0]) /* simple state */ if (yystate >= (int)sizeof yypact/(int)sizeof yypact[0]) /* simple state */
@ -640,7 +640,7 @@ yyEncore:
* Fell through - take default action * Fell through - take default action
*/ */
#ifdef YACC_WINDOWS #if 0 //YACC_WINDOWS
if (yystate >= Sizeof_yydef) /* simple state */ if (yystate >= Sizeof_yydef) /* simple state */
#else /* YACC_WINDOWS */ #else /* YACC_WINDOWS */
if (yystate >= (int)sizeof yydef /(int)sizeof yydef[0]) if (yystate >= (int)sizeof yydef /(int)sizeof yydef[0])
@ -689,22 +689,22 @@ yyEncore:
switch (yyi) { /* perform semantic action */ switch (yyi) { /* perform semantic action */
case YYr6: { /* statement : variable_assignment TWP_SEMICOLON */ case YYr6: { /* statement : variable_assignment TWP_SEMICOLON */
#line 194 "policy.y" // #line 194 "policy.y"
cParserHelper::IncrementScopeStatementCount(); cParserHelper::IncrementScopeStatementCount();
} break; } break;
case YYr7: { /* statement : global_variable_assignment TWP_SEMICOLON */ case YYr7: { /* statement : global_variable_assignment TWP_SEMICOLON */
#line 195 "policy.y" // #line 195 "policy.y"
cParserHelper::IncrementScopeStatementCount(); cParserHelper::IncrementScopeStatementCount();
} break; } break;
case YYr8: { /* statement : rule TWP_SEMICOLON */ case YYr8: { /* statement : rule TWP_SEMICOLON */
#line 196 "policy.y" // #line 196 "policy.y"
cParserHelper::IncrementScopeStatementCount(); cParserHelper::IncrementScopeStatementCount();
} break; } break;
case YYr12: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN TWP_LBRACE */ case YYr12: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN TWP_LBRACE */
#line 204 "policy.y" // #line 204 "policy.y"
cDebug d("Parse::scope"); cDebug d("Parse::scope");
@ -721,7 +721,7 @@ case YYr12: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_c
} break; } break;
case YYr13: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN TWP_LBRACE $12 opt_statement_list TWP_RBRACE */ case YYr13: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN TWP_LBRACE $12 opt_statement_list TWP_RBRACE */
#line 218 "policy.y" // #line 218 "policy.y"
if( 0 == cParserHelper::GetScopeStatementCount() && iUserNotify::GetInstance()->GetVerboseLevel() == iUserNotify::V_VERBOSE ) if( 0 == cParserHelper::GetScopeStatementCount() && iUserNotify::GetInstance()->GetVerboseLevel() == iUserNotify::V_VERBOSE )
{ {
@ -737,7 +737,7 @@ case YYr13: { /* scoped_block : TWP_LPAREN attribute_list_with_opt_trailing_c
} break; } break;
case YYr14: { /* directive_block : TWP_IFHOST host_name_list */ case YYr14: { /* directive_block : TWP_IFHOST host_name_list */
#line 234 "policy.y" // #line 234 "policy.y"
cDebug d("Parse::#ifhost"); cDebug d("Parse::#ifhost");
@ -763,7 +763,7 @@ case YYr14: { /* directive_block : TWP_IFHOST host_name_list */
} break; } break;
case YYr15: { /* directive_block : TWP_IFHOST host_name_list $14 opt_statement_list opt_else_host TWP_ENDIF */ case YYr15: { /* directive_block : TWP_IFHOST host_name_list $14 opt_statement_list opt_else_host TWP_ENDIF */
#line 257 "policy.y" // #line 257 "policy.y"
cDebug d("Parse::#endif"); cDebug d("Parse::#endif");
cPreprocessor::PopState(); cPreprocessor::PopState();
@ -773,7 +773,7 @@ case YYr15: { /* directive_block : TWP_IFHOST host_name_list $14 opt_statemen
} break; } break;
case YYr16: { /* directive_block : TWP_SECTION string */ case YYr16: { /* directive_block : TWP_SECTION string */
#line 264 "policy.y" // #line 264 "policy.y"
cDebug d("Parse::#section"); cDebug d("Parse::#section");
@ -787,7 +787,7 @@ case YYr16: { /* directive_block : TWP_SECTION string */
} break; } break;
case YYr17: { /* directive_block : TWP_ERROR string */ case YYr17: { /* directive_block : TWP_ERROR string */
#line 275 "policy.y" // #line 275 "policy.y"
if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT && !cParserHelper::ParseOnly() ) if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT && !cParserHelper::ParseOnly() )
{ {
@ -801,7 +801,7 @@ case YYr17: { /* directive_block : TWP_ERROR string */
} break; } break;
case YYr18: { /* directive_block : TWP_ECHO string */ case YYr18: { /* directive_block : TWP_ECHO string */
#line 286 "policy.y" // #line 286 "policy.y"
if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT && !cParserHelper::ParseOnly() ) if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT && !cParserHelper::ParseOnly() )
{ {
@ -814,7 +814,7 @@ case YYr18: { /* directive_block : TWP_ECHO string */
} break; } break;
case YYr19: { /* host_name_list : host_name_list TWP_OROR host_name */ case YYr19: { /* host_name_list : host_name_list TWP_OROR host_name */
#line 299 "policy.y" // #line 299 "policy.y"
yyval.mpStringList = yypvt[-2].mpStringList; yyval.mpStringList = yypvt[-2].mpStringList;
yyval.mpStringList->push_back( *yypvt[0].mpString ); yyval.mpStringList->push_back( *yypvt[0].mpString );
@ -822,7 +822,7 @@ case YYr19: { /* host_name_list : host_name_list TWP_OROR host_name */
} break; } break;
case YYr20: { /* host_name_list : host_name */ case YYr20: { /* host_name_list : host_name */
#line 304 "policy.y" // #line 304 "policy.y"
yyval.mpStringList = new cParseStringList; yyval.mpStringList = new cParseStringList;
yyval.mpStringList->push_back( *yypvt[0].mpString ); yyval.mpStringList->push_back( *yypvt[0].mpString );
@ -830,7 +830,7 @@ case YYr20: { /* host_name_list : host_name */
} break; } break;
case YYr21: { /* opt_else_host : TWP_ELSE */ case YYr21: { /* opt_else_host : TWP_ELSE */
#line 312 "policy.y" // #line 312 "policy.y"
cDebug d("Parse::#else"); cDebug d("Parse::#else");
@ -848,7 +848,7 @@ case YYr21: { /* opt_else_host : TWP_ELSE */
} break; } break;
case YYr24: { /* variable_assignment : variable_name TWP_EQUALS multi_string */ case YYr24: { /* variable_assignment : variable_name TWP_EQUALS multi_string */
#line 332 "policy.y" // #line 332 "policy.y"
cDebug d("Parse::variable_assignment"); cDebug d("Parse::variable_assignment");
@ -869,7 +869,7 @@ case YYr24: { /* variable_assignment : variable_name TWP_EQUALS multi_string
} break; } break;
case YYr25: { /* global_variable_assignment : global_string TWP_EQUALS global_multi_string */ case YYr25: { /* global_variable_assignment : global_string TWP_EQUALS global_multi_string */
#line 353 "policy.y" // #line 353 "policy.y"
cDebug d("Parse::global variable_assignment"); cDebug d("Parse::global variable_assignment");
@ -890,7 +890,7 @@ case YYr25: { /* global_variable_assignment : global_string TWP_EQUALS global
} break; } break;
case YYr26: { /* rule : fco_name TWP_RARROW spec_masks */ case YYr26: { /* rule : fco_name TWP_RARROW spec_masks */
#line 374 "policy.y" // #line 374 "policy.y"
cDebug d("Parse::rule(fco_name TWP_RARROW spec_masks)"); cDebug d("Parse::rule(fco_name TWP_RARROW spec_masks)");
if( cPreprocessor::GetState() == cPreprocessor::STATE_IGNORE ) if( cPreprocessor::GetState() == cPreprocessor::STATE_IGNORE )
@ -927,6 +927,7 @@ case YYr26: { /* rule : fco_name TWP_RARROW spec_masks */
// add to our lists // add to our lists
cParserHelper::GetGenreInfo()->AddStopPoint( fcoName ); cParserHelper::GetGenreInfo()->AddStopPoint( fcoName );
cParserHelper::GetGenreInfo()->AddRule( pnode ); cParserHelper::GetGenreInfo()->AddRule( pnode );
delete pGU;
} }
delete yypvt[-2].mpStringList; delete yypvt[-2].mpStringList;
@ -935,7 +936,7 @@ case YYr26: { /* rule : fco_name TWP_RARROW spec_masks */
} break; } break;
case YYr27: { /* rule : TWP_BANG fco_name */ case YYr27: { /* rule : TWP_BANG fco_name */
#line 416 "policy.y" // #line 416 "policy.y"
cDebug d("Parse::rule(!fconame)"); cDebug d("Parse::rule(!fconame)");
@ -959,6 +960,7 @@ case YYr27: { /* rule : TWP_BANG fco_name */
// add to stop list // add to stop list
cParserHelper::GetGenreInfo()->AddStopPoint( fcoName ); cParserHelper::GetGenreInfo()->AddStopPoint( fcoName );
delete pGU;
} }
delete yypvt[0].mpStringList; delete yypvt[0].mpStringList;
@ -966,7 +968,7 @@ case YYr27: { /* rule : TWP_BANG fco_name */
} break; } break;
case YYr28: { /* spec_masks : prop_vector opt_spec_attributes */ case YYr28: { /* spec_masks : prop_vector opt_spec_attributes */
#line 447 "policy.y" // #line 447 "policy.y"
if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT ) if( cPreprocessor::GetState() == cPreprocessor::STATE_ACCEPT )
{ {
@ -978,6 +980,7 @@ case YYr28: { /* spec_masks : prop_vector opt_spec_attributes */
yypvt[0].mpAttrList->MergeNoOverwrite( cParserHelper::GetGlobalAttrList() ); yypvt[0].mpAttrList->MergeNoOverwrite( cParserHelper::GetGlobalAttrList() );
yyval.mpNode = pNode; yyval.mpNode = pNode;
delete pGU;
} }
delete yypvt[-1].mpString; delete yypvt[-1].mpString;
@ -987,28 +990,28 @@ case YYr28: { /* spec_masks : prop_vector opt_spec_attributes */
} break; } break;
case YYr29: { /* opt_spec_attributes : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN */ case YYr29: { /* opt_spec_attributes : TWP_LPAREN attribute_list_with_opt_trailing_comma TWP_RPAREN */
#line 485 "policy.y" // #line 485 "policy.y"
yyval.mpAttrList = yypvt[-1].mpAttrList; yyval.mpAttrList = yypvt[-1].mpAttrList;
} break; } break;
case YYr30: { /* opt_spec_attributes : */ case YYr30: { /* opt_spec_attributes : */
#line 489 "policy.y" // #line 489 "policy.y"
yyval.mpAttrList = new cParseNamedAttrList; yyval.mpAttrList = new cParseNamedAttrList;
} break; } break;
case YYr31: { /* attribute_list_with_opt_trailing_comma : attribute_list opt_comma */ case YYr31: { /* attribute_list_with_opt_trailing_comma : attribute_list opt_comma */
#line 515 "policy.y" // #line 515 "policy.y"
yyval.mpAttrList = yypvt[-1].mpAttrList; yyval.mpAttrList = yypvt[-1].mpAttrList;
} break; } break;
case YYr32: { /* attribute_list : attribute_list TWP_COMMA attribute */ case YYr32: { /* attribute_list : attribute_list TWP_COMMA attribute */
#line 522 "policy.y" // #line 522 "policy.y"
cDebug d("Parse::attribute_list"); cDebug d("Parse::attribute_list");
ASSERT( yypvt[-2].mpAttrList && yypvt[0].mpAttr ); ASSERT( yypvt[-2].mpAttrList && yypvt[0].mpAttr );
@ -1024,7 +1027,7 @@ case YYr32: { /* attribute_list : attribute_list TWP_COMMA attribute */
} break; } break;
case YYr33: { /* attribute_list : attribute */ case YYr33: { /* attribute_list : attribute */
#line 535 "policy.y" // #line 535 "policy.y"
cDebug d("Parse::attribute_list"); cDebug d("Parse::attribute_list");
@ -1038,7 +1041,7 @@ case YYr33: { /* attribute_list : attribute */
} break; } break;
case YYr34: { /* attribute : attribute_name TWP_EQUALS attribute_value */ case YYr34: { /* attribute : attribute_name TWP_EQUALS attribute_value */
#line 548 "policy.y" // #line 548 "policy.y"
cDebug d("Parse::attribute"); cDebug d("Parse::attribute");
@ -1055,7 +1058,7 @@ case YYr34: { /* attribute : attribute_name TWP_EQUALS attribute_value */
} break; } break;
case YYr37: { /* variable : TWP_DOLLAR TWP_LPAREN variable_name TWP_RPAREN */ case YYr37: { /* variable : TWP_DOLLAR TWP_LPAREN variable_name TWP_RPAREN */
#line 618 "policy.y" // #line 618 "policy.y"
cDebug d( " parser::variable" ); cDebug d( " parser::variable" );
@ -1082,7 +1085,7 @@ case YYr37: { /* variable : TWP_DOLLAR TWP_LPAREN variable_name TWP_RPAREN */
} break; } break;
case YYr38: { /* prop_vector : multi_string */ case YYr38: { /* prop_vector : multi_string */
#line 662 "policy.y" // #line 662 "policy.y"
yyval.mpString = new cParseString; yyval.mpString = new cParseString;
*yyval.mpString = ConcatenateStrings( yypvt[0].mpStringList ); *yyval.mpString = ConcatenateStrings( yypvt[0].mpStringList );
@ -1091,7 +1094,7 @@ case YYr38: { /* prop_vector : multi_string */
} break; } break;
case YYr39: { /* attribute_name : string */ case YYr39: { /* attribute_name : string */
#line 671 "policy.y" // #line 671 "policy.y"
cDebug d(" parser::string(attribute_name)"); cDebug d(" parser::string(attribute_name)");
yyval.mpString = yypvt[0].mpString; yyval.mpString = yypvt[0].mpString;
@ -1099,7 +1102,7 @@ case YYr39: { /* attribute_name : string */
} break; } break;
case YYr40: { /* attribute_value : multi_string */ case YYr40: { /* attribute_value : multi_string */
#line 679 "policy.y" // #line 679 "policy.y"
yyval.mpString = new cParseString; yyval.mpString = new cParseString;
cDebug d(" parser::multi_string(attribute_value)"); cDebug d(" parser::multi_string(attribute_value)");
@ -1109,7 +1112,7 @@ case YYr40: { /* attribute_value : multi_string */
} break; } break;
case YYr41: { /* fco_name : multi_string */ case YYr41: { /* fco_name : multi_string */
#line 689 "policy.y" // #line 689 "policy.y"
cDebug d(" parser::multi_string(fco_name)"); cDebug d(" parser::multi_string(fco_name)");
yyval.mpStringList = yypvt[0].mpStringList; yyval.mpStringList = yypvt[0].mpStringList;
@ -1117,7 +1120,7 @@ case YYr41: { /* fco_name : multi_string */
} break; } break;
case YYr42: { /* fco_name : multi_string TWP_PIPE multi_string */ case YYr42: { /* fco_name : multi_string TWP_PIPE multi_string */
#line 695 "policy.y" // #line 695 "policy.y"
yypvt[-2].mpStringList->push_back( _T("|") ); yypvt[-2].mpStringList->push_back( _T("|") );
@ -1129,7 +1132,7 @@ case YYr42: { /* fco_name : multi_string TWP_PIPE multi_string */
} break; } break;
case YYr43: { /* host_name : string */ case YYr43: { /* host_name : string */
#line 710 "policy.y" // #line 710 "policy.y"
cDebug d(" parser::multi_string(host_name)"); cDebug d(" parser::multi_string(host_name)");
@ -1138,7 +1141,7 @@ case YYr43: { /* host_name : string */
} break; } break;
case YYr44: { /* variable_name : TWP_STRING */ case YYr44: { /* variable_name : TWP_STRING */
#line 719 "policy.y" // #line 719 "policy.y"
cDebug d(" parser::string(variable_name)"); cDebug d(" parser::string(variable_name)");
yyval.mpString = yypvt[0].mpString; yyval.mpString = yypvt[0].mpString;
@ -1146,7 +1149,7 @@ case YYr44: { /* variable_name : TWP_STRING */
} break; } break;
case YYr45: { /* multi_string : multi_string string */ case YYr45: { /* multi_string : multi_string string */
#line 728 "policy.y" // #line 728 "policy.y"
yyval.mpStringList->push_back( *yypvt[0].mpString ); yyval.mpStringList->push_back( *yypvt[0].mpString );
delete yypvt[0].mpString; delete yypvt[0].mpString;
@ -1154,7 +1157,7 @@ case YYr45: { /* multi_string : multi_string string */
} break; } break;
case YYr46: { /* multi_string : string */ case YYr46: { /* multi_string : string */
#line 733 "policy.y" // #line 733 "policy.y"
yyval.mpStringList = new cParseStringList; yyval.mpStringList = new cParseStringList;
yyval.mpStringList->push_back( *yypvt[0].mpString ); yyval.mpStringList->push_back( *yypvt[0].mpString );
@ -1163,7 +1166,7 @@ case YYr46: { /* multi_string : string */
} break; } break;
case YYr47: { /* global_multi_string : global_multi_string global_string */ case YYr47: { /* global_multi_string : global_multi_string global_string */
#line 742 "policy.y" // #line 742 "policy.y"
yyval.mpStringList->push_back( *yypvt[0].mpString ); yyval.mpStringList->push_back( *yypvt[0].mpString );
delete yypvt[0].mpString; delete yypvt[0].mpString;
@ -1171,7 +1174,7 @@ case YYr47: { /* global_multi_string : global_multi_string global_string */
} break; } break;
case YYr48: { /* global_multi_string : global_string */ case YYr48: { /* global_multi_string : global_string */
#line 747 "policy.y" // #line 747 "policy.y"
yyval.mpStringList = new cParseStringList; yyval.mpStringList = new cParseStringList;
yyval.mpStringList->push_back( *yypvt[0].mpString ); yyval.mpStringList->push_back( *yypvt[0].mpString );
@ -1180,7 +1183,7 @@ case YYr48: { /* global_multi_string : global_string */
} break; } break;
case YYr49: { /* string : TWP_STRING */ case YYr49: { /* string : TWP_STRING */
#line 757 "policy.y" // #line 757 "policy.y"
cDebug d(" parser::string(normal)"); cDebug d(" parser::string(normal)");
d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString); d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString);
@ -1189,7 +1192,7 @@ case YYr49: { /* string : TWP_STRING */
} break; } break;
case YYr50: { /* string : variable */ case YYr50: { /* string : variable */
#line 763 "policy.y" // #line 763 "policy.y"
cDebug d(" parser::string(normal)"); cDebug d(" parser::string(normal)");
d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString); d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString);
@ -1198,14 +1201,14 @@ case YYr50: { /* string : variable */
} break; } break;
case YYr51: { /* global_string : TWP_GLOBAL_STRING */ case YYr51: { /* global_string : TWP_GLOBAL_STRING */
#line 772 "policy.y" // #line 772 "policy.y"
cDebug d(" parser::string(normal)"); cDebug d(" parser::string(normal)");
d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString); d.TraceNever("--(STRING)--> got string (%s)\n", yypvt[0].mpString);
yyval.mpString = yypvt[0].mpString; yyval.mpString = yypvt[0].mpString;
} break; } break;
#line 343 "..\\..\\mkslexyacc\\etc\\yyparse.cpp" // #line 343 "..\\..\\mkslexyacc\\etc\\yyparse.cpp"
case YYrACCEPT: case YYrACCEPT:
YYACCEPT; YYACCEPT;
case YYrERROR: case YYrERROR:
@ -1265,7 +1268,7 @@ yyError:
, yytp-- , yytp--
#endif #endif
) { ) {
#ifdef YACC_WINDOWS #if 0 //YACC_WINDOWS
if (*yyps >= Sizeof_yypact) /* simple state */ if (*yyps >= Sizeof_yypact) /* simple state */
#else /* YACC_WINDOWS */ #else /* YACC_WINDOWS */
if (*yyps >= (int)sizeof yypact/(int)sizeof yypact[0]) if (*yyps >= (int)sizeof yypact/(int)sizeof yypact[0])

View File

@ -133,7 +133,7 @@ typedef struct yyTypedRules_tag { /* Typed rule table */
} yyTypedRules; } yyTypedRules;
#endif #endif
#ifdef YACC_WINDOWS #if 0 // YACC_WINDOWS
// include all windows prototypes, macros, constants, etc. // include all windows prototypes, macros, constants, etc.
@ -155,7 +155,7 @@ extern HANDLE hInst;
class yy_parse { class yy_parse {
protected: protected:
#ifdef YACC_WINDOWS #if 0 // YACC_WINDOWS
// protected member function for actual scanning // protected member function for actual scanning

View File

@ -17,7 +17,7 @@ twprint_HEADERS = \
twprinterrors.h twprintstrings.h twprinterrors.h twprintstrings.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = ../../bin/twprint CLEANFILES = ../../bin/twprint *.gcno *.gcda
all: $(sbin_PROGRAMS) all: $(sbin_PROGRAMS)
@test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin

View File

@ -319,7 +319,7 @@ twprint_HEADERS = \
resource.h stdtwprint.h twprint.h twprintcmdline.h \ resource.h stdtwprint.h twprint.h twprintcmdline.h \
twprinterrors.h twprintstrings.h twprinterrors.h twprintstrings.h
CLEANFILES = ../../bin/twprint CLEANFILES = ../../bin/twprint *.gcno *.gcda
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View File

@ -19,7 +19,7 @@ cmdlineparser_t.cpp \
codeconvert_t.cpp \ codeconvert_t.cpp \
configfile_t.cpp \ configfile_t.cpp \
cryptoarchive_t.cpp \ cryptoarchive_t.cpp \
crytpo_t.cpp \ crypto_t.cpp \
dbdatasource_t.cpp \ dbdatasource_t.cpp \
debug_t.cpp \ debug_t.cpp \
displayencoder_t.cpp \ displayencoder_t.cpp \
@ -81,7 +81,13 @@ wchar16_t.cpp
twtest_HEADERS = stdtest.h stringutil_t.h test.h twtest_HEADERS = stdtest.h stringutil_t.h test.h
DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit DEFS = @DEFS@ # This gets rid of the -I. so AM_CPPFLAGS must be more explicit
CLEANFILES = ../../bin/twtest
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-rm -rf ../../bin/TWTestData
-rm -f ../../bin/twtest
-rm -f *.gcno *.gcda
all: $(sbin_PROGRAMS) all: $(sbin_PROGRAMS)
@test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin

View File

@ -109,7 +109,7 @@ am_twtest_OBJECTS = archive_t.$(OBJEXT) blockfile_t.$(OBJEXT) \
blockrecordarray_t.$(OBJEXT) charutil_t.$(OBJEXT) \ blockrecordarray_t.$(OBJEXT) charutil_t.$(OBJEXT) \
cmdlineparser_t.$(OBJEXT) codeconvert_t.$(OBJEXT) \ cmdlineparser_t.$(OBJEXT) codeconvert_t.$(OBJEXT) \
configfile_t.$(OBJEXT) cryptoarchive_t.$(OBJEXT) \ configfile_t.$(OBJEXT) cryptoarchive_t.$(OBJEXT) \
crytpo_t.$(OBJEXT) dbdatasource_t.$(OBJEXT) debug_t.$(OBJEXT) \ crypto_t.$(OBJEXT) dbdatasource_t.$(OBJEXT) debug_t.$(OBJEXT) \
displayencoder_t.$(OBJEXT) error_t.$(OBJEXT) \ displayencoder_t.$(OBJEXT) error_t.$(OBJEXT) \
errorbucketimpl_t.$(OBJEXT) fcocompare_t.$(OBJEXT) \ errorbucketimpl_t.$(OBJEXT) fcocompare_t.$(OBJEXT) \
fcodatabasefile_t.$(OBJEXT) fconame_t.$(OBJEXT) \ fcodatabasefile_t.$(OBJEXT) fconame_t.$(OBJEXT) \
@ -360,7 +360,7 @@ cmdlineparser_t.cpp \
codeconvert_t.cpp \ codeconvert_t.cpp \
configfile_t.cpp \ configfile_t.cpp \
cryptoarchive_t.cpp \ cryptoarchive_t.cpp \
crytpo_t.cpp \ crypto_t.cpp \
dbdatasource_t.cpp \ dbdatasource_t.cpp \
debug_t.cpp \ debug_t.cpp \
displayencoder_t.cpp \ displayencoder_t.cpp \
@ -420,7 +420,6 @@ usernotifystdout_t.cpp \
wchar16_t.cpp wchar16_t.cpp
twtest_HEADERS = stdtest.h stringutil_t.h test.h twtest_HEADERS = stdtest.h stringutil_t.h test.h
CLEANFILES = ../../bin/twtest
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -645,7 +644,6 @@ install-strip:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@ -656,7 +654,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean: clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am clean-am: clean-generic clean-local clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -f Makefile -rm -f Makefile
@ -724,15 +722,15 @@ uninstall-am: uninstall-sbinPROGRAMS uninstall-twtestHEADERS
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \ clean-local clean-sbinPROGRAMS cscopelist-am ctags ctags-am \
distclean-compile distclean-generic distclean-tags distdir dvi \ distclean distclean-compile distclean-generic distclean-tags \
dvi-am html html-am info info-am install install-am \ distdir dvi dvi-am html html-am info info-am install \
install-data install-data-am install-dvi install-dvi-am \ install-am install-data install-data-am install-dvi \
install-exec install-exec-am install-html install-html-am \ install-dvi-am install-exec install-exec-am install-html \
install-info install-info-am install-man install-pdf \ install-html-am install-info install-info-am install-man \
install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ install-pdf install-pdf-am install-ps install-ps-am \
install-strip install-twtestHEADERS installcheck \ install-sbinPROGRAMS install-strip install-twtestHEADERS \
installcheck-am installdirs maintainer-clean \ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \ maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-sbinPROGRAMS uninstall-twtestHEADERS uninstall-am uninstall-sbinPROGRAMS uninstall-twtestHEADERS
@ -740,6 +738,13 @@ uninstall-am: uninstall-sbinPROGRAMS uninstall-twtestHEADERS
.PRECIOUS: Makefile .PRECIOUS: Makefile
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-rm -rf ../../bin/TWTestData
-rm -f ../../bin/twtest
-rm -f *.gcno *.gcda
all: $(sbin_PROGRAMS) all: $(sbin_PROGRAMS)
@test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin @test -d ../../bin && $(LN) -f $(sbin_PROGRAMS) ../../bin

View File

@ -42,7 +42,7 @@
TSS_EXCEPTION(eTestArchiveError, eError); TSS_EXCEPTION(eTestArchiveError, eError);
void TestArchive() void TestMemoryArchive()
{ {
// cMemoryArchive // cMemoryArchive
cMemoryArchive memarch; cMemoryArchive memarch;
@ -52,7 +52,7 @@ void TestArchive()
memarch.WriteInt32(3); memarch.WriteInt32(3);
memarch.WriteInt32(4); memarch.WriteInt32(4);
TSTRING s = _T("Weenus"); TSTRING s = _T("Iridogorgia");
memarch.WriteString(s); memarch.WriteString(s);
memarch.WriteInt64(1234567L); memarch.WriteInt64(1234567L);
@ -74,7 +74,7 @@ void TestArchive()
TSTRING s2; TSTRING s2;
memarch.ReadString(s2); memarch.ReadString(s2);
TEST(s2.compare(_T("Weenus")) == 0); TEST(s2.compare(_T("Iridogorgia")) == 0);
memarch.ReadInt64(l); memarch.ReadInt64(l);
TEST(l == 1234567L); TEST(l == 1234567L);
@ -101,37 +101,61 @@ void TestArchive()
TEST(memarch.GetMappedOffset() == 4 * sizeof(int32) + sizeof(int32) + 6); TEST(memarch.GetMappedOffset() == 4 * sizeof(int32) + sizeof(int32) + 6);
TEST(memarch.GetMappedLength() == sizeof(int64)); TEST(memarch.GetMappedLength() == sizeof(int64));
// TEST(tw_ntohll(*(int64*)memarch.GetMap()) == 1234567L); // TEST(tw_ntohll(*(int64*)memarch.GetMap()) == 1234567L);
}
void TestLockedTemporaryArchive()
{
TSTRING s = _T("Metallogorgia");
bool threw = false;
// cLockedTemporaryFileArchive // cLockedTemporaryFileArchive
TSTRING lockedFileName = TwTestPath("inaccessable_file.bin"); TSTRING lockedFileName = TwTestPath("inaccessable_file.bin");
// lockedFileName += _T("/inaccessable_file.bin");
cLockedTemporaryFileArchive lockedArch; cLockedTemporaryFileArchive lockedArch;
// try to create an archive using a temp file try
lockedArch.OpenReadWrite(); {
lockedArch.Close(); // try to create an archive using a temp file
lockedArch.OpenReadWrite();
lockedArch.Close();
}
catch (...)
{
threw = true;
}
// this should open and lock the file -- shouldn't be able to access it try
lockedArch.OpenReadWrite(lockedFileName.c_str()); {
lockedArch.Seek(0, cBidirArchive::BEGINNING); // this should open and lock the file -- shouldn't be able to access it
lockedArch.OpenReadWrite(lockedFileName.c_str());
lockedArch.Seek(0, cBidirArchive::BEGINNING);
// shouldn't be able to see these changes // shouldn't be able to see these changes
lockedArch.WriteInt32(1); lockedArch.WriteInt32(1);
lockedArch.WriteInt32(2); lockedArch.WriteInt32(2);
lockedArch.WriteInt32(3); lockedArch.WriteInt32(3);
lockedArch.WriteInt32(4); lockedArch.WriteInt32(4);
lockedArch.WriteString(s); lockedArch.WriteString(s);
lockedArch.WriteInt64(1234567L); lockedArch.WriteInt64(1234567L);
lockedArch.WriteInt16(42); lockedArch.WriteInt16(42);
// this should delete the file // this should delete the file
lockedArch.Close(); lockedArch.Close();
}
catch (...)
{
threw = true;
}
// cFileArchive TEST(!threw);
}
void TestFileArchive()
{
bool threw = false;
TSTRING s = _T("Acanthogorgia");
// cFileArchive
TSTRING fileName = TwTestPath("archive_test.bin"); TSTRING fileName = TwTestPath("archive_test.bin");
//fileName += _T("/archive_test.bin");
cFileArchive filearch; cFileArchive filearch;
filearch.OpenReadWrite(fileName.c_str()); filearch.OpenReadWrite(fileName.c_str());
@ -163,7 +187,7 @@ void TestArchive()
TSTRING s3; TSTRING s3;
filearch.ReadString(s3); filearch.ReadString(s3);
TEST(s3.compare(_T("Weenus")) == 0); TEST(s3.compare(_T("Acanthogorgia")) == 0);
filearch.ReadInt64(k); filearch.ReadInt64(k);
TEST(k == 1234567L); TEST(k == 1234567L);
@ -181,8 +205,16 @@ void TestArchive()
} }
catch (eError& e) catch (eError& e)
{ {
TEST(false); threw=true;
(void)e; (void)e;
} }
TEST(!threw);
} }
void RegisterSuite_Archive()
{
RegisterTest("Archive", "MemoryArchive", TestMemoryArchive);
RegisterTest("Archive", "LockedTemporaryArchive)", TestLockedTemporaryArchive);
RegisterTest("Archive", "FileArchive", TestFileArchive);
}

View File

@ -109,3 +109,9 @@ void TestBlockFile()
bf.Close(); bf.Close();
} }
void RegisterSuite_BlockFile()
{
RegisterTest("BlockFile", "Basic", TestBlockFile);
}

View File

@ -125,3 +125,7 @@ void TestBlockRecordArray()
#endif #endif
} }
void RegisterSuite_BlockRecordArray()
{
RegisterTest("BlockRecordArray", "Basic", TestBlockRecordArray);
}

View File

@ -75,11 +75,7 @@ void TestCharUtilBasic()
PrintChars( _T("fo\x23 54") ); PrintChars( _T("fo\x23 54") );
} }
void RegisterSuite_CharUtil()
/* {
TSS_BeginTestSuiteFrom( cCharEncoderTest ) RegisterTest("CharUtil", "Basic", TestCharUtilBasic);
}
TSS_AddTestCase( Basic );
TSS_EndTestSuite( cCharEncoderTest )
*/

View File

@ -161,3 +161,10 @@ void TestCmdLineParser()
// TODO -- test a bunch more!!! // TODO -- test a bunch more!!!
} }
void RegisterSuite_CmdLineParser()
{
RegisterTest("CmdLineParser", "Basic", TestCmdLineParser);
}

View File

@ -185,7 +185,8 @@ char NonZeroChar( char ch )
//TestMbToDb in codeconvert_t.cpp seems to hit an infinite loop or runs verrrry long; ifdef'd" //TestMbToDb in codeconvert_t.cpp seems to hit an infinite loop or runs verrrry long; ifdef'd"
void TestMbToDb() void TestMbToDb()
{ {
TCERR << "\nTODO: TestMbToDb in codeconvert_t.cpp is flaky & needs to be fixed/replaced; currently disabled." << std::endl; skip("This test is flaky & needs to be fixed/replaced; currently disabled.");
#if 0 #if 0
std::string s; std::string s;
s.resize( 0x10000 * 2 ); // two bytes for each combination s.resize( 0x10000 * 2 ); // two bytes for each combination
@ -240,7 +241,8 @@ void TestMbToDb()
// dbchar_t to mbchar_t // dbchar_t to mbchar_t
void TestDbToMb() void TestDbToMb()
{ {
TCERR << "\nTODO: TestDbToMb in codeconvert_t.cpp fails, most likely due to not speaking UTF-16. Should fix this." << std::endl; skip("This test fails, most likely due to not speaking UTF-16. Should fix this.");
#if 0 #if 0
wc16_string ws; wc16_string ws;
wc16_string::size_type n; wc16_string::size_type n;
@ -344,4 +346,8 @@ bool LowASCIILooksLikeUCS2InWchart()
} }
#endif #endif
void RegisterSuite_CodeConvert()
{
RegisterTest("CodeConvert", "MbToDb", TestMbToDb);
RegisterTest("CodeConvert", "DbToMb", TestDbToMb);
}

View File

@ -47,83 +47,101 @@
using namespace std; using namespace std;
static void assertParse(const std::string& configLineIn, bool expectValid)
{
static const std::string sMandatory = \
"\nPOLFILE=foo" \
"\nDBFILE=foo" \
"\nREPORTFILE=foo" \
"\nSITEKEYFILE=foo" \
"\nLOCALKEYFILE=foo";
bool threw = false;
cConfigFile cfg;
std::string configLine = configLineIn + sMandatory;
try
{
cfg.ReadString( configLine );
}
catch( eConfigFileMissReqKey& e)
{
TCERR << "Got a missing key exception, which should not happen" << std::endl;
TEST(false);
}
catch( eConfigFile& e )
{
e.SetFatality(false);
cTWUtil::PrintErrorMsg( e );
threw = true;
}
#ifdef _DEBUG
TCERR << "LINE [" << configLineIn << "]" << std::endl << "Expected = " << expectValid << std::endl << "Threw = " << threw << std::endl;
#endif
TEST(expectValid != threw);
}
void TestConfigFile(void) void TestConfigFile(void)
{ {
TSTRING asConfigFileText[] = // should succeed
{ assertParse( _T("BRIAN=foo"), true ); // 0 fine
_T("BRIAN=foo"), // 0 fine assertParse( _T("BRIAN=foo\nBILL=bar"), true ); // 1 fine
_T("BRIAN=foo\nBILL=bar"), // 1 fine assertParse( _T("BRIAN=foo\r\nBILL=bar"), true ); // 2 fine
_T("BRIAN=foo\r\nBILL=bar"), // 2 fine assertParse( _T("BRIAN=foo\n\n\rBILL=bar\n"), true ); // 3 fine
_T("BRIAN=foo\n\n\rBILL=bar\n"),// 3 fine assertParse( _T(" WS=foo \n\n\r BILL=bar\n"), true ); // 4 fine
_T(" WS=foo \n\n\r BILL=bar\n"), // 4 fine assertParse( _T(" WS = foo \n\n\r BILL = bar \n"), true ); // 5 fine
_T(" WS = foo \n\n\r BILL = bar \n"), // 5 fine assertParse( _T("FOO=foo\nBAR=$(FOO)"), true ); // 6 fine
_T("FOO=foo\nBAR=$(FOO)"), // 6 fine
_T("FOO=foo\nBAR=$(FO)"), // 7 undefined var
_T("FOO=foo\nBAR=$(FOO"), // 8 no r paren
_T("FOO=foo\nBAR=$(FOO "), // 9 no r paren
_T("BAR=$(FOO\n"), // 10 no r paren
_T(" VAR =foo \nWS = $(VAR)\n"), // 11 fine
_T(""), // 12 fine
_T("\n"), // 13 fine
_T("\r"), // 14 fine
_T("\r\n"), // 15 fine
_T("B=POO\nA"), // 16 no equals
_T(" B=POO \n A \r"), // 17 no equals
_T("B=POO\nB=CRAP"), // 18 redefined var
_T("DATE=CRAP"), // 19 redefine predefine var
_T("B=POO\nDATE=CRAP"), // 20 redefine predefine var
_T("A=1\nB=$(A)\nC=$(B)"), // 21 fine -- checking var sub
_T("A=$(DATE)"), // 22 fine -- checking predef var sub
_T("A=1\nB=$(A)\nC=$(DATE)"), // 23 fine -- checking predef var sub
_T("A=1\n=$(A)\nC=$(DATE)"), // 24 no key
_T("A=$(DATE)-B"), // 25 fine -- check that the '-' shows up
_T("A=$(DATE)-$(DATE)"), // 26 fine -- check that the '-' shows up
};
/* // should fail
TSTRING sMandatory = \ assertParse( _T("FOO=foo\nBAR=$(FO)"), false ); // 7 undefined var
_T("\nPOLFILE=foo") \ assertParse( _T("FOO=foo\nBAR=$(FOO"), false ); // 8 no r paren
_T("\nDBFILE=foo") \ assertParse( _T("FOO=foo\nBAR=$(FOO "), false ); // 9 no r paren
_T("\nREPORTFILE=foo") \ assertParse( _T("BAR=$(FOO\n"), false ); // 10 no r paren
_T("\nSITEKEYFILE=foo") \
_T("\nLOCALKEYFILE=foo");
*/
// should succeed
assertParse( _T(" VAR =foo \nWS = $(VAR)\n"), true ); // 11 fine
assertParse( _T(""), true ); // 12 fine
assertParse( _T("\n"), true ); // 13 fine
assertParse( _T("\r"), true ); // 14 fine
assertParse( _T("\r\n"), true ); // 15 fine
for( TSTRING* at = &asConfigFileText[0]; // should fail
at != &asConfigFileText[countof(asConfigFileText)]; assertParse( _T("B=POO\nA"), false ); // 16 no equals
at++ ) assertParse( _T(" B=POO \n A \r"), false ); // 17 no equals
{
cConfigFile cfg; /* This next test asserts that you can't change a variable once you've defined it.
//*at += sMandatory; However there's no actual code in cConfigFile to check for this, and
OST appears to work fine if you redefine a config variable, so I'm not going
to change the current behavior. Leaving this test in w/ a note for reference.
assertParse( _T("B=POO\nB=CRAP"), false ); // 18 redefined var
*/
assertParse( _T("DATE=CRAP"), false ); // 19 redefine predefine var
assertParse( _T("B=POO\nDATE=CRAP"), false ); // 20 redefine predefine var
// should succeed
assertParse( _T("A=1\nB=$(A)\nC=$(B)"), true ); // 21 fine -- checking var sub
assertParse( _T("A=$(DATE)"), true ); // 22 fine -- checking predef var sub
assertParse( _T("A=1\nB=$(A)\nC=$(DATE)"), true ); // 23 fine -- checking predef var sub
// should fail
assertParse( _T("A=1\n=$(A)\nC=$(DATE)"), false ); // 24 no key
// should succeed
assertParse( _T("A=$(DATE)-B"), true ); // 25 fine -- check that the '-' shows up
assertParse( _T("A=$(DATE)-$(DATE)"), true ); // 26 fine -- check that the '-' shows up
TCERR << _T("*** line:") << std::endl;
TCERR << *at << std::endl;
TCERR << _T("*** eol:") << std::endl;
try
{
cfg.ReadString( *at );
}
catch( eConfigFileMissReqKey& )
{
// ignore....
}
catch( eConfigFile& e )
{
int offset = ( at - asConfigFileText );
int itemSize = sizeof( asConfigFileText[0] );
int num = offset / itemSize;
TCERR << num << std::endl;
cTWUtil::PrintErrorMsg( e );
}
}
} }
void TestConfigFile2(void) void TestConfigFile2(void)
{ {
cDebug d("Testconfigfile"); cDebug d("Testconfigfile");
d.TraceDetail("Entering...\n"); d.TraceDetail("Entering...\n");
iFSServices* pFSServices = iFSServices::GetInstance(); //iFSServices* pFSServices = iFSServices::GetInstance();
//Define some test values for <name, value> pairs to be //Define some test values for <name, value> pairs to be
//stored in a test config. module. I'm going to use the //stored in a test config. module. I'm going to use the
@ -175,5 +193,10 @@ void TestConfigFile2(void)
TEST( lookup2 == "test.twd" ); TEST( lookup2 == "test.twd" );
d.TraceDetail("Tests Passed!\n"); d.TraceDetail("Tests Passed!\n");
//#endif // NOT_BRIANS_TEST }
void RegisterSuite_ConfigFile()
{
RegisterTest("ConfigFile", "Basic 1", TestConfigFile);
RegisterTest("ConfigFile", "Basic 2", TestConfigFile2);
} }

View File

@ -44,9 +44,13 @@ void TestCrypto()
const int BUFSIZE = 9000; const int BUFSIZE = 9000;
char source[BUFSIZE]; std::vector<char> source_buf(BUFSIZE);
char crypt[COUNT + BUFSIZE]; // needs to be able to hold even number of blocks std::vector<char> crypt_buf(COUNT + BUFSIZE); // needs to be able to hold even number of blocks
char dest[COUNT]; std::vector<char> dest_buf(COUNT);
char* source = &source_buf[0];
char* crypt = &crypt_buf[0];
char* dest = &dest_buf[0];
memcpy(source, "I love the smell of the sheep.", 31); memcpy(source, "I love the smell of the sheep.", 31);
@ -407,6 +411,13 @@ void TestCrypto()
delete pPublic; delete pPublic;
delete pPrivate; delete pPrivate;
delete pPublic2;
delete pPrivate2;
} }
} }
void RegisterSuite_Crypto()
{
RegisterTest("Crypto", "Basic", TestCrypto);
}

View File

@ -299,4 +299,7 @@ void TestCryptoArchive()
#endif #endif
} }
void RegisterSuite_CryptoArchive()
{
RegisterTest("CryptoArchive", "Basic", TestCryptoArchive);
}

View File

@ -212,3 +212,8 @@ void TestDbDataSourceBasic()
db.AssertAllBlocksValid(); db.AssertAllBlocksValid();
#endif #endif
} }
void RegisterSuite_DbDataSource()
{
RegisterTest("DbDataSource", "Basic", TestDbDataSourceBasic);
}

View File

@ -90,4 +90,7 @@ void TestDebug()
d.TraceDebug("Exiting...\n"); d.TraceDebug("Exiting...\n");
} }
void RegisterSuite_Debug()
{
RegisterTest("Debug", "Basic", TestDebug);
}

View File

@ -321,17 +321,16 @@ void TestDisplayEncoderBasic()
// make sure there are '\' and '"' in it ) // make sure there are '\' and '"' in it )
} }
/*TSS_BeginTestSuiteFrom( cDisplayEncoderTest ) void RegisterSuite_DisplayEncoder()
{
TSS_AddTestCase( Basic ); RegisterTest("DisplayEncoder", "Basic", TestDisplayEncoderBasic);
TSS_AddTestCase( TestHexToChar ); RegisterTest("DisplayEncoder", "CharToHex", TestCharToHex);
TSS_AddTestCase( TestCharToHex ); RegisterTest("DisplayEncoder", "HexToChar", TestHexToChar);
TSS_AddTestCase( TestStringToHex ); RegisterTest("DisplayEncoder", "StringToHex", TestStringToHex);
TSS_AddTestCase( TestHexToString ); RegisterTest("DisplayEncoder", "HexToString", TestHexToString);
TSS_AddTestCase( TestUnconvertable ); //RegisterTest("DisplayEncoder", "Unconvertable", TestUnconvertable);
TSS_AddTestCase( TestUnprintable ); //RegisterTest("DisplayEncoder", "Unprintable", TestUnprintable);
TSS_AddTestCase( TestQuoteAndBackSlash ); RegisterTest("DisplayEncoder", "QuoteAndBackSlash", TestQuoteAndBackSlash);
}
TSS_EndTestSuite( cDisplayEncoderTest )*/

View File

@ -81,3 +81,8 @@ void TestError()
TEST(threw); TEST(threw);
} }
void RegisterSuite_Error()
{
RegisterTest("Error", "Basic", TestError);
}

View File

@ -143,3 +143,7 @@ void TestErrorBucketImpl()
} }
void RegisterSuite_ErrorBucketImpl()
{
RegisterTest("ErrorBucketImpl", "Basic", TestErrorBucketImpl);
}

View File

@ -158,3 +158,8 @@ void TestFCOCompare()
return; return;
} }
void RegisterSuite_FCOCompare()
{
RegisterTest("FCOCompare", "Basic", TestFCOCompare);
}

View File

@ -32,9 +32,16 @@
// fcodatabasefile.cpp // fcodatabasefile.cpp
#include "tw/stdtw.h" #include "tw/stdtw.h"
#include "tw/fcodatabasefile.h" #include "tw/fcodatabasefile.h"
#include "test.h"
void TestFCODatabaseFile() void TestFCODatabaseFile()
{ {
cDebug d("TestFCODatabaseFile"); cDebug d("TestFCODatabaseFile");
d.TraceError("Implement this!\n"); d.TraceError("Implement this!\n");
skip("TestFCODatabaseFile not implemented");
}
void RegisterSuite_FCODatabaseFile()
{
RegisterTest("FCODatabaseFile", "Basic", TestFCODatabaseFile);
} }

View File

@ -139,4 +139,7 @@ void TestFCOName()
} }
} }
void RegisterSuite_FCOName()
{
RegisterTest("FCOName", "Basic", TestFCOName);
}

View File

@ -61,3 +61,8 @@ void TestFCONameTbl()
pNode4->Release(); pNode4->Release();
pNode5->Release(); pNode5->Release();
} }
void RegisterSuite_FCONameTbl()
{
RegisterTest("FCONameTbl", "Basic", TestFCONameTbl);
}

View File

@ -115,3 +115,7 @@ void TestUnprintable( const TCHAR* pchName, const TCHAR* pchGenre )
TEST( fcoNameNew == fcoName ); TEST( fcoNameNew == fcoName );
} }
void RegisterSuite_FCONameTranslator()
{
RegisterTest("FCONameTranslator", "Basic", TestFCONameTranslator);
}

View File

@ -35,9 +35,9 @@
#include "core/debug.h" #include "core/debug.h"
#include "twtest/test.h" #include "twtest/test.h"
void TestFCOPropImpl() void TestNumeric()
{ {
cDebug d("TestFCOPropImpl"); cDebug d("TestNumeric");
d.TraceDebug("Entering...\n"); d.TraceDebug("Entering...\n");
// print the enum key: // print the enum key:
@ -69,12 +69,18 @@ void TestFCOPropImpl()
d.TraceDebug("333ui64 == 456ui64 = %d\n", pui64.Compare(&pui64b, iFCOProp::OP_EQ)); d.TraceDebug("333ui64 == 456ui64 = %d\n", pui64.Compare(&pui64b, iFCOProp::OP_EQ));
TEST( iFCOProp::CMP_FALSE == p2i64.Compare(&pi64, iFCOProp::OP_EQ)); TEST( iFCOProp::CMP_FALSE == p2i64.Compare(&pi64, iFCOProp::OP_EQ));
}
void TestStrings()
{
cDebug d("TestStrings");
cFCOPropTSTRING pt1; cFCOPropTSTRING pt1;
cFCOPropTSTRING pt2; cFCOPropTSTRING pt2;
pt1.SetValue(TSTRING(_T("bar"))); pt1.SetValue(TSTRING(_T("bar")));
pt2.SetValue(TSTRING(_T("foo"))); pt2.SetValue(TSTRING(_T("foo")));
cFCOPropInt64 pi64;
pi64.SetValue(8675309);
d.TraceDebug(_T("property TSTRING = (should be \"bar\") %s\n"), pt1.AsString().c_str()); d.TraceDebug(_T("property TSTRING = (should be \"bar\") %s\n"), pt1.AsString().c_str());
TEST(pt1.AsString() == "bar"); TEST(pt1.AsString() == "bar");
@ -94,3 +100,8 @@ void TestFCOPropImpl()
return; return;
} }
void RegisterSuite_FCOPropImpl()
{
RegisterTest("FCOPropImpl", "Numeric", TestNumeric);
RegisterTest("FCOPropImpl", "Strings", TestStrings);
}

View File

@ -192,3 +192,8 @@ static void objManip (cFCOPropVector &testV, cDebug& d)
v3.AddItem(3); v3.AddItem(3);
TEST((v1 ^ v2) == v3); TEST((v1 ^ v2) == v3);
} }
void RegisterSuite_FCOPropVector()
{
RegisterTest("FCOPropVector", "Basic", TestFCOPropVector);
}

View File

@ -171,3 +171,7 @@ void TestFCOReport()
d.TraceDebug("Leaving...\n"); d.TraceDebug("Leaving...\n");
} }
void RegisterSuite_FCOReport()
{
RegisterTest("FCOReport", "Basic", TestFCOReport);
}

View File

@ -75,10 +75,12 @@ void TestFCOSetImpl()
pFCO3->Release(); pFCO3->Release();
// let's iterate over the fcos // let's iterate over the fcos
cIterProxy<iFCOIter> pit(set.GetIter()); iFCOIter* pIter = set.GetIter();
cIterProxy<iFCOIter> pit(pIter);
pit->SeekBegin(); pit->SeekBegin();
PrintIter(pit, d); PrintIter(pit, d);
// lookup a specific fco // lookup a specific fco
cIterProxy<iFCOIter> pit2(set.Lookup(cFCOName(_T("fco2")))); cIterProxy<iFCOIter> pit2(set.Lookup(cFCOName(_T("fco2"))));
if(! (iFCOIter*)pit2) if(! (iFCOIter*)pit2)
@ -113,10 +115,14 @@ void TestFCOSetImpl()
// test operator= // test operator=
cFCOSetImpl set2; cFCOSetImpl set2;
set2 = set; set2 = set;
pit = set2.GetIter();
pIter->DestroyIter();
pIter = set2.GetIter();
pit = pIter;
d.TraceDebug("Made a new set and set it equal to the first with operator=; printing out...\n"); d.TraceDebug("Made a new set and set it equal to the first with operator=; printing out...\n");
PrintIter(pit, d); PrintIter(pit, d);
// test IsEmpty // test IsEmpty
set.Clear(); set.Clear();
TEST(set.IsEmpty()); TEST(set.IsEmpty());
@ -142,9 +148,14 @@ void TestFCOSetImpl()
pit = set3.GetIter(); pit = set3.GetIter();
PrintIter(pit, d); PrintIter(pit, d);
pIter->DestroyIter();
d.TraceDebug("Leaving...\n"); d.TraceDebug("Leaving...\n");
return; return;
} }
void RegisterSuite_FCOSetImpl()
{
RegisterTest("FCOSetImpl", "Basic", TestFCOSetImpl);
}

View File

@ -51,3 +51,8 @@ void TestFCOSpec()
cout << "End\tTestFCOSpec" << endl; cout << "End\tTestFCOSpec" << endl;
return; return;
} }
void RegisterSuite_FCOSpec()
{
RegisterTest("FCOSpec", "Basic", TestFCOSpec);
}

View File

@ -85,6 +85,13 @@ void TestFCOSpecAttr()
// trace contents... // trace contents...
TraceSpecAttr(pNew, d); TraceSpecAttr(pNew, d);
TEST( *pAttr == *pNew );
pNew->Release(); pNew->Release();
pAttr->Release(); pAttr->Release();
} }
void RegisterSuite_FCOSpecAttr()
{
RegisterTest("FCOSpecAttr", "Basic", TestFCOSpecAttr);
}

View File

@ -129,3 +129,8 @@ void TestFCOSpecHelper()
delete pHelp1; delete pHelp1;
delete pHelp2; delete pHelp2;
} }
void RegisterSuite_FCOSpecHelper()
{
RegisterTest("FCOSpecHelper", "Basic", TestFCOSpecHelper);
}

View File

@ -164,3 +164,7 @@ void TestFCOSpecList()
return; return;
} }
void RegisterSuite_FCOSpecList()
{
RegisterTest("FCOSpecList", "Basic", TestFCOSpecList);
}

View File

@ -80,3 +80,8 @@ void TestFcoSpecUtil()
d.TraceDebug("Leaving..\n"); d.TraceDebug("Leaving..\n");
} }
void RegisterSuite_FcoSpecUtil()
{
RegisterTest("FcoSpecUtil", "Basic", TestFcoSpecUtil);
}

View File

@ -58,3 +58,7 @@ void TestFile()
TEST(testStream); TEST(testStream);
} }
void RegisterSuite_File()
{
RegisterTest("File", "Basic", TestFile);
}

View File

@ -126,3 +126,8 @@ void TestFileHeader()
TEST(memcmp(buf, "abc123", 6) == 0); TEST(memcmp(buf, "abc123", 6) == 0);
} }
} }
void RegisterSuite_FileHeader()
{
RegisterTest("FileHeader", "Basic", TestFileHeader);
}

View File

@ -71,3 +71,7 @@ void TestFileUtil()
unlink(source.c_str()); unlink(source.c_str());
} }
void RegisterSuite_FileUtil()
{
RegisterTest("FileUtil", "Basic", TestFileUtil);
}

View File

@ -62,13 +62,12 @@ static void PrintDb( cHierDatabase::iterator iter, cDebug d, bool bFirst = true
static void PrintIter( cFSDataSourceIter iter, cDebug& d ) static void PrintIter( cFSDataSourceIter iter, cDebug& d )
{ {
// int count = 0;
//debug stuff
//
if( ! iter.CanDescend() ) if( ! iter.CanDescend() )
{ {
d.TraceError( "Iterator cannot descend; returning!\n"); d.TraceError( "Iterator cannot descend; returning!\n");
TEST(!"Unexpected !CanDescend at beginning of test");
return; return;
} }
iter.Descend(); iter.Descend();
@ -76,6 +75,7 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d )
for( iter.SeekBegin(); ! iter.Done(); iter.Next() ) for( iter.SeekBegin(); ! iter.Done(); iter.Next() )
{ {
count++;
iFCO* pFCO = iter.CreateFCO(); iFCO* pFCO = iter.CreateFCO();
if( pFCO ) if( pFCO )
{ {
@ -85,6 +85,7 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d )
else else
{ {
d.TraceError( "*** Create of FCO failed!\n"); d.TraceError( "*** Create of FCO failed!\n");
fail("CreateFCO() failure");
} }
if( iter.CanDescend() ) if( iter.CanDescend() )
{ {
@ -92,20 +93,32 @@ static void PrintIter( cFSDataSourceIter iter, cDebug& d )
PrintIter(iter, d); PrintIter(iter, d);
} }
} }
TEST(count > 0);
} }
void TestFSDataSourceIter() void TestFSDataSourceIter()
{ {
skip("Fix this test");
cFSDataSourceIter iter; cFSDataSourceIter iter;
cDebug d("TestFSDataSourceIter"); cDebug d("TestFSDataSourceIter");
cFCOName base(TwTestDir());
// go to my temp directory and iterate over everything! // go to my temp directory and iterate over everything!
iter.SeekToFCO( cFCOName(_T("/tmp")) ); iter.SeekToFCO( cFCOName(TwTestDir()) );
// //
// print out everything below the iterator // print out everything below the iterator
// //
PrintIter( iter, d ); PrintIter( iter, d );
} }
void RegisterSuite_FSDataSourceIter()
{
RegisterTest("FSDataSourceIter", "Basic", TestFSDataSourceIter);
}

View File

@ -32,9 +32,16 @@
// fsobject_t -- the file system object test driver // fsobject_t -- the file system object test driver
#include "fs/stdfs.h" #include "fs/stdfs.h"
#include "fs/fsobject.h" #include "fs/fsobject.h"
#include "test.h"
void TestFSObject() void TestFSObject()
{ {
cDebug d("TestFSObject"); cDebug d("TestFSObject");
d.TraceError("Implement this!\n"); d.TraceError("Implement this!\n");
skip("TestFSObject not implemented");
}
void RegisterSuite_FSObject()
{
RegisterTest("FSObject", "Basic", TestFSObject);
} }

View File

@ -155,4 +155,8 @@ void TestGetSymLinkStr()
TEST(arch.Length() == (int64)file.size()); TEST(arch.Length() == (int64)file.size());
} }
void RegisterSuite_FSPropCalc()
{
RegisterTest("FSPropCalc", "Basic", TestFSPropCalc);
RegisterTest("FSPropCalc", "GetSymLinkStr", TestGetSymLinkStr);
}

View File

@ -83,11 +83,11 @@ void cTestFSPropDisplayer::Test()
pPDNew->Merge( pPD ); pPDNew->Merge( pPD );
/*
//////////////////////// ////////////////////////
// write pd // write pd
cFileArchive outFile; cFileArchive outFile;
outFile.OpenReadWrite(_T("c:\\tmp\\tmp.pd")); outFile.OpenReadWrite( TwTestPath("tmp.pd").c_str() );
cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE); cSerializerImpl outSer(outFile, cSerializerImpl::S_WRITE);
outSer.Init(); outSer.Init();
@ -101,16 +101,17 @@ void cTestFSPropDisplayer::Test()
//////////////////////// ////////////////////////
// read pd // read pd
cFileArchive inFile; cFileArchive inFile;
inFile.OpenRead(_T("c:\\tmp\\tmp.pd")); inFile.OpenRead( TwTestPath("tmp.pd").c_str() );
cSerializerImpl inSer(inFile, cSerializerImpl::S_READ); cSerializerImpl inSer(inFile, cSerializerImpl::S_READ);
cFSPropDisplayer* pPDNew = new cFSPropDisplayer(); cFSPropDisplayer* pPDRead = new cFSPropDisplayer();
inSer.Init(); inSer.Init();
pPDNew->Read( &inSer ); pPDRead->Read( &inSer );
inSer.Finit(); inSer.Finit();
*/
TEST( *pPD == *pPDRead );
TSTRING strRet; TSTRING strRet;
for( i = 0; i < 26; i++ ) for( i = 0; i < 26; i++ )
{ {
@ -127,7 +128,14 @@ void cTestFSPropDisplayer::Test()
d.TraceDebug("\n"); d.TraceDebug("\n");
} }
delete pPD;
delete pPDNew;
delete pPDRead;
return; return;
} }
void RegisterSuite_FSPropDisplayer()
{
RegisterTest("FSPropDisplayer", "Basic", TestFSPropDisplayer);
}

View File

@ -92,3 +92,8 @@ void TestFSPropSet()
return; return;
} }
void RegisterSuite_FSPropSet()
{
RegisterTest("FSPropSet", "Basic", TestFSPropSet);
}

Some files were not shown because too many files have changed in this diff Show More