Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE.sh	(revision 28866)
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+# Makefile to compile up the OWASP-for-C++ package after first compiling up its dependencies
+# The OWASP-for-C package:
+# http://owasp-esapi-cplusplus.googlecode.com/svn/trunk/doc/html/index.html
+# It depends on cryptopp, boost (depends on zlib, bzip2, cmake, curl), and requires the safeint header file
+
+# unpack everything
+# (svn checkout owasp-for-c++? or commit as a directory to gs?)
+# rename cryptopp-version folder to cryptopp
+# create 'installed' folder
+# compile everything (or at least all the dependencies) into the installed folder, compile owasp, 
+# with safeint in -I CFLAGS path
+
+export securitydir=`pwd`
+stored_installdir=$installdir
+export installdir=$securitydir/installed
+
+# Cryptopp, Boost, and the SafeInt header file is needed for OWASP-ESAPI-for-C++
+CRYPTOPP=cryptopp-5.6.2
+
+# Boost is needed for OWASP-ESAPI-for-C++
+ZLIB=zlib-1.2.7
+BZIP2=bzip2-1.0.6
+CMAKE=cmake-2.8.10.2
+CURL=curl-7.30.0
+BOOST=boost_1_52_0
+
+SAFEINT=safeint
+OWASPCPP=gs_owasp-esapi-cpp_03.03.2014
+# http://owasp-esapi-cplusplus.googlecode.com/svn/trunk/doc/html/index.html
+# svn checkout https://owasp-esapi-cplusplus.googlecode.com/svn/trunk/ owasp-esapi-cpp
+
+pkglist="$CRYPTOPP $ZLIB $BZIP2 $CURL $CMAKE $BOOST $SAFEINT $OWASPCPP"
+
+
+# If doing tarclean: then get rid of all the extracted folders and the installed folder
+if [ "x$1" = "xtarclean" ]; then
+    folders="$pkglist $installdir"
+    for folder in $folders; do
+	if [ -d $folder ]; then
+	    rm -rf $folder
+	fi
+    done
+    exit
+fi
+
+
+# make the installed folder
+if [ ! -e $installdir ]; then
+    mkdir $installdir
+    mkdir $installdir/include
+fi
+
+# UNPACK
+#ziplist="$CRYPTOPP $boostlist $SAFEINT $OWASPCPP"
+for zip in $pkglist; do
+    if test ! -d "$zip" ; then
+	tar xvzf $zip.tar.gz
+    fi
+done
+
+# Copy across the Safe Integer header file
+cp safeint/SafeInt3.hpp $installdir/include/.
+
+# Make a symbolic link to cryptopp-version-no. that's called cryptopp
+if [ -d "$CRYPTOPP" ] && [ ! -e cryptopp ]; then
+#mv $CRYPTOPP cryptopp
+    ln -s $CRYPTOPP cryptopp
+fi
+
+
+# COMPILE
+# Basically, we run the <package>.sh file in the CASCADE-MAKE folder for each package
+# each package's .sh file will cd into the package's folder (stored in the exported compiledir var)
+# and then run configure, make and install steps as applicable.
+
+# http://stackoverflow.com/questions/546817/iterating-over-two-lists-in-parallel-in-bin-s
+makearray=("CRYPTOPP" "ZLIB" "BZIP2" "CURL" "CMAKE" "BOOST" "SAFEINT" "OWASPCPP")
+pkgarray=($pkglist)
+
+count=${#makearray[@]}
+for i in `seq 1 $count`
+do
+    echo "Compiling ${pkgarray[$i-1]} by running ${makearray[$i-1]}.sh"
+    makefile=${makearray[$i-1]}
+    export compiledir=${pkgarray[$i-1]}
+
+    if [ -e CASCADE-MAKE/$makefile.sh ]; then
+	./CASCADE-MAKE/$makefile.sh $*
+    fi
+done
+compiledir=
+
+export securitydir=
+export installdir=$stored_installdir
Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/BOOST.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/BOOST.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/BOOST.sh	(revision 28866)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+cd $securitydir/$compiledir
+prefix=$installdir
+
+if [ ! -e bjam ]; then
+   ( ./bootstrap.sh --prefix=$prefix; \
+   BZIP2_INCLUDE=$prefix/include/ \
+   BZIP2_LIBPATH=$prefix/lib/ \
+   ./b2 --without-python install; )
+else
+    echo "Found Boostrap output for ${progname%.*} => no need to Bootstrap or Compile"
+fi
+
+cd $securitydir
Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/BZIP2.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/BZIP2.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/BZIP2.sh	(revision 28866)
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+cd $securitydir/$compiledir
+prefix=$installdir
+
+# If doing a make clean or distclean
+#if [ "x$1" != "x" ]; then
+#    make $1
+#    exit 0
+#fi
+
+#opt_run_configure $force_config $auto_config $package $version $prefix
+if [ ! -e bzip2 ]; then
+    make -f Makefile-libbz2_so 
+    make install PREFIX=$prefix;		
+fi
+
+cd $securitydir
Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CMAKE.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CMAKE.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CMAKE.sh	(revision 28866)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+cd $securitydir/$compiledir
+prefix=$installdir
+
+# If doing a make clean or distclean
+if [ "x$1" != "x" ]; then
+    make $1
+    exit 0
+fi
+
+# else, configure, make, make install
+
+cxxflags="-I$installdir -I$installdir/include" 
+ldflags="-L$installdir/lib"
+
+# configure, but only if we haven't already
+if [ ! -e Makefile ] ; then
+    ./configure --prefix=$prefix \
+	--system-curl \
+	-- -DCURL_INCLUDE_DIR=$prefix/include -DCURL_LIBRARY=$prefix/lib/libcurl.so
+fi
+
+
+# make
+CXXFLAGS=$cxxflags LDFLAGS=$ldflags make
+if [ $? != 0 ] ; then
+    echo "Error encountered making $d"
+    exit 1
+fi
+
+# make install
+CXXFLAGS=$cxxflags LDFLAGS=$ldflags make install
+if [ $? != 0 ] ; then
+    echo "Error encountered when installing $d"
+    exit 1
+fi
+
+cd $securitydir
Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CRYPTOPP.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CRYPTOPP.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CRYPTOPP.sh	(revision 28866)
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+cd $securitydir/$compiledir
+prefix=$installdir
+#export PREFIX=$installdir
+
+# If doing a make clean or distclean
+if [ "x$1" != "x" ]; then
+    make -f GNUmakefile $*
+    exit 0
+fi
+
+# else, make and make install
+
+if [ ! -e libcryptopp.a ]; then
+    #make -f GNUmakefile static
+    #make -f GNUmakefile install static
+    
+    PREFIX=$prefix make -f GNUmakefile # static
+    PREFIX=$prefix make -f GNUmakefile install static
+fi
+
+#export PREFIX=
+cd $securitydir
Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CURL.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CURL.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/CURL.sh	(revision 28866)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+cd $securitydir/$compiledir
+prefix=$installdir
+
+# If doing a make clean or distclean
+if [ "x$1" != "x" ]; then
+    make $1
+    exit 0
+fi
+
+
+# else, configure, make, make install
+
+# CURL configure script is stricter than most, and insists that 
+# no C pre-processing flags (such -I/aa/bb/cc) appear in the
+# CFLAGS variable
+export CFLAGS=`echo $CFLAGS | sed 's/-I[^ ]*//g'`
+
+# configure, but only if we haven't already
+if [ ! -e config.h ] ; then
+    ./configure --prefix=$prefix
+fi
+
+# make
+make
+if [ $? != 0 ] ; then
+    echo "Error encountered making $d"
+    exit 1
+fi
+
+# make install
+make install
+if [ $? != 0 ] ; then
+    echo "Error encountered when installing $d"
+    exit 1
+fi
+
+cd $securitydir
Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/OWASPCPP.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/OWASPCPP.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/OWASPCPP.sh	(revision 28866)
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+cd $securitydir/$compiledir
+
+# If doing a make clean or distclean
+if [ "x$1" != "x" ]; then
+    make -f GNUmakefile $*
+    exit 0
+fi
+
+# else, make and make install
+cxxflags="-I$installdir -I$installdir/include" 
+ldflags="-L$installdir/lib" 
+
+CXXFLAGS=$cxxflags LDFLAGS=$ldflags prefix=$installdir make -f GNUmakefile static
+CXXFLAGS=$cxxflags LDFLAGS=$ldflags prefix=$installdir make -f GNUmakefile install static
+
+
+cd $securitydir
Index: /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/ZLIB.sh
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/ZLIB.sh	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/CASCADE-MAKE/ZLIB.sh	(revision 28866)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+cd $securitydir/$compiledir
+prefix=$installdir
+#echo `pwd`
+
+# If doing a make clean or distclean
+if [ "x$1" != "x" ]; then
+    make $1
+    exit 0
+fi
+
+# else, configure, make, make install
+
+# configure, but only if we haven't already
+if [ ! -e config.h ] ; then
+    ./configure --prefix=$prefix
+fi
+
+if [ $? != 0 ] ; then
+    echo "Error encountered when configuring $d"
+    exit 1
+fi
+
+# make
+make
+if [ $? != 0 ] ; then
+    echo "Error encountered making $d"
+    exit 1
+fi
+
+# make install
+make install
+if [ $? != 0 ] ; then
+    echo "Error encountered when installing $d"
+    exit 1
+fi
+
+cd $securitydir
Index: /main/trunk/greenstone2/runtime-src/packages/security/README
===================================================================
--- /main/trunk/greenstone2/runtime-src/packages/security/README	(revision 28866)
+++ /main/trunk/greenstone2/runtime-src/packages/security/README	(revision 28866)
@@ -0,0 +1,55 @@
+OWASP ESAPI for C++ package and its dependencies
+-------------------------------------------------------
+Used to ensure cgiargs that go into the webpage are safe.
+See https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet
+
+
+OWASP ESAPI FOR C++
+-------------------------------------------------------
+The site is:
+    http://owasp-esapi-cplusplus.googlecode.com/svn/trunk/doc/html/index.html
+
+The code is from the 3 Mar 2014 svn checkout:
+ svn checkout https://owasp-esapi-cplusplus.googlecode.com/svn/trunk/ owasp-esapi-cpp
+
+A slight modification has been made to the package's GNUmakefile: the 2 references to -Wtrampolines have been commented out
+
+
+COMPILATION
+----------------------------
+
+./CASCADE-MAKE.sh
+
+
+To compile up the test/TestMainWin32 binary:
+   runtime-src/packages/security/owasp-esapi-cpp/test>g++ -std=gnu++0x -DDEBUG -O0 -g3 -ggdb TestMainWin32.cpp -o TestMain.exe -I../esapi -I../.. -I../../echoprint-svn/linux/include -L ../lib -lesapi-c++
+
+Note that in the example above, the -std=gnu++0x used with gnu compilers (try -std=c++0x on other systems like VisC++) turns on experimental features of the c++ language. If this is undesirable, edit the owasp-for-cpp/esapi/EsapiCommon.h:
+
+//# include <memory>
+//# include <unordered_map>
+//using std::shared_ptr;
+//using std::unordered_map;
+# include <boost/shared_ptr.hpp>
+# include <boost/unordered_map.hpp>
+using boost::shared_ptr;
+using boost::unordered_map;
+
+
+The above uses the include files for unordered_map and shared_ptr from boost instead.
+
+
+
+OWASP-ESAPI-FOR-C++'s DEPENDENCIES
+-------------------------------------
+OWASP-ESAPI for C++ depends on the following:
+- cryptopp
+- Boost
+- the safeint/Safe Integer header file, SafeInt3.hpp
+
+Compiling up Boost requires the following dependencies in the given order:
+- zlib, bzip2, curl, cmake
+
+Boost compilation steps were taken from the echoprint gs2-extension
+http://trac.greenstone.org/browser/gs2-extensions/echoprint/trunk/src?rev=head
+
