More lib migration, purged old thread/error template code.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Wed, 20 Dec 2006 05:36:10 +0000 (05:36 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Wed, 20 Dec 2006 05:36:10 +0000 (05:36 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2086 cb58f699-b61c-0410-a6fe-9272a202ed29

51 files changed:
apache/mod_apache.cpp
apache/mod_shib13.vcproj
apache/mod_shib20.vcproj
apache/mod_shib22.vcproj
isapi_shib/isapi_shib.cpp
isapi_shib/isapi_shib.vcproj
nsapi_shib/nsapi_shib.cpp
nsapi_shib/nsapi_shib.vcproj
odbc_ccache/odbc-ccache.cpp
odbc_ccache/odbc_ccache.vcproj
posttest/posttest.vcproj
shar/shar.vcproj
shar/testclient.vcproj
shib-mysql-ccache/shib-mysql-ccache.cpp
shib-mysql-ccache/shib_mysql_ccache.vcproj
shib-target/Makefile.am
shib-target/SocketListener.cpp
shib-target/SocketListener.h
shib-target/internal.h
shib-target/shib-ccache.cpp
shib-target/shib-config.cpp
shib-target/shib-handlers.cpp
shib-target/shib-ini.cpp
shib-target/shib-mlp.cpp [deleted file]
shib-target/shib-target.cpp
shib-target/shib-target.h
shib-target/shibrpc.h [deleted file]
shib-target/shibtarget.vcproj
shib-target/testini.cpp [deleted file]
shib-target/testinit.c [deleted file]
shib-target/testlog.cpp [deleted file]
shib-target/testmlp.cpp [deleted file]
shib/Makefile.am
shib/ReloadableXMLFile.cpp
shib/ShibConfig.cpp
shib/shib-threads-win32.cpp [deleted file]
shib/shib-threads.cpp [deleted file]
shib/shib-threads.h [deleted file]
shib/shib.h
shib/shib.vcproj
shib/shibthreadswin32test/ReadMe.txt [deleted file]
shib/shibthreadswin32test/shibthreadswin32test.cpp [deleted file]
shib/shibthreadswin32test/shibthreadswin32test.dsp [deleted file]
shib/shibthreadswin32test/shibthreadswin32test.dsw [deleted file]
shib/shibthreadswin32test/stdafx.cpp [deleted file]
shib/shibthreadswin32test/stdafx.h [deleted file]
shibtest/shibtest.vcproj
siterefresh/siterefresh.cpp
siterefresh/siterefresh.vcproj
xmlproviders/internal.h
xmlproviders/xmlproviders.vcproj

index 08654f3..dbeb11b 100644 (file)
@@ -34,7 +34,6 @@
 // SAML Runtime
 #include <saml/saml.h>
 #include <shib/shib.h>
-#include <shib/shib-threads.h>
 #include <shib-target/shib-target.h>
 #include <xercesc/util/regx/RegularExpression.hpp>
 
 #include <unistd.h>            // for getpid()
 #endif
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace saml;
+using namespace xmltooling;
+using namespace std;
 
 extern "C" module MODULE_VAR_EXPORT mod_shib;
 
@@ -762,8 +761,8 @@ bool htAccessControl::authorized(
             }
         }
         else {
-            Iterator<IAAP*> provs=st->getApplication()->getAAPProviders();
-            AAP wrapper(provs,w);
+            Iterator<shibboleth::IAAP*> provs=st->getApplication()->getAAPProviders();
+            shibboleth::AAP wrapper(provs,w);
             if (wrapper.fail()) {
                 st->log(ShibTarget::LogLevelWarn, string("htAccessControl plugin didn't recognize require rule: ") + w);
                 continue;
index a14ac1a..af32b56 100644 (file)
@@ -48,7 +48,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c,\Apache\include"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache\include;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;EAPI"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib ApacheCore.lib saml_5.lib"
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib ApacheCore.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile="Release/mod_shib_13.so"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="../../../opensaml/c/saml/Release,\Apache\libexec"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;,\Apache\libexec"
                                ProgramDatabaseFile=".\Release/mod_shib_13.pdb"
                                ImportLibrary=".\Release/mod_shib_13.lib"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache\include"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache\include;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_WINDOWS;EAPI;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib ApacheCore.lib saml_5D.lib"
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib ApacheCore.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile="Debug/mod_shib_13.so"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug,\Apache\libexec"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;;\Apache\libexec"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\Debug/mod_shib_13.lib"
                                TargetMachine="1"
index 6b6edb7..bcd877e 100644 (file)
@@ -48,7 +48,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c,\Apache2\include"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache2\include;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib libapr.lib libhttpd.lib saml_5.lib"
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib libapr.lib libhttpd.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile="mod_shib20___Win32_Release/mod_shib_20.so"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="../../../opensaml/c/saml/Release,\httpd-2.0.52\srclib\apr\Release,\httpd-2.0.52\Release"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;,\httpd-2.0.52\srclib\apr\Release,\httpd-2.0.52\Release"
                                ProgramDatabaseFile=".\mod_shib20___Win32_Release/mod_shib_20.pdb"
                                ImportLibrary=".\mod_shib20___Win32_Release/mod_shib_20.lib"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache2\include"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache2\include;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib libapr.lib libhttpd.lib saml_5D.lib"
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib libapr.lib libhttpd.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile="mod_shib20___Win32_Debug/mod_shib_20.so"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug,\httpd-2.0.52\srclib\apr\Debug,\httpd-2.0.52\Debug"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;;\httpd-2.0.52\srclib\apr\Debug,\httpd-2.0.52\Debug"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\mod_shib20___Win32_Debug/mod_shib_20.lib"
                                TargetMachine="1"
index ad413f2..7645538 100644 (file)
@@ -48,7 +48,7 @@
                                Name="VCCLCompilerTool"\r
                                Optimization="2"\r
                                InlineFunctionExpansion="1"\r
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c,\Apache22\include"\r
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache22\include;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"\r
                                PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"\r
                                StringPooling="true"\r
                                RuntimeLibrary="2"\r
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib libapr-1.lib libhttpd.lib"\r
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib saml2.lib xmltooling1.lib libapr-1.lib libhttpd.lib"\r
                                OutputFile="mod_shib22___Win32_Release/mod_shib_22.so"\r
                                LinkIncremental="1"\r
                                SuppressStartupBanner="true"\r
-                               AdditionalLibraryDirectories="../../../opensaml/c/saml/Release,\Apache22\lib"\r
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;,\Apache22\lib"\r
                                ProgramDatabaseFile=".\mod_shib22___Win32_Release/mod_shib_22.pdb"\r
                                ImportLibrary=".\mod_shib22___Win32_Release/mod_shib_22.lib"\r
                                TargetMachine="1"\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
                                Optimization="0"\r
-                               AdditionalIncludeDirectories="..,..\..\cpp-opensaml1,\Apache22D\include"\r
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;\Apache22D\include;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"\r
                                PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS"\r
                                MinimalRebuild="true"\r
                                BasicRuntimeChecks="3"\r
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib libapr-1.lib libhttpd.lib"\r
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib saml2D.lib xmltooling1D.lib libapr-1.lib libhttpd.lib"\r
                                OutputFile="mod_shib22___Win32_Debug/mod_shib_22.so"\r
                                LinkIncremental="2"\r
                                SuppressStartupBanner="true"\r
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug,\Apache22D\lib"\r
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;,\Apache22D\lib"\r
                                GenerateDebugInformation="true"\r
                                ProgramDatabaseFile=".\mod_shib22___Win32_Debug/mod_shib_22.pdb"\r
                                ImportLibrary=".\mod_shib22___Win32_Debug/mod_shib_22.lib"\r
index 102be44..0074ea6 100644 (file)
@@ -28,7 +28,6 @@
 // SAML Runtime
 #include <saml/saml.h>
 #include <shib/shib.h>
-#include <shib/shib-threads.h>
 #include <shib-target/shib-target.h>
 
 #include <ctime>
 #include <httpfilt.h>
 #include <httpext.h>
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace saml;
+using namespace xmltooling;
+using namespace std;
 
 // globals
 namespace {
index 9995335..e4944d1 100644 (file)
@@ -48,7 +48,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories=".,..,..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories=".,..,..\..\cpp-opensaml1;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalOptions="/export:GetExtensionVersion /export:GetFilterVersion /export:TerminateExtension /export:TerminateFilter /export:HttpFilterProc /export:HttpExtensionProc"
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib"
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile=".\Release/isapi_shib.dll"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                ProgramDatabaseFile=".\Release/isapi_shib.pdb"
                                ImportLibrary=".\Release/isapi_shib.lib"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories=".,..,..\..\cpp-opensaml1"
+                               AdditionalIncludeDirectories=".,..,..\..\cpp-opensaml1;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalOptions="/export:GetExtensionVersion /export:GetFilterVersion /export:TerminateExtension /export:TerminateFilter /export:HttpFilterProc /export:HttpExtensionProc"
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib"
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile=".\Debug/isapi_shib.dll"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\Debug/isapi_shib.lib"
                                TargetMachine="1"
index 0cfd095..34580d0 100644 (file)
@@ -35,7 +35,6 @@
 // SAML Runtime
 #include <saml/saml.h>
 #include <shib/shib.h>
-#include <shib/shib-threads.h>
 #include <shib-target/shib-target.h>
 
 #include <ctime>
@@ -58,10 +57,10 @@ extern "C"
 #include <nsapi.h>
 }
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace saml;
+using namespace xmltooling;
+using namespace std;
 
 // macros to output text to client
 #define NET_WRITE(str) \
index 865c503..99cb9fb 100644 (file)
@@ -48,7 +48,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories=".,..,..\..\..\opensaml\c,\\KRAMER\iPlanet\plugins\include"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib ns-httpd30.lib"
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib saml2.lib xmltooling1.lib ns-httpd30.lib"
                                OutputFile=".\Release/nsapi_shib.dll"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release,\\KRAMER\iPlanet\plugins\lib"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                ProgramDatabaseFile=".\Release/nsapi_shib.pdb"
                                ImportLibrary=".\Release/nsapi_shib.lib"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;\\KRAMER\iPlanet\plugins\include"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib ns-httpd30.lib"
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib saml2D.lib xmltooling1D.lib ns-httpd30.lib"
                                OutputFile=".\Debug/nsapi_shib.dll"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug,\\KRAMER\iPlanet\plugins\lib"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\Debug/nsapi_shib.lib"
                                TargetMachine="1"
index 77a149b..9f7ce9b 100644 (file)
 # define SHIBODBC_EXPORTS
 #endif
 
-#include <shib/shib-threads.h>
 #include <shib-target/shib-target.h>
 #include <log4cpp/Category.hh>
+#include <xmltooling/util/NDC.h>
 
+#include <ctime>
 #include <algorithm>
 #include <sstream>
 
 #include <dmalloc.h>
 #endif
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace shibboleth;
+using namespace saml;
+using namespace xmltooling;
 using namespace log4cpp;
+using namespace std;
 
 #define PLUGIN_VER_MAJOR 3
 #define PLUGIN_VER_MINOR 0
@@ -118,10 +120,9 @@ public:
 
     SQLHDBC getHDBC();
 
-    log4cpp::Category* log;
+    Category* log;
 
 protected:
-    //ThreadKey* m_mysql;
     const DOMElement* m_root; // can only use this during initialization
     string m_connstring;
 
@@ -139,7 +140,7 @@ const char* ODBCBase::p_connstring = NULL;
 ODBCBase::ODBCBase(const DOMElement* e) : m_root(e), m_bInitializedODBC(false)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("ODBCBase");
+    xmltooling::NDC ndc("ODBCBase");
 #endif
     log = &(Category::getInstance("shibtarget.ODBC"));
 
@@ -215,7 +216,7 @@ void ODBCBase::log_error(SQLHANDLE handle, SQLSMALLINT htype)
 SQLHDBC ODBCBase::getHDBC()
 {
 #ifdef _DEBUG
-    saml::NDC ndc("getMYSQL");
+    xmltooling::NDC ndc("getMYSQL");
 #endif
 
     // Get a handle.
@@ -320,9 +321,9 @@ public:
 private:
     bool m_storeAttributes;
     ISessionCache* m_cache;
-    CondWait* shutdown_wait;
+    xmltooling::CondWait* shutdown_wait;
     bool shutdown;
-    Thread* cleanup_thread;
+    xmltooling::Thread* cleanup_thread;
 
     static void* cleanup_fcn(void*); // XXX Assumed an ODBCCCache
 };
@@ -330,7 +331,7 @@ private:
 ODBCCCache::ODBCCCache(const DOMElement* e) : ODBCBase(e), m_storeAttributes(false)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("ODBCCCache");
+    xmltooling::NDC ndc("ODBCCCache");
 #endif
     log = &(Category::getInstance("shibtarget.SessionCache.ODBC"));
 
@@ -384,7 +385,7 @@ HRESULT ODBCCCache::onCreate(
     )
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onCreate");
+    xmltooling::NDC ndc("onCreate");
 #endif
 
     // Get XML data from entry. Default is not to return SAML objects.
@@ -456,7 +457,7 @@ HRESULT ODBCCCache::onRead(
     )
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onRead");
+    xmltooling::NDC ndc("onRead");
 #endif
 
     log->debug("searching database...");
@@ -555,7 +556,7 @@ HRESULT ODBCCCache::onRead(
 HRESULT ODBCCCache::onRead(const char* key, time_t& accessed)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onRead");
+    xmltooling::NDC ndc("onRead");
 #endif
 
     log->debug("reading last access time from database");
@@ -604,7 +605,7 @@ HRESULT ODBCCCache::onRead(const char* key, time_t& accessed)
 HRESULT ODBCCCache::onRead(const char* key, string& tokens)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onRead");
+    xmltooling::NDC ndc("onRead");
 #endif
 
     if (!m_storeAttributes)
@@ -651,7 +652,7 @@ HRESULT ODBCCCache::onRead(const char* key, string& tokens)
 HRESULT ODBCCCache::onUpdate(const char* key, const char* tokens, time_t lastAccess)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onUpdate");
+    xmltooling::NDC ndc("onUpdate");
 #endif
 
     ostringstream q;
@@ -706,7 +707,7 @@ HRESULT ODBCCCache::onUpdate(const char* key, const char* tokens, time_t lastAcc
 HRESULT ODBCCCache::onDelete(const char* key)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onDelete");
+    xmltooling::NDC ndc("onDelete");
 #endif
 
     SQLHSTMT hstmt;
@@ -731,10 +732,10 @@ HRESULT ODBCCCache::onDelete(const char* key)
 void ODBCCCache::cleanup()
 {
 #ifdef _DEBUG
-    saml::NDC ndc("cleanup");
+    xmltooling::NDC ndc("cleanup");
 #endif
 
-    Mutex* mutex = Mutex::create();
+    Mutex* mutex = xmltooling::Mutex::create();
 
     int rerun_timer = 0;
     int timeout_life = 0;
@@ -807,15 +808,17 @@ void ODBCCCache::cleanup()
 
     mutex->unlock();
     delete mutex;
-    Thread::exit(NULL);
+    xmltooling::Thread::exit(NULL);
 }
 
 void* ODBCCCache::cleanup_fcn(void* cache_p)
 {
   ODBCCCache* cache = (ODBCCCache*)cache_p;
 
+#ifndef WIN32
   // First, let's block all signals
   Thread::mask_all_signals();
+#endif
 
   // Now run the cleanup process.
   cache->cleanup();
index 8d738da..212d916 100644 (file)
@@ -40,7 +40,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
                                MinimalRebuild="true"
                                BasicRuntimeChecks="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib"
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib saml_5D.lib xmltooling1D.lib"
                                OutputFile="$(OutDir)\$(ProjectName).so"
                                LinkIncremental="2"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                SubSystem="2"
                                TargetMachine="1"
                        />
                        <Tool
                                Name="VCCLCompilerTool"
-                               AdditionalIncludeDirectories="..;..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
                                RuntimeLibrary="2"
                                UsePrecompiledHeader="0"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib"
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib xmltooling1.lib"
                                OutputFile="$(OutDir)\$(ProjectName).so"
                                LinkIncremental="1"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                GenerateDebugInformation="true"
                                SubSystem="2"
                                OptimizeReferences="2"
index c52cc14..1b926f7 100644 (file)
@@ -44,7 +44,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories="..,..\..\cpp-opensaml1;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="xerces-c_2.lib saml_5.lib"
+                               AdditionalDependencies="xerces-c_2.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile=".\Release/posttest.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Release;..\..\cpp-opensaml2\Release;..\..\cpp-xmltooling\Release"
                                ProgramDatabaseFile=".\Release/posttest.pdb"
                                SubSystem="1"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="xerces-c_2D.lib saml_5D.lib"
+                               AdditionalDependencies="xerces-c_2D.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile=".\Debug/posttest.exe"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug;..\..\cpp-opensaml2\Debug;..\..\cpp-xmltooling\Debug"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                                TargetMachine="1"
index a610096..f123e7e 100644 (file)
@@ -44,7 +44,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c,..\oncrpc"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="wsock32.lib log4cpp.lib saml_5.lib"
+                               AdditionalDependencies="wsock32.lib log4cpp.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile="Release/shibd.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                ProgramDatabaseFile=".\Release/shibd.pdb"
                                SubSystem="1"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;..\oncrpc"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="wsock32.lib log4cppD.lib saml_5D.lib"
+                               AdditionalDependencies="wsock32.lib log4cppD.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile="Debug/shibd.exe"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                                TargetMachine="1"
index cc204c4..05463cd 100644 (file)
@@ -45,7 +45,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,../oncrpc,..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml2&quot;;..\..\cpp-xmltooling;..\..\cpp-opensaml1"
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..,../oncrpc,..\..\cpp-opensaml1"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-xmltooling&quot;;&quot;..\..\cpp-opensaml2&quot;"
                                PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
index f8125a6..c69ce09 100644 (file)
@@ -39,8 +39,9 @@
 # include <unistd.h>
 #endif
 
-#include <shib/shib-threads.h>
 #include <shib-target/shib-target.h>
+
+#include <xmltooling/util/NDC.h>
 #include <log4cpp/Category.hh>
 
 #include <sstream>
 #include <dmalloc.h>
 #endif
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace shibboleth;
+using namespace saml;
 using namespace log4cpp;
+using namespace std;
 
 #define PLUGIN_VER_MAJOR 3
 #define PLUGIN_VER_MINOR 0
@@ -112,7 +113,7 @@ public:
   log4cpp::Category* log;
 
 protected:
-  ThreadKey* m_mysql;
+    xmltooling::ThreadKey* m_mysql;
   const DOMElement* m_root; // can only use this during initialization
 
   bool initialized;
@@ -135,11 +136,11 @@ extern "C" void shib_mysql_destroy_handle(void* data)
 MySQLBase::MySQLBase(const DOMElement* e) : m_root(e)
 {
 #ifdef _DEBUG
-  saml::NDC ndc("MySQLBase");
+  xmltooling::NDC ndc("MySQLBase");
 #endif
   log = &(Category::getInstance("shibtarget.SessionCache.MySQL"));
 
-  m_mysql = ThreadKey::create(&shib_mysql_destroy_handle);
+  m_mysql = xmltooling::ThreadKey::create(&shib_mysql_destroy_handle);
 
   initialized = false;
   mysqlInit(e,*log);
@@ -155,7 +156,7 @@ MySQLBase::~MySQLBase()
 MYSQL* MySQLBase::getMYSQL()
 {
 #ifdef _DEBUG
-    saml::NDC ndc("getMYSQL");
+    xmltooling::NDC ndc("getMYSQL");
 #endif
 
     // Do we already have a handle?
@@ -429,9 +430,9 @@ public:
 private:
     bool m_storeAttributes;
     ISessionCache* m_cache;
-    CondWait* shutdown_wait;
+    xmltooling::CondWait* shutdown_wait;
     bool shutdown;
-    Thread* cleanup_thread;
+    xmltooling::Thread* cleanup_thread;
 
     static void* cleanup_fcn(void*); // XXX Assumed an ShibMySQLCCache
 };
@@ -439,7 +440,7 @@ private:
 ShibMySQLCCache::ShibMySQLCCache(const DOMElement* e) : MySQLBase(e), m_storeAttributes(false)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("ShibMySQLCCache");
+    xmltooling::NDC ndc("ShibMySQLCCache");
 #endif
 
     m_cache = dynamic_cast<ISessionCache*>(
@@ -450,7 +451,7 @@ ShibMySQLCCache::ShibMySQLCCache(const DOMElement* e) : MySQLBase(e), m_storeAtt
         throw SAMLException("Unable to register MySQL cache plugin as a cache store.");
     }
     
-    shutdown_wait = CondWait::create();
+    shutdown_wait = xmltooling::CondWait::create();
     shutdown = false;
 
     // Load our configuration details...
@@ -459,7 +460,7 @@ ShibMySQLCCache::ShibMySQLCCache(const DOMElement* e) : MySQLBase(e), m_storeAtt
         m_storeAttributes=true;
 
     // Initialize the cleanup thread
-    cleanup_thread = Thread::create(&cleanup_fcn, (void*)this);
+    cleanup_thread = xmltooling::Thread::create(&cleanup_fcn, (void*)this);
 }
 
 ShibMySQLCCache::~ShibMySQLCCache()
@@ -480,7 +481,7 @@ HRESULT ShibMySQLCCache::onCreate(
     )
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onCreate");
+    xmltooling::NDC ndc("onCreate");
 #endif
 
     // Get XML data from entry. Default is not to return SAML objects.
@@ -539,7 +540,7 @@ HRESULT ShibMySQLCCache::onRead(
     )
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onRead");
+    xmltooling::NDC ndc("onRead");
 #endif
 
     log->debug("searching MySQL database...");
@@ -610,7 +611,7 @@ HRESULT ShibMySQLCCache::onRead(
 HRESULT ShibMySQLCCache::onRead(const char* key, time_t& accessed)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onRead");
+    xmltooling::NDC ndc("onRead");
 #endif
 
     log->debug("reading last access time from MySQL database");
@@ -656,7 +657,7 @@ HRESULT ShibMySQLCCache::onRead(const char* key, time_t& accessed)
 HRESULT ShibMySQLCCache::onRead(const char* key, string& tokens)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onRead");
+    xmltooling::NDC ndc("onRead");
 #endif
 
     if (!m_storeAttributes)
@@ -706,7 +707,7 @@ HRESULT ShibMySQLCCache::onRead(const char* key, string& tokens)
 HRESULT ShibMySQLCCache::onUpdate(const char* key, const char* tokens, time_t lastAccess)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onUpdate");
+    xmltooling::NDC ndc("onUpdate");
 #endif
 
     ostringstream q;
@@ -749,7 +750,7 @@ HRESULT ShibMySQLCCache::onUpdate(const char* key, const char* tokens, time_t la
 HRESULT ShibMySQLCCache::onDelete(const char* key)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("onDelete");
+    xmltooling::NDC ndc("onDelete");
 #endif
 
     // Remove from the database
@@ -775,10 +776,10 @@ HRESULT ShibMySQLCCache::onDelete(const char* key)
 void ShibMySQLCCache::cleanup()
 {
 #ifdef _DEBUG
-  saml::NDC ndc("cleanup");
+  xmltooling::NDC ndc("cleanup");
 #endif
 
-  Mutex* mutex = Mutex::create();
+  xmltooling::Mutex* mutex = xmltooling::Mutex::create();
 
   int rerun_timer = 0;
   int timeout_life = 0;
@@ -836,15 +837,17 @@ void ShibMySQLCCache::cleanup()
 
   mutex->unlock();
   delete mutex;
-  Thread::exit(NULL);
+  xmltooling::Thread::exit(NULL);
 }
 
 void* ShibMySQLCCache::cleanup_fcn(void* cache_p)
 {
   ShibMySQLCCache* cache = (ShibMySQLCCache*)cache_p;
 
+#ifndef WIN32
   // First, let's block all signals
-  Thread::mask_all_signals();
+  xmltooling::Thread::mask_all_signals();
+#endif
 
   // Now run the cleanup process.
   cache->cleanup();
@@ -866,7 +869,7 @@ MySQLReplayCache::MySQLReplayCache(const DOMElement* e) : MySQLBase(e) {}
 bool MySQLReplayCache::check(const char* str, time_t expires)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("check");
+    xmltooling::NDC ndc("check");
 #endif
   
     // Remove expired entries
index 65839b4..e3299b5 100644 (file)
@@ -47,7 +47,7 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;\mysql-5.0.16\include&quot;"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;;&quot;\mysql-5.0.16\include&quot;"
                                PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cppD.lib libmysqld.lib xerces-c_2D.lib saml_5D.lib"
+                               AdditionalDependencies="log4cppD.lib libmysqld.lib xerces-c_2D.lib saml_5D.lib xmltooling1D.lib"
                                OutputFile="Debug/shib-mysql-ccache.so"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug,\mysql-4.1.12\lib_debug"
+                               AdditionalLibraryDirectories="..\..\cpp-xmltooling\Debug;..\..\cpp-opensaml1\saml\Debug,\mysql-4.1.12\lib_debug"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\Debug/shib-mysql-ccache.lib"
                                TargetMachine="1"
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..;..\..\..\opensaml\c;&quot;\mysql-5.0.16\include&quot;"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;;&quot;\mysql-5.0.16\include&quot;"
                                PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cpp.lib libmysqld.lib xerces-c_2.lib saml_5.lib"
+                               AdditionalDependencies="log4cpp.lib libmysqld.lib xerces-c_2.lib saml_5.lib xmltooling1.lib"
                                OutputFile="Release/shib-mysql-ccache.so"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release,\mysql-4.1.12\lib_release"
+                               AdditionalLibraryDirectories="..\..\cpp-xmltooling\Release;..\..\cpp-opensaml1\Release,\mysql-4.1.12\lib_release"
                                ProgramDatabaseFile=".\Release/shib-mysql-ccache.pdb"
                                ImportLibrary=".\Release/shib-mysql-ccache.lib"
                                TargetMachine="1"
index af35430..f0b89ab 100644 (file)
@@ -22,7 +22,6 @@ libshib_target_la_SOURCES = \
        shib-config.cpp \
        shib-handlers.cpp \
        shib-ini.cpp \
-       shib-mlp.cpp \
        shib-target.cpp \
        TCPListener.cpp \
        UnixListener.cpp \
index 72a7337..715d852 100644 (file)
 # include <unistd.h>
 #endif
 
-using namespace std;
-using namespace log4cpp;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace saml;
+using namespace xmltooling;
+using namespace log4cpp;
+using namespace std;
 
 namespace shibtarget {
   
@@ -42,7 +42,7 @@ namespace shibtarget {
     {
     public:
         SocketPool(Category& log, const SocketListener* listener)
-            : m_log(log), m_listener(listener), m_lock(shibboleth::Mutex::create()) {}
+            : m_log(log), m_listener(listener), m_lock(Mutex::create()) {}
         ~SocketPool();
         SocketListener::ShibSocket get();
         void put(SocketListener::ShibSocket s);
@@ -273,7 +273,7 @@ DDF SocketListener::send(const DDF& in)
             if (retry)
                 retry--;
             else
-                throw ListenerException("Failure sending remoted message ($1).", params(1,in.name()));
+                throw ListenerException("Failure sending remoted message ($1).", saml::params(1,in.name()));
         }
         else {
             // SUCCESS.
@@ -287,7 +287,7 @@ DDF SocketListener::send(const DDF& in)
     if (recv(sock,(char*)&len,sizeof(len)) != sizeof(len)) {
         log->error("error reading size of output message");
         this->close(sock);
-        throw ListenerException("Failure receiving response to remoted message ($1).", params(1,in.name()));
+        throw ListenerException("Failure receiving response to remoted message ($1).", saml::params(1,in.name()));
     }
     len = ntohl(len);
     
@@ -302,7 +302,7 @@ DDF SocketListener::send(const DDF& in)
     if (len) {
         log->error("error reading output message from socket");
         this->close(sock);
-        throw ListenerException("Failure receiving response to remoted message ($1).", params(1,in.name()));
+        throw ListenerException("Failure receiving response to remoted message ($1).", saml::params(1,in.name()));
     }
     
     m_socketpool->put(sock);
@@ -357,8 +357,10 @@ void* server_thread_fn(void* arg)
 {
     ServerThread* child = (ServerThread*)arg;
 
+#ifndef WIN32
     // First, let's block all signals
     Thread::mask_all_signals();
+#endif
 
     // Run the child until it exits.
     child->run();
index 4204fec..b8b67c0 100644 (file)
@@ -68,9 +68,9 @@ namespace shibtarget {
 
         // Manage child threads
         friend class ServerThread;
-        std::map<ShibSocket,shibboleth::Thread*> m_children;
-        shibboleth::Mutex* m_child_lock;
-        shibboleth::CondWait* m_child_wait;
+        std::map<ShibSocket,xmltooling::Thread*> m_children;
+        xmltooling::Mutex* m_child_lock;
+        xmltooling::CondWait* m_child_wait;
 
         // Primary socket
         ShibSocket m_socket;
index 13c6b65..337ddba 100644 (file)
@@ -25,8 +25,6 @@
 #ifndef __shibtarget_internal_h__
 #define __shibtarget_internal_h__
 
-#include <saml/base.h>
-
 #ifdef WIN32
 # define SHIBTARGET_EXPORTS __declspec(dllexport)
 #endif
@@ -41,6 +39,8 @@
 #include "shib-target.h"
 #include "hresult.h"
 
+#include <xmltooling/util/Threads.h>
+
 #include <log4cpp/Category.hh>
 #include <log4cpp/FixedContextCategory.hh>
 
@@ -102,43 +102,6 @@ namespace shibtarget {
         const IApplication* m_app;
     };
 
-    // Error template class
-    class ShibMLPPriv;
-    class ShibMLP {
-    public:
-        ShibMLP();
-        ~ShibMLP();
-
-        void insert (const std::string& key, const std::string& value);
-        void insert (const std::string& key, const char* value) {
-          std::string v = value;
-          insert (key, v);
-        }
-        void insert (const char* key, const std::string& value) {
-          std::string k = key;
-          insert (k, value);
-        }
-        void insert (const char* key, const char* value) {
-          std::string k = key, v = value;
-          insert(k,v);
-        }
-        void insert (saml::SAMLException& e);
-
-        void clear () { m_map.clear(); }
-
-        const char* run (std::istream& s, const IPropertySet* props=NULL, std::string* output=NULL);
-        const char* run (const std::string& input, const IPropertySet* props=NULL, std::string* output=NULL);
-        const char* run (const char* input, const IPropertySet* props=NULL, std::string* output=NULL) {
-            std::string i = input;
-            return run(i,props,output);
-        }
-
-    private:
-        ShibMLPPriv *m_priv;
-        std::map<std::string,std::string> m_map;
-        std::string m_generated;
-    };
-    
     class STConfig : public ShibTargetConfig
     {
     public:
@@ -153,7 +116,7 @@ namespace shibtarget {
         void releaseTransactionLog() { m_tranLogLock->unlock();}
     private:
         log4cpp::FixedContextCategory* m_tranLog;
-        shibboleth::Mutex* m_tranLogLock;
+        xmltooling::Mutex* m_tranLogLock;
         static IConfig* ShibTargetConfigFactory(const DOMElement* e);
     };
 }
index efa2a68..a763f1e 100644 (file)
 # include <unistd.h>
 #endif
 
-#include <shib/shib-threads.h>
-
 #include <log4cpp/Category.hh>
 
+#include <ctime>
 #include <algorithm>
 #include <sstream>
 #include <stdexcept>
 #include <dmalloc.h>
 #endif
 
-using namespace std;
-using namespace log4cpp;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace shibboleth;
+using namespace saml;
+using namespace xmltooling;
+using namespace log4cpp;
+using namespace std;
 
 static const XMLCh cleanupInterval[] =
 { chLatin_c, chLatin_l, chLatin_e, chLatin_a, chLatin_n, chLatin_u, chLatin_p,
@@ -898,7 +898,7 @@ pair<SAMLResponse*,SAMLResponse*> MemorySessionCacheEntry::getNewResponse(
                     if (!XMLString::compareString(code.getNamespaceURI(),shibboleth::Constants::SHIB_NS) &&
                         !XMLString::compareString(code.getLocalName(), shibboleth::Constants::InvalidHandle)) {
                         codes.reset();
-                        throw InvalidHandleException(e.what(),params(),codes);
+                        throw InvalidHandleException(e.what(),saml::params(),codes);
                     }
                 }
             }
@@ -1222,7 +1222,7 @@ DDF MemorySessionCache::receive(const DDF& in)
         out.addmember("key").string(key.c_str());
         return out;
     }
-    throw ListenerException("Unsupported operation ($1)",params(1,in.name()));
+    throw ListenerException("Unsupported operation ($1)",saml::params(1,in.name()));
 }
 
 string MemorySessionCache::insert(
@@ -1373,7 +1373,7 @@ ISessionCacheEntry* MemorySessionCache::find(const char* key, const IApplication
                     InvalidSessionException ex(
                         SESSION_E_ADDRESSMISMATCH,
                         "Your IP address ($1) does not match the address recorded at the time the session was established.",
-                        params(1,client_addr)
+                        saml::params(1,client_addr)
                         );
                     annotateException(&ex,m.lookup(i->second->getProviderId())); // throws it
                 }
@@ -1562,8 +1562,10 @@ void* MemorySessionCache::cleanup_fcn(void* cache_p)
 {
     MemorySessionCache* cache = reinterpret_cast<MemorySessionCache*>(cache_p);
 
+#ifndef WIN32
     // First, let's block all signals 
     Thread::mask_all_signals();
+#endif
 
     // Now run the cleanup process.
     cache->cleanup();
index 107cf8f..bd04094 100644 (file)
  */
 
 #include "internal.h"
+#include <saml/SAMLConfig.h>
+#include <saml/util/SAMLConstants.h>
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/util/NDC.h>
+#include <xmltooling/util/TemplateEngine.h>
 
 #include <log4cpp/OstreamAppender.hh>
 
-using namespace std;
-using namespace log4cpp;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace shibboleth;
+using namespace saml;
+using namespace log4cpp;
+using namespace std;
+
+using xmltooling::TemplateEngine;
+using xmltooling::XMLToolingConfig;
 
 namespace {
     STConfig g_Config;
@@ -61,34 +69,14 @@ ShibTargetConfig& ShibTargetConfig::getConfig()
 
 bool STConfig::init(const char* schemadir)
 {
-    // With new build of log4cpp, we need to establish a "default"
-    // logging appender to stderr up front.
+    // Chain this to XMLTooling for now...
     const char* loglevel=getenv("SHIB_LOGGING");
     if (!loglevel)
-        loglevel = SHIB_LOGGING;    
-    Category& root = Category::getRoot();
-    if (!strcmp(loglevel,"DEBUG"))
-        root.setPriority(Priority::DEBUG);
-    else if (!strcmp(loglevel,"INFO"))
-        root.setPriority(Priority::INFO);
-    else if (!strcmp(loglevel,"NOTICE"))
-        root.setPriority(Priority::NOTICE);
-    else if (!strcmp(loglevel,"WARN"))
-        root.setPriority(Priority::WARN);
-    else if (!strcmp(loglevel,"ERROR"))
-        root.setPriority(Priority::ERROR);
-    else if (!strcmp(loglevel,"CRIT"))
-        root.setPriority(Priority::CRIT);
-    else if (!strcmp(loglevel,"ALERT"))
-        root.setPriority(Priority::ALERT);
-    else if (!strcmp(loglevel,"EMERG"))
-        root.setPriority(Priority::EMERG);
-    else if (!strcmp(loglevel,"FATAL"))
-        root.setPriority(Priority::FATAL);
-    root.setAppender(new OstreamAppender("default",&cerr));
+        loglevel = SHIB_LOGGING;
+    XMLToolingConfig::getConfig().log_config(loglevel);
  
 #ifdef _DEBUG
-    saml::NDC ndc("init");
+    xmltooling::NDC ndc("init");
 #endif
     Category& log = Category::getInstance("shibtarget.Config");
 
@@ -103,7 +91,7 @@ bool STConfig::init(const char* schemadir)
     if (schemadir)
         samlConf.schema_dir = schemadir;
     try {
-        if (!samlConf.init()) {
+        if (!samlConf.init() || !opensaml::SAMLConfig::getConfig().init()) {
             log.fatal("Failed to initialize SAML Library");
             return false;
         }
@@ -112,6 +100,9 @@ bool STConfig::init(const char* schemadir)
         log.fatal("Died initializing SAML Library");
         return false;
     }
+
+    XMLToolingConfig::getConfig().setTemplateEngine(new TemplateEngine());
+    XMLToolingConfig::getConfig().getTemplateEngine()->setTagPrefix("shibmlp");
     
     ShibConfig& shibConf=ShibConfig::getConfig();
     try { 
@@ -142,17 +133,15 @@ bool STConfig::init(const char* schemadir)
     
     auto_ptr_char temp1(Constants::SHIB_SESSIONINIT_PROFILE_URI);
     samlConf.getPlugMgr().regFactory(temp1.get(),&ShibSessionInitiatorFactory);
-    auto_ptr_char temp2(SAMLBrowserProfile::BROWSER_POST);
-    samlConf.getPlugMgr().regFactory(temp2.get(),&SAML1POSTFactory);
-    auto_ptr_char temp3(SAMLBrowserProfile::BROWSER_ARTIFACT);
-    samlConf.getPlugMgr().regFactory(temp3.get(),&SAML1ArtifactFactory);
+    samlConf.getPlugMgr().regFactory(samlconstants::SAML1_PROFILE_BROWSER_POST,&SAML1POSTFactory);
+    samlConf.getPlugMgr().regFactory(samlconstants::SAML1_PROFILE_BROWSER_ARTIFACT,&SAML1ArtifactFactory);
     auto_ptr_char temp4(Constants::SHIB_LOGOUT_PROFILE_URI);
     samlConf.getPlugMgr().regFactory(temp4.get(),&ShibLogoutFactory);
     
     saml::XML::registerSchema(shibtarget::XML::SHIBTARGET_NS,shibtarget::XML::SHIBTARGET_SCHEMA_ID,NULL,false);
-    saml::XML::registerSchema(shibtarget::XML::SAML2META_NS,shibtarget::XML::SAML2META_SCHEMA_ID,NULL,false);
-    saml::XML::registerSchema(shibtarget::XML::SAML2ASSERT_NS,shibtarget::XML::SAML2ASSERT_SCHEMA_ID,NULL,false);
-    saml::XML::registerSchema(shibtarget::XML::XMLENC_NS,shibtarget::XML::XMLENC_SCHEMA_ID,NULL,false);
+    saml::XML::registerSchema(samlconstants::SAML20MD_NS,shibtarget::XML::SAML2META_SCHEMA_ID,NULL,false);
+    saml::XML::registerSchema(samlconstants::SAML20_NS,shibtarget::XML::SAML2ASSERT_SCHEMA_ID,NULL,false);
+    saml::XML::registerSchema(xmlconstants::XMLENC_NS,shibtarget::XML::XMLENC_SCHEMA_ID,NULL,false);
     
     log.info("finished initializing");
     return true;
@@ -161,7 +150,7 @@ bool STConfig::init(const char* schemadir)
 bool STConfig::load(const char* config)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("load");
+    xmltooling::NDC ndc("load");
 #endif
     Category& log = Category::getInstance("shibtarget.Config");
 
@@ -185,10 +174,12 @@ bool STConfig::load(const char* config)
         
         pair<bool,unsigned int> skew=m_ini->getUnsignedInt("clockSkew");
         SAMLConfig::getConfig().clock_skew_secs=skew.first ? skew.second : 180;
+        if (skew.first)
+            xmltooling::XMLToolingConfig::getConfig().clock_skew_secs=skew.second;
         
         m_tranLog=new FixedContextCategory(SHIBTRAN_LOGCAT);
         m_tranLog->info("opened transaction log");
-        m_tranLogLock = Mutex::create();
+        m_tranLogLock = xmltooling::Mutex::create();
     }
     catch (SAMLException& ex) {
         log.fatal("caught exception while loading/initializing configuration: %s",ex.what());
@@ -210,7 +201,7 @@ bool STConfig::load(const char* config)
 void STConfig::shutdown()
 {
 #ifdef _DEBUG
-    saml::NDC ndc("shutdown");
+    xmltooling::NDC ndc("shutdown");
 #endif
     Category& log = Category::getInstance("shibtarget.Config");
     log.info("shutting down the library");
@@ -220,6 +211,7 @@ void STConfig::shutdown()
     delete m_ini;
     m_ini = NULL;
     ShibConfig::getConfig().term();
+    opensaml::SAMLConfig::getConfig().term();
     SAMLConfig::getConfig().term();
     log.info("library shutdown complete");
 }
index f2c322a..afe59e3 100644 (file)
  */
 
 #include "internal.h"
+#include <ctime>
 #include <saml/util/CommonDomainCookie.h>
 
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
 
-#include <shib/shib-threads.h>
-
 using namespace std;
 using namespace saml;
 using namespace shibboleth;
index e6567fb..1c487cc 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "internal.h"
 
-#include <shib/shib-threads.h>
 #include <log4cpp/Category.hh>
 #include <log4cpp/PropertyConfigurator.hh>
 #include <algorithm>
diff --git a/shib-target/shib-mlp.cpp b/shib-target/shib-mlp.cpp
deleted file mode 100644 (file)
index 04c591a..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * shib-mlp.cpp -- The ShibTarget Markup Language processor
- *
- * Created by: Derek Atkins <derek@ihtfp.com>
- *
- * $Id$
- */
-
-#include "internal.h"
-
-#include <sstream>
-#include <ctype.h>
-#include <xercesc/util/XercesDefs.hpp>
-#include <log4cpp/Category.hh>
-
-using namespace std;
-using namespace log4cpp;
-using namespace saml;
-using namespace shibboleth;
-using namespace shibtarget;
-
-class shibtarget::ShibMLPPriv {
-public:
-  ShibMLPPriv();
-  ~ShibMLPPriv() {}
-  log4cpp::Category *log;
-
-  static void html_encode(string& os, const char* start);
-};  
-
-
-void ShibMLPPriv::html_encode(string& os, const char* start)
-{
-    while (start && *start) {
-        switch (*start) {
-            case '<':   os += "&lt;";       break;
-            case '>':   os += "&gt;";       break;
-            case '"':   os += "&quot;";     break;
-            case '#':   os += "&#35;";      break;
-            case '%':   os += "&#37;";      break;
-            case '&':   os += "&#38;";      break;
-            case '\'':  os += "&#39;";      break;
-            case '(':   os += "&#40;";      break;
-            case ')':   os += "&#41;";      break;
-            case ':':   os += "&#58;";      break;
-            case '[':   os += "&#91;";      break;
-            case '\\':  os += "&#92;";      break;
-            case ']':   os += "&#93;";      break;
-            case '`':   os += "&#96;";      break;
-            case '{':   os += "&#123;";     break;
-            case '}':   os += "&#125;";     break;
-            default:    os += *start;
-        }
-        start++;
-    }
-}
-
-ShibMLPPriv::ShibMLPPriv() : log(&(log4cpp::Category::getInstance("shibtarget.ShibMLP"))) {}
-
-static void trimspace (string& s)
-{
-  size_t end = s.size() - 1, start = 0;
-
-  // Trim stuff on right.
-  while (end > 0 && !isgraph(s[end])) end--;
-
-  // Trim stuff on left.
-  while (start < end && !isgraph(s[start])) start++;
-
-  // Modify the string.
-  s = s.substr(start, end - start + 1);
-}
-
-ShibMLP::ShibMLP()
-{
-  m_priv = new ShibMLPPriv ();
-}
-
-ShibMLP::~ShibMLP ()
-{
-  delete m_priv;
-}
-
-const char* ShibMLP::run(const string& is, const IPropertySet* props, std::string* output)
-{
-  // Create a timestamp
-  time_t now = time(NULL);
-  insert("now", ctime(&now));
-
-  if (!output)
-    output=&m_generated;
-  const char* line = is.c_str();
-  const char* lastpos = line;
-  const char* thispos;
-
-  m_priv->log->debug("Processing string");
-
-  //
-  // Search for SHIBMLP tags.  These are of the form:
-  //   <shibmlp key/>
-  //    <shibmlpif key> stuff </shibmlpif>
-  //    <shibmlpifnot key> stuff </shibmlpifnot>
-  // Note that there MUST be white-space after "<shibmlp" but
-  // there does not need to be white space between the key and
-  // the close-tag.
-  //
-  while ((thispos = strchr(lastpos, '<')) != NULL) {
-    // save the string up to this token
-    *output += is.substr(lastpos-line, thispos-lastpos);
-
-    // Make sure this token matches our tokens.
-#ifdef HAVE_STRCASECMP
-    if (!strncasecmp(thispos, "<shibmlp ", 9))
-#else
-    if (!_strnicmp(thispos, "<shibmlp ", 9))
-#endif
-    {
-        // Save this position off.
-        lastpos = thispos + 9;  // strlen("<shibmlp ")
-    
-        // search for the end-tag
-        if ((thispos = strstr(lastpos, "/>")) != NULL) {
-            string key = is.substr(lastpos-line, thispos-lastpos);
-            trimspace(key);
-    
-            map<string,string>::const_iterator i=m_map.find(key);
-            if (i != m_map.end()) {
-                m_priv->html_encode(*output,i->second.c_str());
-            }
-            else {
-                pair<bool,const char*> p=props ? props->getString(key.c_str()) : pair<bool,const char*>(false,NULL);
-                if (p.first) {
-                    m_priv->html_encode(*output,p.second);
-                }
-                else {
-                    static const char* s1 = "<!-- Unknown SHIBMLP key: ";
-                    static const char* s2 = "/>";
-                    *output += s1;
-                    *output += key + s2;
-                }
-            }
-            lastpos = thispos + 2; // strlen("/>")
-        }
-    }
-#ifdef HAVE_STRCASECMP
-    else if (!strncasecmp(thispos, "<shibmlpif ", 11))
-#else
-    else if (!_strnicmp(thispos, "<shibmlpif ", 11))
-#endif
-    {
-        // Save this position off.
-        lastpos = thispos + 11;  // strlen("<shibmlpif ")
-
-        // search for the end of this tag
-        if ((thispos = strchr(lastpos, '>')) != NULL) {
-            string key = is.substr(lastpos-line, thispos-lastpos);
-            trimspace(key);
-            bool eval=false;
-            map<string,string>::const_iterator i=m_map.find(key);
-            if (i != m_map.end() && !i->second.empty()) {
-                eval=true;
-            }
-            else {
-                pair<bool,const char*> p=props ? props->getString(key.c_str()) : pair<bool,const char*>(false,NULL);
-                if (p.first) {
-                    eval=true;
-                }
-            }
-            lastpos = thispos + 1; // strlen(">")
-            
-            // Search for the closing tag.
-            const char* frontpos=lastpos;
-            while ((thispos = strstr(lastpos, "</")) != NULL) {
-#ifdef HAVE_STRCASECMP
-                if (!strncasecmp(thispos, "</shibmlpif>", 12))
-#else
-                if (!_strnicmp(thispos, "</shibmlpif>", 12))
-#endif
-                {
-                    // We found our terminator. Process the string in between.
-                    string segment;
-                    run(is.substr(frontpos-line, thispos-frontpos),props,&segment);
-                    if (eval)
-                        *output += segment;
-                    lastpos = thispos + 12; // strlen("</shibmlpif>")
-                    break;
-                }
-                else {
-                    // Skip it.
-                    lastpos = thispos + 2;
-                }
-            }
-        }
-    }
-#ifdef HAVE_STRCASECMP
-    else if (!strncasecmp(thispos, "<shibmlpifnot ", 14))
-#else
-    else if (!_strnicmp(thispos, "<shibmlpifnot ", 14))
-#endif
-    {
-        // Save this position off.
-        lastpos = thispos + 14;  // strlen("<shibmlpifnot ")
-
-        // search for the end of this tag
-        if ((thispos = strchr(lastpos, '>')) != NULL) {
-            string key = is.substr(lastpos-line, thispos-lastpos);
-            trimspace(key);
-            bool eval=false;
-            map<string,string>::const_iterator i=m_map.find(key);
-            if (i != m_map.end() && !i->second.empty()) {
-                eval=true;
-            }
-            else {
-                pair<bool,const char*> p=props ? props->getString(key.c_str()) : pair<bool,const char*>(false,NULL);
-                if (p.first) {
-                    eval=true;
-                }
-            }
-            lastpos = thispos + 1; // strlen(">")
-            
-            // Search for the closing tag.
-            const char* frontpos=lastpos;
-            while ((thispos = strstr(lastpos, "</")) != NULL) {
-#ifdef HAVE_STRCASECMP
-                if (!strncasecmp(thispos, "</shibmlpifnot>", 15))
-#else
-                if (!_strnicmp(thispos, "</shibmlpifnot>", 15))
-#endif
-                {
-                    // We found our terminator. Process the string in between.
-                    string segment;
-                    run(is.substr(frontpos-line, thispos-frontpos),props,&segment);
-                    if (!eval)
-                        *output += segment;
-                    lastpos = thispos + 15; // strlen("</shibmlpifnot>")
-                    break;
-                }
-                else {
-                    // Skip it.
-                    lastpos = thispos + 2;
-                }
-            }
-        }
-    }
-    else {
-      // Skip it.
-      *output += "<";
-      lastpos = thispos + 1;
-    }
-  }
-  *output += is.substr(lastpos-line);
-
-  return output->c_str();
-}
-
-const char* ShibMLP::run(istream& is, const IPropertySet* props, std::string* output)
-{
-  static string eol = "\r\n";
-  string str, line;
-
-  m_priv->log->debug("processing stream");
-
-  while (getline(is, line))
-    str += line + eol;
-
-  return run(str,props,output);
-}
-
-void ShibMLP::insert(SAMLException& e)
-{
-    insert("errorType", e.classname());
-    if (typeid(e)==typeid(ContentTypeException))
-        insert("errorText", "A problem was detected with your identity provider's software configuration.");
-    else
-        insert("errorText", e.getMessage() ? e.getMessage() : "No Message");
-    if (e.getProperty("errorURL"))
-        insert("originErrorURL", e.getProperty("errorURL"));
-    if (e.getProperty("contactName"))
-        insert("originContactName", e.getProperty("contactName"));
-    const char* email=e.getProperty("contactEmail");
-    if (email) {
-        if (!strncmp(email,"mailto:",7) && strlen(email)>7)
-            insert("originContactEmail", email+7);
-        else
-            insert("originContactEmail", email);
-    }
-}
-
-void ShibMLP::insert (const std::string& key, const std::string& value)
-{
-  m_priv->log->debug("inserting %s -> %s", key.c_str(), value.c_str());
-  m_map[key] = value;
-}
index 3c6156b..e395f3c 100644 (file)
 # include <unistd.h>
 #endif
 
+#include <ctime>
 #include <sstream>
 #include <fstream>
 #include <stdexcept>
 
-#include <shib/shib-threads.h>
 #include <xercesc/util/Base64.hpp>
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/util/NDC.h>
+#include <xmltooling/util/TemplateEngine.h>
 
 #ifndef HAVE_STRCASECMP
 # define strcasecmp stricmp
 #endif
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
 using namespace shibtarget;
+using namespace shibboleth;
+using namespace saml;
 using namespace log4cpp;
+using namespace std;
+
+using xmltooling::TemplateEngine;
+using xmltooling::XMLToolingException;
+using xmltooling::XMLToolingConfig;
 
 namespace shibtarget {
     class CgiParse
@@ -64,6 +71,35 @@ namespace shibtarget {
         multimap<string,char*> kvp_map;
     };
 
+    class ExtTemplateParameters : public TemplateEngine::TemplateParameters
+    {
+        const IPropertySet* m_props;
+    public:
+        ExtTemplateParameters() : m_props(NULL) {}
+        ~ExtTemplateParameters() {}
+
+        void setPropertySet(const IPropertySet* props) {
+            m_props = props;
+
+            // Create a timestamp.
+            time_t now = time(NULL);
+#ifdef HAVE_CTIME_R
+            char timebuf[32];
+            m_map["now"] = ctime_r(&now,timebuf);
+#else
+            m_map["now"] = ctime(&now);
+#endif
+        }
+
+        const char* getParameter(const char* name) const {
+            const char* pch = TemplateParameters::getParameter(name);
+            if (pch || !m_props)
+                return pch;
+            pair<bool,const char*> p = m_props->getString(name);
+            return p.first ? p.second : NULL;
+        }
+    };
+
     class ShibTargetPriv
     {
     public:
@@ -72,7 +108,7 @@ namespace shibtarget {
 
         // Helper functions
         void get_application(ShibTarget* st, const string& protocol, const string& hostname, int port, const string& uri);
-        void* sendError(ShibTarget* st, const char* page, ShibMLP &mlp);
+        void* sendError(ShibTarget* st, const char* page, ExtTemplateParameters& tp, const XMLToolingException* ex=NULL);
         void clearHeaders(ShibTarget* st);
     
     private:
@@ -120,7 +156,7 @@ void ShibTarget::init(
     )
 {
 #ifdef _DEBUG
-    saml::NDC ndc("init");
+    xmltooling::NDC ndc("init");
 #endif
 
     if (m_priv->m_app)
@@ -145,12 +181,12 @@ void ShibTarget::init(
 pair<bool,void*> ShibTarget::doCheckAuthN(bool handler)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("doCheckAuthN");
+    xmltooling::NDC ndc("doCheckAuthN");
 #endif
 
     const char* procState = "Request Processing Error";
     const char* targetURL = m_url.c_str();
-    ShibMLP mlp;
+    ExtTemplateParameters tp;
 
     try {
         if (!m_priv->m_app)
@@ -170,8 +206,8 @@ pair<bool,void*> ShibTarget::doCheckAuthN(bool handler)
                     return make_pair(true, sendRedirect(redirectURL));
                 }
                 else {
-                    mlp.insert("requestURL", m_url.substr(0,m_url.find('?')));
-                    return make_pair(true,m_priv->sendError(this,"ssl", mlp));
+                    tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+                    return make_pair(true,m_priv->sendError(this,"ssl", tp));
                 }
             }
         }
@@ -187,7 +223,7 @@ pair<bool,void*> ShibTarget::doCheckAuthN(bool handler)
             if (handler)
                 return doHandler();
             else
-                return pair<bool,void*>(true, returnOK());
+                return make_pair(true, returnOK());
         }
 
         // Three settings dictate how to proceed.
@@ -204,7 +240,7 @@ pair<bool,void*> ShibTarget::doCheckAuthN(bool handler)
 #else
                 (!authType.first || _stricmp(authType.second,"shibboleth")))
 #endif
-            return pair<bool,void*>(true,returnDecline());
+            return make_pair(true,returnDecline());
 
         // Fix for secadv 20050901
         m_priv->clearHeaders(this);
@@ -214,7 +250,7 @@ pair<bool,void*> ShibTarget::doCheckAuthN(bool handler)
         if (!session_id || !*session_id) {
             // No session.  Maybe that's acceptable?
             if ((!requireSession.first || !requireSession.second) && !requireSessionWith.first)
-                return pair<bool,void*>(true,returnOK());
+                return make_pair(true,returnOK());
 
             // No cookie, but we require a session. Initiate a new session using the indicated method.
             procState = "Session Initiator Error";
@@ -256,7 +292,7 @@ pair<bool,void*> ShibTarget::doCheckAuthN(bool handler)
                 // to fail when it can't locate anything to process the
                 // AuthType.  No session plus requireSession false means
                 // do not authenticate the user at this time.
-                return pair<bool,void*>(true, returnOK());
+                return make_pair(true, returnOK());
 
             // Try and cast down.
             SAMLException* base = &e;
@@ -286,34 +322,42 @@ pair<bool,void*> ShibTarget::doCheckAuthN(bool handler)
         // We're done.  Everything is okay.  Nothing to report.  Nothing to do..
         // Let the caller decide how to proceed.
         log(LogLevelDebug, "doCheckAuthN succeeded");
-        return pair<bool,void*>(false,NULL);
+        return make_pair(false,(void*)NULL);
     }
-    catch (SAMLException& e) {
-        mlp.insert(e);
+    catch (SAMLException& e) {                  // TODO: we're going to yank this handler...
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "session", tp));
+    }
+    catch (XMLToolingException& e) {
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "session", tp, &e));
     }
 #ifndef _DEBUG
     catch (...) {
-        mlp.insert("errorText", "Caught an unknown exception.");
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = "Caught an unknown exception.";
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "session", tp));
     }
 #endif
-
-    // If we get here then we've got an error.
-    mlp.insert("errorType", procState);
-    if (targetURL)
-        mlp.insert("requestURL", m_url.substr(0,m_url.find('?')));
-
-    return pair<bool,void*>(true,m_priv->sendError(this,"session", mlp));
 }
 
 pair<bool,void*> ShibTarget::doHandler(void)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("doHandler");
+    xmltooling::NDC ndc("doHandler");
 #endif
 
+    ExtTemplateParameters tp;
     const char* procState = "Shibboleth Handler Error";
     const char* targetURL = m_url.c_str();
-    ShibMLP mlp;
 
     try {
         if (!m_priv->m_app)
@@ -326,7 +370,7 @@ pair<bool,void*> ShibTarget::doHandler(void)
 
         // Make sure we only process handler requests.
         if (!strstr(targetURL,handlerURL))
-            return pair<bool,void*>(true, returnDecline());
+            return make_pair(true, returnDecline());
 
         const IPropertySet* sessionProps=m_priv->m_app->getPropertySet("Sessions");
         if (!sessionProps)
@@ -361,47 +405,55 @@ pair<bool,void*> ShibTarget::doHandler(void)
         if (hret.first)
             return hret;
        
-        throw SAMLException("Configured Shibboleth handler failed to process the request.");
+        throw XMLToolingException("Configured Shibboleth handler failed to process the request.");
     }
     catch (MetadataException& e) {
-        mlp.insert(e);
+        tp.m_map["errorText"] = e.what();
         // See if a metadata error page is installed.
         const IPropertySet* props=m_priv->m_app->getPropertySet("Errors");
         if (props) {
             pair<bool,const char*> p=props->getString("metadata");
             if (p.first) {
-                mlp.insert("errorType", procState);
+                tp.m_map["errorType"] = procState;
                 if (targetURL)
-                    mlp.insert("requestURL", targetURL);
-                return make_pair(true,m_priv->sendError(this,"metadata", mlp));
+                    tp.m_map["requestURL"] = targetURL;
+                return make_pair(true,m_priv->sendError(this, "metadata", tp));
             }
         }
+        throw;
     }
     catch (SAMLException& e) {
-        mlp.insert(e);
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "session", tp));
+    }
+    catch (XMLToolingException& e) {
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "session", tp, &e));
     }
 #ifndef _DEBUG
     catch (...) {
-        mlp.insert("errorText", "Caught an unknown exception.");
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = "Caught an unknown exception.";
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "session", tp));
     }
 #endif
-
-    // If we get here then we've got an error.
-    mlp.insert("errorType", procState);
-
-    if (targetURL)
-        mlp.insert("requestURL", m_url.substr(0,m_url.find('?')));
-
-    return make_pair(true,m_priv->sendError(this,"session", mlp));
 }
 
 pair<bool,void*> ShibTarget::doCheckAuthZ(void)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("doCheckAuthZ");
+    xmltooling::NDC ndc("doCheckAuthZ");
 #endif
 
-    ShibMLP mlp;
+    ExtTemplateParameters tp;
     const char* procState = "Authorization Processing Error";
     const char* targetURL = m_url.c_str();
 
@@ -423,7 +475,7 @@ pair<bool,void*> ShibTarget::doCheckAuthZ(void)
 #else
                 (!authType.first || _stricmp(authType.second,"shibboleth")))
 #endif
-            return pair<bool,void*>(true,returnDecline());
+            return make_pair(true,returnDecline());
 
         // Do we have an access control plugin?
         if (m_priv->m_settings.second) {
@@ -450,43 +502,50 @@ pair<bool,void*> ShibTarget::doCheckAuthZ(void)
             if (m_priv->m_settings.second->authorized(this,m_priv->m_cacheEntry)) {
                 // Let the caller decide how to proceed.
                 log(LogLevelDebug, "doCheckAuthZ: access control provider granted access");
-                return pair<bool,void*>(false,NULL);
+                return make_pair(false,(void*)NULL);
             }
             else {
                 log(LogLevelWarn, "doCheckAuthZ: access control provider denied access");
                 if (targetURL)
-                    mlp.insert("requestURL", targetURL);
-                return make_pair(true,m_priv->sendError(this, "access", mlp));
+                    tp.m_map["requestURL"] = targetURL;
+                return make_pair(true,m_priv->sendError(this, "access", tp));
             }
         }
         else
             return make_pair(true,returnDecline());
     }
     catch (SAMLException& e) {
-        mlp.insert(e);
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "access", tp));
+    }
+    catch (XMLToolingException& e) {
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "access", tp, &e));
     }
 #ifndef _DEBUG
     catch (...) {
-        mlp.insert("errorText", "Caught an unknown exception.");
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = "Caught an unknown exception.";
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "access", tp));
     }
 #endif
-
-    // If we get here then we've got an error.
-    mlp.insert("errorType", procState);
-
-    if (targetURL)
-        mlp.insert("requestURL", m_url.substr(0,m_url.find('?')));
-
-    return make_pair(true,m_priv->sendError(this, "access", mlp));
 }
 
 pair<bool,void*> ShibTarget::doExportAssertions(bool requireSession)
 {
 #ifdef _DEBUG
-    saml::NDC ndc("doExportAssertions");
+    xmltooling::NDC ndc("doExportAssertions");
 #endif
 
-    ShibMLP mlp;
+    ExtTemplateParameters tp;
     const char* procState = "Attribute Processing Error";
     const char* targetURL = m_url.c_str();
 
@@ -521,7 +580,7 @@ pair<bool,void*> ShibTarget::doExportAssertions(bool requireSession)
                if (requireSession)
                        throw InvalidSessionException("Unable to obtain session information for request.");
                else
-                       return pair<bool,void*>(false,NULL);    // just bail silently
+                       return make_pair(false,(void*)NULL);    // just bail silently
         }
         
         // Extract data from session.
@@ -620,24 +679,31 @@ pair<bool,void*> ShibTarget::doExportAssertions(bool requireSession)
             }
         }
     
-        return pair<bool,void*>(false,NULL);
+        return make_pair(false,(void*)NULL);
     }
     catch (SAMLException& e) {
-        mlp.insert(e);
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "rm", tp));
+    }
+    catch (XMLToolingException& e) {
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = e.what();
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "rm", tp, &e));
     }
 #ifndef _DEBUG
     catch (...) {
-        mlp.insert("errorText", "Caught an unknown exception.");
+        tp.m_map["errorType"] = procState;
+        tp.m_map["errorText"] = "Caught an unknown exception.";
+        if (targetURL)
+            tp.m_map["requestURL"] = m_url.substr(0,m_url.find('?'));
+        return make_pair(true,m_priv->sendError(this, "rm", tp));
     }
 #endif
-
-    // If we get here then we've got an error.
-    mlp.insert("errorType", procState);
-
-    if (targetURL)
-        mlp.insert("requestURL", m_url.substr(0,m_url.find('?')));
-
-    return make_pair(true,m_priv->sendError(this, "rm", mlp));
 }
 
 const char* ShibTarget::getRequestParameter(const char* param, size_t index) const
@@ -932,22 +998,26 @@ void ShibTargetPriv::get_application(ShibTarget* st, const string& protocol, con
   st->m_url += uri;
 }
 
-void* ShibTargetPriv::sendError(ShibTarget* st, const char* page, ShibMLP &mlp)
+void* ShibTargetPriv::sendError(
+    ShibTarget* st, const char* page, ExtTemplateParameters& tp, const XMLToolingException* ex
+    )
 {
     ShibTarget::header_t hdrs[] = {
         ShibTarget::header_t("Expires","01-Jan-1997 12:00:00 GMT"),
         ShibTarget::header_t("Cache-Control","private,no-store,no-cache")
         };
     
+    TemplateEngine* engine = XMLToolingConfig::getConfig().getTemplateEngine();
     const IPropertySet* props=m_app->getPropertySet("Errors");
     if (props) {
         pair<bool,const char*> p=props->getString(page);
         if (p.first) {
             ifstream infile(p.second);
-            if (!infile.fail()) {
-                const char* res = mlp.run(infile,props);
-                if (res)
-                    return st->sendPage(res, 200, "text/html", ArrayIterator<ShibTarget::header_t>(hdrs,2));
+            if (infile) {
+                tp.setPropertySet(props);
+                ostringstream ostr;
+                engine->run(infile, ostr, tp, ex);
+                return st->sendPage(ostr.str().c_str(), 200, "text/html", ArrayIterator<ShibTarget::header_t>(hdrs,2));
             }
         }
         else if (!strcmp(page,"access"))
index b5137cd..9cefe6e 100644 (file)
 #ifndef SHIB_TARGET_H
 #define SHIB_TARGET_H
 
+// New headers
+#include <saml/base.h>
+#include <xmltooling/PluginManager.h>
+
+// Old headers
 #include <saml/saml.h>
 #include <shib/shib.h>
-#include <shib/shib-threads.h>
 
 #ifdef WIN32
 # ifndef SHIBTARGET_EXPORTS
diff --git a/shib-target/shibrpc.h b/shib-target/shibrpc.h
deleted file mode 100644 (file)
index 21b2238..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Please do not edit this file.
- * It was generated using rpcgen.
- */
-
-#ifndef _SHIBRPC_H_RPCGEN
-#define _SHIBRPC_H_RPCGEN
-
-#include <rpc/rpc.h>
-
-#ifdef HAVE_PTHREAD
-# include <pthread.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-struct shibrpc_args_3 {
-       char *xml;
-};
-typedef struct shibrpc_args_3 shibrpc_args_3;
-
-struct shibrpc_ret_3 {
-       char *xml;
-};
-typedef struct shibrpc_ret_3 shibrpc_ret_3;
-
-#define SHIBRPC_PROG 123456
-#define SHIBRPC_VERS_3 3
-
-#if defined(__STDC__) || defined(__cplusplus)
-#define shibrpc_call 3
-extern  enum clnt_stat shibrpc_call_3(shibrpc_args_3 *, shibrpc_ret_3 *, CLIENT *);
-extern  bool_t shibrpc_call_3_svc(shibrpc_args_3 *, shibrpc_ret_3 *, struct svc_req *);
-extern int shibrpc_prog_3_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
-
-#else /* K&R C */
-#define shibrpc_call 3
-extern  enum clnt_stat shibrpc_call_3();
-extern  bool_t shibrpc_call_3_svc();
-extern int shibrpc_prog_3_freeresult ();
-#endif /* K&R C */
-
-/* the xdr functions */
-
-#if defined(__STDC__) || defined(__cplusplus)
-extern  bool_t xdr_shibrpc_args_3 (XDR *, shibrpc_args_3*);
-extern  bool_t xdr_shibrpc_ret_3 (XDR *, shibrpc_ret_3*);
-
-#else /* K&R C */
-extern bool_t xdr_shibrpc_args_3 ();
-extern bool_t xdr_shibrpc_ret_3 ();
-
-#endif /* K&R C */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !_SHIBRPC_H_RPCGEN */
index e0fd3ac..5be2eba 100644 (file)
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib wsock32.lib libeay32_0_9_8.lib ssleay32_0_9_8.lib"
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib saml_5.lib saml2.lib xmltooling1.lib wsock32.lib libeay32_0_9_8.lib ssleay32_0_9_8.lib"
                                OutputFile="Release/shibtarget_5.dll"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                ProgramDatabaseFile=".\Release/shibtarget_5.pdb"
                                ImportLibrary=".\Release/shibtarget_5.lib"
                                TargetMachine="1"
                        </FileConfiguration>
                </File>
                <File
-                       RelativePath="shib-mlp.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                                       Optimization="0"
-                                       AdditionalIncludeDirectories=""
-                                       PreprocessorDefinitions="_WINDOWS;WANT_TCP_SHAR;WIN32;_DEBUG;_MBCS;$(NoInherit)"
-                                       BasicRuntimeChecks="3"
-                                       BrowseInformation="1"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                                       Optimization="2"
-                                       AdditionalIncludeDirectories=""
-                                       PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;_MBCS;WANT_TCP_SHAR;$(NoInherit)"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
                        RelativePath="shib-target.cpp"
                        >
                        <FileConfiguration
diff --git a/shib-target/testini.cpp b/shib-target/testini.cpp
deleted file mode 100644 (file)
index 071af83..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "shib-target.h"
-#include <iostream>
-
-using namespace std;
-using namespace shibtarget;
-
-static void test (ShibINI &ini, const char* header)
-{
-  cout << "Testing Header: \"";
-  cout << header;
-  cout << "\"\tExists: ";
-  cout << (ini.exists (header) ? "Yes\n" : "No\n");
-}
-
-static void test (ShibINI &ini, const char* header, const char* tag)
-{
-  cout << "\t\"";
-  cout << header;
-  cout << ".";
-  cout << tag;
-  cout << "\"\tExists: ";
-  if (ini.exists (header, tag)) {
-    cout << "Yes\tValue: \"";
-    cout << ini.get (header, tag);
-    cout << "\"\n";
-  } else
-    cout << "No\n";
-}
-
-static void test_header_iter (ShibINI &ini)
-{
-  cout << "Test Header Iterator: ";
-  ShibINI::Iterator* iter = ini.header_iterator();
-  for (const string* str = iter->begin(); str; str = iter->next())
-    cout << "\"" << *str << "\" ";
-  cout << "\n";
-
-  delete iter;
-}
-
-static void test_tag_iter (ShibINI &ini, const char* header)
-{
-  string h = header;
-  cout << "Test Tag Iterator \"" << header << "\" : ";
-  ShibINI::Iterator* iter = ini.tag_iterator(h);
-  for (const string* str = iter->begin(); str; str = iter->next())
-    cout << "\"" << *str << "\" ";
-  cout << "\n";
-
-  delete iter;
-}
-
-static void run_test (ShibINI &ini)
-{
-  char* headers[] = { "test1", "", "header1", "Header1", "header2", "header2 " };
-  char* tags[] = { "test1", "test2", "test3", "test4", "test5", "TeSt5", "test 6" };
-
-  ini.dump(cout);
-
-  test_header_iter (ini);
-
-  for (int i = 0; i < sizeof(headers)/sizeof(*headers); i++) {
-    test (ini, headers[i]);
-
-    for (int j = 0; j < sizeof(tags)/sizeof(*tags); j++) 
-      test (ini, headers[i], tags[j]);
-
-    test_tag_iter (ini, headers[i]);
-  }
-
-}
-
-main()
-{
-  ShibINI ini("testini.ini");
-  run_test (ini);
-
-  ShibINI ini2("testini.ini", false);
-  run_test (ini2);
-}
diff --git a/shib-target/testinit.c b/shib-target/testinit.c
deleted file mode 100644 (file)
index 96197ec..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "shib-target.h"
-
-main()
-{
-  char* init = getenv("SHIBCONFIG");
-  char* app = getenv("SHIBTESTAPP");
-  shib_target_initialize((app ? app : "Test App"), init);
-}
diff --git a/shib-target/testlog.cpp b/shib-target/testlog.cpp
deleted file mode 100644 (file)
index d576976..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <log4cpp/Category.hh>
-#include <log4cpp/RemoteSyslogAppender.hh>
-#include <log4cpp/SyslogAppender.hh>
-
-#include <string>
-
-using namespace std;
-using namespace log4cpp;
-
-main()
-{
-  Category& log = Category::getRoot();
-
-  string name = "name";
-  string sysname = "sysname";
-  string relayer = "localhost";
-  RemoteSyslogAppender app(name, sysname, relayer, -1, -1);
-  log.setAppender(app);
-
-  log.error("Test Log Entry");
-
-  Category& syslog = Category::getInstance("test");
-  SyslogAppender sapp(name, sysname);
-  syslog.setAppender(sapp);
-
-  syslog.error("test Syslog entry");
-}
diff --git a/shib-target/testmlp.cpp b/shib-target/testmlp.cpp
deleted file mode 100644 (file)
index 47d0085..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "shib-target.h"
-#include <iostream>
-#include <fstream>
-
-using namespace std;
-using namespace shibtarget;
-
-main()
-{
-  ShibMLP mlp;
-
-  mlp.insert("key1", "variable 1");
-  mlp.insert("key2", "variable 2");
-
-  string input =
-    "This is a test <SHIBMLP key1/> of the emergency <Shibmlp    key2  />"
-    " broadcasting system. <ShIbMlP key3 />\n";
-    
-  cout << mlp.run(input);
-
-  ifstream inf("testmlp.html");
-  cout << mlp.run(inf);
-}
index f2c721e..66aff7a 100644 (file)
@@ -5,19 +5,18 @@ AUTOMAKE_OPTIONS = foreign
 lib_LTLIBRARIES = libshib.la
 
 libshibdir = $(includedir)/shib
-libshib_HEADERS = shib.h shib-threads.h hresult.h
+libshib_HEADERS = shib.h hresult.h
 noinst_HEADERS = internal.h
 
 libshib_la_SOURCES = \
-                                       BasicTrust.cpp \
-                    Constants.cpp \
-                    Metadata.cpp \
-                    ReloadableXMLFile.cpp \
-                    ShibbolethTrust.cpp \
-                    ShibConfig.cpp \
-                    ShibBrowserProfile.cpp \
-                    shib-threads.cpp \
-                    ScopedAttribute.cpp
+       BasicTrust.cpp \
+    Constants.cpp \
+    Metadata.cpp \
+    ReloadableXMLFile.cpp \
+    ShibbolethTrust.cpp \
+    ShibConfig.cpp \
+    ShibBrowserProfile.cpp \
+    ScopedAttribute.cpp
 
 
 # this is different from the project version
@@ -27,5 +26,5 @@ libshib_la_LDFLAGS = -version-info 6:0:0
 install-exec-hook:
        for la in $(lib_LTLIBRARIES) ; do rm -f $(DESTDIR)$(libdir)/$$la ; done
 
-EXTRA_DIST = shib.vcproj shib-threads-win32.cpp resource.h shib.rc
+EXTRA_DIST = shib.vcproj resource.h shib.rc
 
index d096932..9dd6dd8 100644 (file)
@@ -112,7 +112,7 @@ ReloadableXMLFile::ReloadableXMLFile(const DOMElement* e) : m_root(e), m_impl(NU
         if (stat(m_source.c_str(), &stat_buf) == 0)
 #endif
             m_filestamp=stat_buf.st_mtime;
-        m_lock=RWLock::create();
+        m_lock=xmltooling::RWLock::create();
     }
 }
 
index c31a7e0..96a7314 100644 (file)
 #define SHIB_INSTANTIATE
 
 #include "internal.h"
-#include "shib-threads.h"
 
 #include <openssl/err.h>
 
 using namespace saml;
 using namespace shibboleth;
+using namespace xmltooling;
 using namespace log4cpp;
 using namespace std;
 
diff --git a/shib/shib-threads-win32.cpp b/shib/shib-threads-win32.cpp
deleted file mode 100644 (file)
index 8a48dd6..0000000
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * shib-threads-win32.cpp -- an abstraction around win32 threads
- *
- * Created by: aaron wohl <xshib@awohl.com>
- *
- * $Id$
- */
-
-#ifdef STANDALONE_SHIBTHREADS_TESTING
-#include <windows.h>
-#else
-#include "internal.h"
-#endif
-
-#include "shib-threads.h"
-
-#ifndef WIN32
-#error "This implementaiton is just for windows 32"
-#endif
-
-#include <stdexcept>
-
-using namespace std;
-using namespace shibboleth;
-
-// base error code for a routine to return onf failure
-#define THREAD_ERROR_TIMEOUT   (1)
-#define THREAD_ERROR_WAKE_OTHER (2)
-#define THREAD_ERROR_
-#define THREAD_ERROR           (3)
-
-static void note_last_error(int rc) {
-    // set a breakpoint here to see windows error codes for failing
-    // thread operations
-}
-
-// windows returns non zero for sucess pthreads returns zero
-static int map_windows_error_status_to_pthreads(int rc) {
-  if(rc!=0)  // sucess?
-    return 0; // yes
-  int last_error=GetLastError();
-  note_last_error(last_error);
-  return THREAD_ERROR;
-}
-
-// win32 implementation of the Shib Target Threads API
-
-//
-// "Private" Implementation
-//
-
-// two levels of classes are needed here
-// in case InitializeCriticalSection
-// throws an exception we can keep from
-// calling the critical_section destructor
-// on unitilized data, or it could be done with a flag
-class critical_section_data {
-public:
-  CRITICAL_SECTION cs;
-  critical_section_data(){
-    InitializeCriticalSection(&cs);    
-  }
-};
-
-class critical_section {
-private:
-  critical_section_data        cse;
-public:
-  critical_section(){}
-  ~critical_section(){
-    DeleteCriticalSection (&cse.cs);
-  }
-  void enter(void) {
-    EnterCriticalSection(&cse.cs);
-  }
-  void leave(void) {
-    LeaveCriticalSection(&cse.cs);
-  }
-};
-
-// hold a critical section over the lifetime of this object
-// used to make a stack variable that unlocks automaticly
-// on return/throw
-class with_crit_section {
-private:
-  critical_section& cs;
-public:
-  with_crit_section(critical_section& acs):cs(acs){
-    cs.enter();
-  }
-  ~with_crit_section(){
-    cs.leave();
-  }
-};
-
-class ThreadImpl : public Thread {
-private:
-  HANDLE thread_id;
-public:
-  ThreadImpl(void* (*start_routine)(void*), void* arg):thread_id(0){
-        thread_id=CreateThread(
-      0, // security attributes
-      0, // use default stack size, maybe this should be setable
-     (LPTHREAD_START_ROUTINE ) start_routine,
-     arg,
-     0, // flags, default is ignore stacksize and dont create suspeneded which
-        // is what we want
-     0);
-  if(thread_id==0) {
-      int rc=map_windows_error_status_to_pthreads(0);
-         throw("thread create failed");
-  }
-  }
-
-  int detach() {
-    if(thread_id==0)
-      return THREAD_ERROR;
-    int rc=map_windows_error_status_to_pthreads(CloseHandle(thread_id));
-    thread_id=0;
-    return rc;
-  }
-  ~ThreadImpl() {
-    (void)detach();
-  }
-
-  int join(void** thread_return) {
-  if(thread_id==0)
-      return THREAD_ERROR;
-  if(thread_return!=0)
-    *thread_return=0;
-  int rc=WaitForSingleObject(thread_id,INFINITE);
-  switch(rc) {
-  case WAIT_OBJECT_0:
-      if (thread_return)
-           map_windows_error_status_to_pthreads(
-                 GetExitCodeThread(thread_id,(unsigned long *)thread_return));
-  default:
-    return THREAD_ERROR+1;
-  }
-  }
-  
-  int kill(int signo) {
-    if(thread_id==0)
-      return THREAD_ERROR;
-    return map_windows_error_status_to_pthreads(TerminateThread(thread_id,signo));
-  }
-
-};
-
-class MutexImpl : public Mutex {
-private:
-  HANDLE mhandle;
-public:
-  MutexImpl():mhandle(0){
-    mhandle=CreateMutex(0,false,0);
-    if(mhandle==0)
-      throw("CreateMutex for failed");
-  }
-  ~MutexImpl(){
-    if((mhandle!=0)&&(!CloseHandle(mhandle))) 
-      throw("CloseHandle for CondWaitImpl failed");
-  }
-  int lock() {
-   int rc=WaitForSingleObject(mhandle,INFINITE);
-   switch(rc) {
-     case WAIT_ABANDONED:
-     case WAIT_OBJECT_0:
-       return 0;
-     default:
-       return map_windows_error_status_to_pthreads(0);
-   }
-  }
-  int unlock() {
-    return map_windows_error_status_to_pthreads(ReleaseMutex(mhandle));
-  }
-};
-
-class CondWaitImpl : public CondWait {
-  private:
-    HANDLE cond;
-
-  public:
-    CondWaitImpl():cond(CreateEvent(0,false,false,0)){
-      if(cond==0)
-       throw("CreateEvent for CondWaitImpl failed");
-    };
-
-  ~CondWaitImpl() {
-    if((cond!=0)&&(!CloseHandle(cond))) 
-      throw("CloseHandle for CondWaitImpl failed");
-  }
-
-  int wait(Mutex* mutex) {
-    return timedwait(mutex,INFINITE);
-  }
-
-  int signal() {
-    if(!SetEvent(cond))
-     return map_windows_error_status_to_pthreads(0);
-    return 0;
-  }
-  int broadcast() {
-    throw("CondWaitImpl not implemented on win32");
-  }
-
-  // wait for myself to signal and this mutex or the timeout
-  int timedwait(Mutex* mutex, int delay_seconds) {
-    int rc=mutex->unlock();
-    if(rc!=0)
-      return rc;
-
-    int delay_ms=delay_seconds;
-    if(delay_seconds!=INFINITE)
-      delay_ms*=1000;
-    rc=WaitForSingleObject(cond,delay_ms);
-    {
-      int rc2=mutex->lock();
-      if(rc2!=0)
-        return rc2;
-    }
-    switch(rc) {
-    case WAIT_ABANDONED:
-    case WAIT_OBJECT_0:
-    case WAIT_TIMEOUT:
-      return 0;
-    default:
-      return map_windows_error_status_to_pthreads(0);
-    }
-    return 0;
-  }
-};
-
-class RWLockImpl : public RWLock {
-private:
-  // used to protect read or write to the data below
-  critical_section cs;
-  // event handle threads wait on when the lock they want is busy
-  // normaly set to signaled all the time, if some thread cant get what
-  // they want they reset it and sleep.  on releasing a lock set it to
-  // signaled if someone may have wanted what you just released
-  HANDLE wake_waiters;
-  // number of threads holding a read lock
-  int num_readers;
-  // true iff there a writer has our lock
-  bool have_writer;
-
-public:
-  RWLockImpl():wake_waiters(0),num_readers(0),have_writer(true) {
-    with_crit_section acs(cs);
-    wake_waiters=CreateEvent(0,true,true,0);
-    have_writer=false;
-    if(wake_waiters==0)
-      throw("CreateEvent for RWLockImpl failed");
-  }
-  ~RWLockImpl() { 
-     with_crit_section acs(cs);
-     if((wake_waiters!=0)&&(!CloseHandle(wake_waiters))) 
-       throw("CloseHandle for RWLockImpl failed");
-     wake_waiters=0;
-   }
-
-  int rdlock() {
-    while(1) {
-     // wait for the lock maybe being availible
-     // we will find out for sure inside the critical section
-     if(WaitForSingleObject(wake_waiters,INFINITE)!=WAIT_OBJECT_0) 
-       return map_windows_error_status_to_pthreads(0);
-     {
-       with_crit_section alock(cs);
-      // invariant not locked for reading and writing
-       if((num_readers!=0)&&(have_writer))
-              return THREAD_ERROR;
-       // if no writer we can join any existing readers
-       if(!have_writer) {
-         num_readers++;
-        return 0;
-       }
-       // have a writer, mark the syncronization object
-       // so everyone waits, when the writer unlocks it will wake us
-       if(!ResetEvent(wake_waiters))
-         return map_windows_error_status_to_pthreads(0);
-     }
-    }
-    return THREAD_ERROR+2;
-  }
-
-  int wrlock() {
-    while(1) {
-    // wait for the lock maybe being availible
-    // we will find out for sure inside the critical section
-    if(WaitForSingleObject(wake_waiters,INFINITE)!=WAIT_OBJECT_0) 
-      return map_windows_error_status_to_pthreads(0);
-    {
-     with_crit_section bla(cs);
-    // invariant not locked for reading and writing
-     if((num_readers!=0)&&(have_writer))
-            return THREAD_ERROR;
-     // if no writer and no readers we can become the writer
-    if((num_readers==0)&&(!have_writer)) {
-      have_writer=true;
-      return 0;
-     }
-     // lock is busy, the unlocker will wake us
-     if(!ResetEvent(wake_waiters))
-       return map_windows_error_status_to_pthreads(0);
-    }
-    }
-    return THREAD_ERROR+2;
-  }
-
-  int unlock() {
-    with_crit_section mumble(cs);
-    // invariant not locked for reading and writing
-    if((num_readers!=0)&&(have_writer))
-      return THREAD_ERROR;
-    // error if nothing locked
-    if((num_readers==0)&&(!have_writer))
-      return THREAD_ERROR+1;
-    // if there was a writer it has to be us so unlock write lock 
-    have_writer=false;
-    // if there where any reades there is one less now
-    if(num_readers>0)
-      num_readers--;
-    // if no readers left wake up any readers/writers waiting
-    // to have a go at it
-    if(num_readers==0)
-      if(!SetEvent(wake_waiters))
-         return map_windows_error_status_to_pthreads(0);
-    return 0;
-  }
-};
-
-typedef void (*destroy_hook_type)(void*);
-
-class ThreadKeyImpl : public ThreadKey {
-private:
-  destroy_hook_type destroy_hook;
-  DWORD key;
-
-public:
-  ThreadKeyImpl(void (*destroy_fcn)(void*)) : destroy_hook(destroy_fcn) { key=TlsAlloc(); };
-  virtual ~ThreadKeyImpl() { if (destroy_hook) destroy_hook(TlsGetValue(key)); TlsFree(key); }
-
-  int setData(void* data) { TlsSetValue(key,data); return 0;}
-  void* getData() { return TlsGetValue(key); }
-  };
-
-//
-// public "static" creation functions
-//
-
-void Thread::mask_all_signals(void)
-{
-}
-
-Thread* Thread::create(void* (*start_routine)(void*), void* arg)
-{
-  return new ThreadImpl(start_routine, arg);
-}
-
-void Thread::exit(void* return_val)
-{
-  ExitThread((DWORD)return_val);
-}
-
-Mutex * Mutex::create()
-{
-  return new MutexImpl();
-}
-
-CondWait * CondWait::create()
-{
-  return new CondWaitImpl();
-}
-
-RWLock * RWLock::create()
-{
-  return new RWLockImpl();
-}
-
-ThreadKey* ThreadKey::create (void (*destroy_fcn)(void*))
-{
-  return new ThreadKeyImpl(destroy_fcn);
-}
diff --git a/shib/shib-threads.cpp b/shib/shib-threads.cpp
deleted file mode 100644 (file)
index db98d76..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * shib-threads.cpp -- an abstraction around Pthreads
- *
- * Created by: Derek Atkins <derek@ihtfp.com>
- *
- * $Id: shib-threads.cpp,v 1.5 2003/01/30 15:18:36 warlord Exp $
- */
-
-#include "internal.h"
-#include "shib-threads.h"
-
-#include <log4cpp/Category.hh>
-
-#ifdef HAVE_PTHREAD
-#include <pthread.h>
-#ifndef HAVE_PTHREAD_RWLOCK_INIT
-#include <synch.h>
-#endif
-#else
-#error "You need to create the proper thread implementation"
-#endif
-
-#include <stdexcept>
-
-using namespace std;
-using namespace shibboleth;
-using namespace log4cpp;
-
-// pthread implementation of the Shib Target Threads API
-
-//
-// "Private" Implementation
-//
-
-class ThreadImpl : public Thread {
-public:
-  ThreadImpl(void* (*start_routine)(void*), void* arg);
-  ~ThreadImpl() {}
-
-  int detach() { return pthread_detach(thread_id); }
-  int join(void** thread_return) { return pthread_join(thread_id, thread_return); }
-  int kill(int signo) { return pthread_kill(thread_id, signo); }
-
-  pthread_t    thread_id;
-};
-
-class MutexImpl : public Mutex {
-public:
-  MutexImpl();
-  ~MutexImpl() { pthread_mutex_destroy (&mutex); }
-
-  int lock() { return pthread_mutex_lock (&mutex); }
-  int unlock() { return pthread_mutex_unlock (&mutex); }
-
-  pthread_mutex_t mutex;
-};
-
-class CondWaitImpl : public CondWait {
-public:
-  CondWaitImpl();
-  ~CondWaitImpl() { pthread_cond_destroy (&cond); }
-
-  int wait(Mutex* mutex) { return wait (dynamic_cast<MutexImpl*>(mutex)); }
-  int wait(MutexImpl* mutex) { return pthread_cond_wait (&cond, &(mutex->mutex)); }
-  int timedwait(Mutex* mutex, int delay_seconds)
-       { return timedwait (dynamic_cast<MutexImpl*>(mutex), delay_seconds); }
-  int timedwait(MutexImpl* mutex, int delay_seconds) {
-    struct timespec ts;
-    memset (&ts, 0, sizeof(ts));
-    ts.tv_sec = time(NULL) + delay_seconds;
-    return pthread_cond_timedwait (&cond, &(mutex->mutex), &ts);
-  }
-  int signal() { return pthread_cond_signal (&cond); }
-  int broadcast() { return pthread_cond_broadcast (&cond); }
-
-  pthread_cond_t cond;
-};
-
-class RWLockImpl : public RWLock {
-public:
-#ifdef HAVE_PTHREAD_RWLOCK_INIT
-  RWLockImpl();
-  ~RWLockImpl() { pthread_rwlock_destroy (&lock); }
-
-  int rdlock() { return pthread_rwlock_rdlock (&lock); }
-  int wrlock() { return pthread_rwlock_wrlock (&lock); }
-  int unlock() { return pthread_rwlock_unlock (&lock); }
-
-  pthread_rwlock_t lock;
-#else
-  RWLockImpl();
-  ~RWLockImpl() { rwlock_destroy (&lock); }
-
-  int rdlock() { return rw_rdlock (&lock); }
-  int wrlock() { return rw_wrlock (&lock); }
-  int unlock() { return rw_unlock (&lock); }
-
-  rwlock_t lock;
-#endif
-};
-
-class ThreadKeyImpl : public ThreadKey {
-public:
-  ThreadKeyImpl(void (*destroy_fcn)(void*));
-  ~ThreadKeyImpl() { pthread_key_delete (key); }
-
-  int setData(void* data) { return pthread_setspecific (key,data); }
-  void* getData() { return pthread_getspecific (key); }
-
-  pthread_key_t key;
-};
-
-//
-// Constructor Implementation follows...
-//
-
-ThreadImpl::ThreadImpl(void* (*start_routine)(void*), void* arg)
-{
-    int rc=pthread_create(&thread_id, NULL, start_routine, arg);
-    if (rc) {
-#ifdef HAVE_STRERROR_R
-        char buf[256];
-        strerror_r(rc,buf,sizeof(buf));
-        buf[255]=0;
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_create error (%d): %s",rc,buf);
-#else
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_create error (%d): %s",rc,strerror(rc));
-#endif
-        throw rc;
-    }
-}
-
-MutexImpl::MutexImpl()
-{
-    int rc=pthread_mutex_init(&mutex, NULL);
-    if (rc) {
-#ifdef HAVE_STRERROR_R
-        char buf[256];
-        strerror_r(rc,buf,sizeof(buf));
-        buf[255]=0;
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_mutex_init error (%d): %s",rc,buf);
-#else
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_mutex_init error (%d): %s",rc,strerror(rc));
-#endif
-        throw rc;
-    }
-}
-
-CondWaitImpl::CondWaitImpl()
-{
-    int rc=pthread_cond_init(&cond, NULL);
-    if (rc) {
-#ifdef HAVE_STRERROR_R
-        char buf[256];
-        strerror_r(rc,buf,sizeof(buf));
-        buf[255]=0;
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_cond_init error (%d): %s",rc,buf);
-#else
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_cond_init error (%d): %s",rc,strerror(rc));
-#endif
-        throw rc;
-    }
-}
-
-RWLockImpl::RWLockImpl()
-{
-#ifdef HAVE_PTHREAD_RWLOCK_INIT
-    int rc=pthread_rwlock_init(&lock, NULL);
-#else
-    int rc=rwlock_init(&lock, USYNC_THREAD, NULL);
-#endif
-    if (rc) {
-#ifdef HAVE_STRERROR_R
-        char buf[256];
-        strerror_r(rc,buf,sizeof(buf));
-        buf[255]=0;
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_rwlock_init error (%d): %s",rc,buf);
-#else
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_rwlock_init error (%d): %s",rc,strerror(rc));
-#endif
-        throw rc;
-    }
-}
-
-ThreadKeyImpl::ThreadKeyImpl(void (*destroy_fcn)(void*))
-{
-    int rc=pthread_key_create(&key, destroy_fcn);
-    if (rc) {
-#ifdef HAVE_STRERROR_R
-        char buf[256];
-        strerror_r(rc,buf,sizeof(buf));
-        buf[255]=0;
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_key_create error (%d): %s",rc,buf);
-#else
-        Category::getInstance(SHIB_LOGCAT".threads").error("pthread_key_create error (%d): %s",rc,strerror(rc));
-#endif
-        throw rc;
-    }
-}
-
-//
-// public "static" creation functions
-//
-
-Thread* Thread::create(void* (*start_routine)(void*), void* arg)
-{
-  return new ThreadImpl(start_routine, arg);
-}
-
-void Thread::exit(void* return_val)
-{
-  pthread_exit (return_val);
-}
-    
-void Thread::mask_all_signals(void)
-{
-  sigset_t sigmask;
-  sigfillset(&sigmask);
-  Thread::mask_signals(SIG_BLOCK, &sigmask, NULL);
-}
-
-int Thread::mask_signals(int how, const sigset_t *newmask, sigset_t *oldmask)
-{
-  return pthread_sigmask(how,newmask,oldmask);
-}
-
-Mutex * Mutex::create()
-{
-  return new MutexImpl();
-}
-
-CondWait * CondWait::create()
-{
-  return new CondWaitImpl();
-}
-
-RWLock * RWLock::create()
-{
-  return new RWLockImpl();
-}
-
-ThreadKey* ThreadKey::create (void (*destroy_fcn)(void*))
-{
-  return new ThreadKeyImpl(destroy_fcn);
-}
diff --git a/shib/shib-threads.h b/shib/shib-threads.h
deleted file mode 100644 (file)
index 35f423b..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *  Copyright 2001-2005 Internet2
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * shib-threads.h -- abstraction around Pthreads interface
- *
- * Created by: Derek Atkins <derek@ihtfp.com>
- *
- * $Id: shib-threads.h,v 1.6 2003/01/30 15:18:36 warlord Exp $
- */
-
-#ifndef SHIB_THREADS_H
-#define SHIB_THREADS_H
-
-#ifdef WIN32
-# ifndef SHIB_EXPORTS
-#  define SHIB_EXPORTS __declspec(dllimport)
-# endif
-#else
-# define SHIB_EXPORTS
-#endif
-
-#ifdef __cplusplus
-
-#include <time.h>
-#include <signal.h>
-
-namespace shibboleth {
-
-  //
-  // core thread objects
-  //
-
-  class SHIB_EXPORTS Thread {
-  public:
-    static Thread* create(void* (*start_routine)(void*), void* arg);
-    static void exit(void* return_val);
-    static void mask_all_signals(void);
-#ifndef WIN32
-    static int mask_signals(int how, const sigset_t *newmask, sigset_t *oldmask);
-#endif
-    virtual int detach() = 0;
-    virtual int join(void** thread_return) = 0;
-    virtual int kill(int signo) = 0;
-    virtual ~Thread(){};
-  };
-
-  class SHIB_EXPORTS Mutex {
-  public:
-    static Mutex* create();
-
-    virtual int lock() = 0;
-    virtual int unlock() = 0;
-    virtual ~Mutex(){};
-  };
-
-  class SHIB_EXPORTS CondWait {
-  public:
-    static CondWait* create();
-
-    virtual int wait(Mutex*) = 0;
-    virtual int timedwait(Mutex*,int delay_seconds) = 0;
-    virtual int signal() = 0;
-    virtual int broadcast() = 0;
-    virtual ~CondWait(){};
-  };
-
-  class SHIB_EXPORTS RWLock {
-  public:
-    static RWLock* create();
-
-    virtual int rdlock() = 0;
-    virtual int wrlock() = 0;
-    virtual int unlock() = 0;
-    virtual ~RWLock(){};
-  };
-
-  class SHIB_EXPORTS ThreadKey {
-  public:
-    static ThreadKey* create(void (*destroy_fcn)(void*));
-
-    virtual int setData(void* data) = 0;
-    virtual void* getData() = 0;
-    virtual ~ThreadKey(){};
-  };
-
-  //
-  // Helper classes.
-  //
-
-  class SHIB_EXPORTS Lock {
-  public:
-    Lock(Mutex* mtx) : mutex(mtx) { mutex->lock(); }
-    ~Lock() { mutex->unlock(); }
-
-  private:
-    Lock(const Lock&);
-    void operator=(const Lock&);
-    Mutex* mutex;
-  };
-
-  class SHIB_EXPORTS ReadLock {
-  public:
-    ReadLock(RWLock* lock) : rwlock(lock) { rwlock->rdlock(); }
-    ~ReadLock() { rwlock->unlock(); }
-
-  private:
-    ReadLock(const ReadLock&);
-    void operator=(const ReadLock&);
-    RWLock* rwlock;
-  };
-
-} // namespace
-
-#endif /* __cplusplus */
-#endif /* SHIB_THREADS_H */
index 04ead26..97e9994 100644 (file)
@@ -25,8 +25,9 @@
 #ifndef __shib_h__
 #define __shib_h__
 
+#include <xmltooling/util/Threads.h>
+
 #include <saml/saml.h>
-#include <shib/shib-threads.h>
 #include <xsec/xenc/XENCEncryptionMethod.hpp>
 
 #ifdef WIN32
@@ -538,7 +539,7 @@ namespace shibboleth
         const DOMElement* m_root;
         std::string m_source;
         time_t m_filestamp;
-        RWLock* m_lock;
+        xmltooling::RWLock* m_lock;
     };
 
     /* These helpers attach metadata-derived information as exception properties and then
index c2211c6..644994e 100644 (file)
@@ -48,7 +48,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,.,..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="libeay32_0_9_8.lib ssleay32_0_9_8.lib log4cpp.lib xerces-c_2.lib xsec_1.lib saml_5.lib"
+                               AdditionalDependencies="libeay32_0_9_8.lib ssleay32_0_9_8.lib log4cpp.lib xerces-c_2.lib xsec_1.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile="Release/shib_6.dll"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                ProgramDatabaseFile=".\Release/shib_6.pdb"
                                ImportLibrary=".\Release/shib_6.lib"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;.;..\..\cpp-opensaml1"
+                               AdditionalIncludeDirectories=".;..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="libeay32_0_9_8D.lib ssleay32_0_9_8D.lib log4cppD.lib xerces-c_2D.lib xsec_1D.lib saml_5D.lib"
+                               AdditionalDependencies="libeay32_0_9_8D.lib ssleay32_0_9_8D.lib log4cppD.lib xerces-c_2D.lib xsec_1D.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile="Debug/shib_6D.dll"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\Debug/shib_6D.lib"
                                TargetMachine="1"
                        </FileConfiguration>
                </File>
                <File
-                       RelativePath="shib-threads-win32.cpp"
-                       >
-                       <FileConfiguration
-                               Name="Release|Win32"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                                       Optimization="2"
-                                       AdditionalIncludeDirectories=""
-                                       PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_MBCS;$(NoInherit)"
-                               />
-                       </FileConfiguration>
-                       <FileConfiguration
-                               Name="Debug|Win32"
-                               >
-                               <Tool
-                                       Name="VCCLCompilerTool"
-                                       Optimization="0"
-                                       AdditionalIncludeDirectories=""
-                                       PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;_MBCS;$(NoInherit)"
-                                       BasicRuntimeChecks="3"
-                                       BrowseInformation="1"
-                               />
-                       </FileConfiguration>
-               </File>
-               <File
-                       RelativePath="shib-threads.h"
-                       >
-               </File>
-               <File
                        RelativePath="shib.h"
                        >
                </File>
diff --git a/shib/shibthreadswin32test/ReadMe.txt b/shib/shibthreadswin32test/ReadMe.txt
deleted file mode 100644 (file)
index d8190fd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-shibthreadswin32test.cpp by Aaron Wohl xshib@awohl.com
-
-shibthreadswin32test.cpp tests each of the operations defined in 
-shib-threads.h.  With different #include files it would probably
-work on unix.
diff --git a/shib/shibthreadswin32test/shibthreadswin32test.cpp b/shib/shibthreadswin32test/shibthreadswin32test.cpp
deleted file mode 100644 (file)
index 64de514..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-// shibthreadswin32test.cpp : by Aaron Wohl xshib@awohl.com.
-//
-
-#ifdef RUBBISH
-CondWait broadcast is not implemented on win32. The semantics are different for
-broadcast like events on win32.  If waking multiple waiters is needed then
-need to think about it.
-   
-CondWait lock realease/wake up/lock get are not atomic on win32.  I dont think
-that matters the way its used.  On wake up CondWait waits for the condition event or timeout.  After wake up it locks the mutex again.  Its not guarenteed that the one process that was signaled is the one that gets the lock next.
-#endif
-
-#include "stdafx.h"
-#include "shib-threads.h"
-#include "windows.h"
-#include <list>
-#include <iostream>
-
-using namespace shibboleth;
-using namespace std;
-
-#define ASSERT(xxx) \
-do { \
-if(!(xxx)) { \
-       fprintf(stderr,"assert failed " #xxx); \
-        do_exit(1); \
-} \
-}while (0)
-
-static volatile int basic_loop_count;
-#define NUM_BASIC_LOOP (100)
-
-static do_exit(int rc)
-{
-  char ch;
-  cout << "press a key to exit" << endl;
-  cout << "exit code is " << rc << " (0 is good)" << endl;
-  cin >> ch;
-  exit(rc);
-}
-
-static void *basic_loop_thread(void *x)
-{
-  for(int i=0;i<NUM_BASIC_LOOP;i++)
-    basic_loop_count++;
-  return 0;
-}
-
-static void test_basic_loop(void)
-{
-  Thread *athr=Thread::create(&basic_loop_thread,0);
-  ASSERT(athr!=0);
-  void *return_val;
-  athr->join(&return_val);
-  ASSERT(basic_loop_count==NUM_BASIC_LOOP);
-}
-
-static RWLock *arwlock;
-
-static int roll(int n)
-{
-  return rand() % n;
-}
-
-static int shared_count;
-#define NUM_READERS (3)
-static volatile bool in_readern[NUM_READERS];
-
-static void check_shared(void)
-{
-  int share_count=0;
-  for(int i=0;i<NUM_READERS;i++)
-    if(in_readern[i])
-      share_count++;
-  ASSERT(share_count>0);
-  ASSERT(share_count<=NUM_READERS);
-  if(share_count>1)
-    shared_count++;
-}
-
-static int num_keys_disposed;
-
-static void key_test_fcn(void *x)
-{
-  num_keys_disposed++;
-}
-
-static void *lock_reader(void *x)
-{
-  int locker_num=int(x);
-  ThreadKey *akey=ThreadKey::create(key_test_fcn);
-  ASSERT(akey!=0);
-  akey->setData(x);
-  for(int i=0;i<NUM_BASIC_LOOP;i++) {
-    ASSERT(arwlock->rdlock()==0);
-    in_readern[locker_num]=true;
-    Sleep(roll(500));
-    // make sure the thread local storage really is thread local
-    // if its not some other reader will trash it
-    ASSERT(akey->getData()==x);
-    check_shared();
-    in_readern[locker_num]=false;
-    ASSERT(arwlock->unlock()==0);
-    Sleep(roll(500));
-  }
-  delete akey;
-  return 0;
-}
-
-static void *lock_writer(void *y)
-{
- for(int i=0;i<NUM_BASIC_LOOP;i++) {
-  ASSERT(arwlock->wrlock()==0);
-  Sleep(roll(500));
-  ASSERT(arwlock->unlock()==0);
-  Sleep(roll(500));
-  }
- return 0;
-}
-
-static void test_rwlock()
-{
- arwlock=RWLock::create();
- {
-  bool cant_unlock_an_unlocked_lock=(arwlock->unlock()!=0);
-  ASSERT(cant_unlock_an_unlocked_lock);
- }
- list<Thread*> tl;
- for(int i=0;i<NUM_READERS;i++) {
-   Thread *athr=Thread::create(&lock_reader,(void *)i);
-   tl.push_back(athr);
-   ASSERT(athr!=0);
-   Thread *athw=Thread::create(&lock_writer,0);
-   ASSERT(athw!=0);
-   tl.push_back(athw);
- }
- while(!tl.empty()) {
-    Thread *some_thread=tl.front();
-    void *return_val;
-    some_thread->join(&return_val);
-    tl.pop_front();
- }
- delete arwlock;
- ASSERT(num_keys_disposed==NUM_READERS);
-}
-
-static void *empty_thread(void *x)
-{
-  return 0;
-}
-
-static void test_detach(void)
-{
-  Thread *ath=Thread::create(empty_thread,0);
-  ASSERT(ath->detach()==0);
-  // cant detch or join after already detach
-  ASSERT(ath->detach()!=0);
-  void *return_val;
-  ASSERT(ath->join(&return_val)!=0);
-  ASSERT(ath->detach()!=0);
-  delete ath;
-}
-
-static int in_kill_proc;
-
-static void *kill_me(void *x)
-{
-  while(1) {
-    in_kill_proc++;
-    Sleep(5);
-  }
-  return 0;
-}
-
-static void test_kill(void)
-{
-  Thread *ath=Thread::create(kill_me,0);
-  while(in_kill_proc<3)
-    Sleep(5);
-
-  ASSERT(ath->kill(23)==0);
-  delete ath;
-}
-
-static void test_detach_kill(void)
-{
-  test_detach();
-  test_kill();
-}
-
-static void test_cond_timeout(void)
-{
-  Mutex *m=Mutex::create();
-  ASSERT(m!=0);
-  CondWait *cw=CondWait::create();  
-  ASSERT(cw!=0);
-  ASSERT(m->lock()==0);
-  time_t start_time=time(0L);
-#define DELAY_TIME (7)
-  ASSERT(cw->timedwait(m,DELAY_TIME)==0);
-  int slept_for=time(0L)-start_time;
-  ASSERT(m->unlock()==0);
-  delete cw;
-  delete m;
-  int delta_time=abs(DELAY_TIME-slept_for);
-  if(delta_time>2)
-    do_exit(1);
-  cout << "CondWait: timed test ok" << endl;
-}
-
-
-static int cond_counter;
-static CondWait *cond_wait;
-
-static void *cond_incrementer(void *x)
-{
-  Mutex *cm=(Mutex *)(x);
-  for(int i=0;i<NUM_BASIC_LOOP;i++) {
-    ASSERT(cm->lock()==0);
-    cond_counter++;
-    if(cond_counter==(NUM_BASIC_LOOP+NUM_BASIC_LOOP/2))
-      ASSERT(cond_wait->signal()==0);
-    ASSERT(cm->lock()==0);
-  }
-  return 0;
-}
-
-static void test_cond_signal(void)
-{
-  Mutex *cm=Mutex::create();
-  ASSERT(cm!=0);
-  ASSERT(cm->lock()==0);
-  cond_wait=CondWait::create();
-  list<Thread*> tl;
-  for(int i=0;i<2;i++) {
-    Thread *athr=Thread::create(&cond_incrementer,(void *)cm);
-    tl.push_back(athr);
-    ASSERT(athr!=0);
-  }
-  ASSERT(cond_wait->wait(cm)==0);
-  ASSERT(cm->unlock()==0);
-  while(!tl.empty()) {
-    Thread *some_thread=tl.front();
-    void *return_val;
-    some_thread->join(&return_val);
-    tl.pop_front();
-  }
-  delete cond_wait;
-  delete cm;
-  cout << "CondWait: signal test ok" << endl;
-}
-
-static void test_cond_wait(void)
-{
-  test_cond_timeout();
-  test_cond_signal();
-}
-
-static void protected_run_tests(void)
-{
-  test_cond_wait();
-  test_detach_kill();
-  test_basic_loop();
-  test_rwlock();
-}
-
-static void run_tests(void)
-{
-       try {
-               protected_run_tests();
-       } catch (char *s) {
-               cout << "caught error" << s << endl;
-               do_exit(1);
-       } catch (...) {
-               cout << "caught unknown error" << endl;
-               do_exit(1);
-       }
-
-}
-
-int main(int argc, char* argv[])
-{
-  cout << "testing shib-threads, will take like 5min, look for an ok at the end\n";
-  run_tests();
-  cout << "tests done\n";
-  cout << "readers shared " << shared_count << " times (0 shares is bad)" << endl;
-  if(shared_count<1)
-    do_exit(1);
-  do_exit(0);
-  return 0;
-}
-
diff --git a/shib/shibthreadswin32test/shibthreadswin32test.dsp b/shib/shibthreadswin32test/shibthreadswin32test.dsp
deleted file mode 100644 (file)
index d26e3a7..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-# Microsoft Developer Studio Project File - Name="shibthreadswin32test" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=shibthreadswin32test - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "shibthreadswin32test.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "shibthreadswin32test.mak" CFG="shibthreadswin32test - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "shibthreadswin32test - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "shibthreadswin32test - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "shibthreadswin32test - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "shibthreadswin32test - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 2
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ  /c
-# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".." /I "../.." /I "../../../../opensaml/c" /I "../../../../xerces-c2_2_0-win32/include" /I "../../../../xml-security-0.2.0/include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_AFXDLL" /D "STANDALONE_SHIBTHREADS_TESTING" /YX"pre_header" /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "shibthreadswin32test - Win32 Release"
-# Name "shibthreadswin32test - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE="..\shib-threads-win32.cpp"
-
-!IF  "$(CFG)" == "shibthreadswin32test - Win32 Release"
-
-!ELSEIF  "$(CFG)" == "shibthreadswin32test - Win32 Debug"
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\shibthreadswin32test.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Source File
-
-SOURCE=.\ReadMe.txt
-# End Source File
-# End Target
-# End Project
diff --git a/shib/shibthreadswin32test/shibthreadswin32test.dsw b/shib/shibthreadswin32test/shibthreadswin32test.dsw
deleted file mode 100644 (file)
index 1d46ecd..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "shibthreadswin32test"=.\shibthreadswin32test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/shib/shibthreadswin32test/stdafx.cpp b/shib/shibthreadswin32test/stdafx.cpp
deleted file mode 100644 (file)
index 89f7d25..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// stdafx.cpp : source file that includes just the standard includes
-//     shibthreadswin32test.pch will be the pre-compiled header
-//     stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/shib/shibthreadswin32test/stdafx.h b/shib/shibthreadswin32test/stdafx.h
deleted file mode 100644 (file)
index 33b83c1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// stdafx.h : include file for standard system include files,
-//  or project specific include files that are used frequently, but
-//      are changed infrequently
-//
-
-#if !defined(AFX_STDAFX_H__8671ECDA_FBD6_4D11_B85A_B7E12AC1C646__INCLUDED_)
-#define AFX_STDAFX_H__8671ECDA_FBD6_4D11_B85A_B7E12AC1C646__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#define xWIN32_LEAN_AND_MEAN           // Exclude rarely-used stuff from Windows headers
-
-#include <stdio.h>
-
-// TODO: reference additional headers your program requires here
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_STDAFX_H__8671ECDA_FBD6_4D11_B85A_B7E12AC1C646__INCLUDED_)
index 5e67826..635b3b7 100644 (file)
@@ -44,7 +44,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories="..,..\..\cpp-opensaml1;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="xerces-c_2.lib saml_5.lib"
+                               AdditionalDependencies="xerces-c_2.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile=".\Release/shibtest.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Release;..\..\cpp-opensaml2\Release;..\..\cpp-xmltooling\Release"
                                ProgramDatabaseFile=".\Release/shibtest.pdb"
                                SubSystem="1"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="xerces-c_2D.lib saml_5D.lib"
+                               AdditionalDependencies="xerces-c_2D.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile=".\Debug/shibtest.exe"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug;..\..\cpp-opensaml2\Debug;..\..\cpp-xmltooling\Debug"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                                TargetMachine="1"
index 24d558f..acb0b54 100644 (file)
    $Id$
 */
 
-#include <shib-target/shib-target.h>
+#include <saml/SAMLConfig.h>
+#include <saml/saml2/metadata/Metadata.h>
+#include <saml/util/SAMLConstants.h>
+#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/signature/Signature.h>
+#include <xmltooling/util/XMLHelper.h>
 
 #include <fstream>
 #include <log4cpp/Category.hh>
 #include <log4cpp/OstreamAppender.hh>
 #include <xercesc/framework/URLInputSource.hpp>
 #include <xercesc/framework/StdInInputSource.hpp>
+#include <xercesc/framework/Wrapper4InputSource.hpp>
 #include <xsec/enc/XSECCryptoProvider.hpp>
 #include <xsec/enc/XSECKeyInfoResolverDefault.hpp>
 #include <xsec/enc/XSECCryptoException.hpp>
 #include <xsec/dsig/DSIGReference.hpp>
 #include <xsec/dsig/DSIGTransformList.hpp>
 
-using namespace std;
-using namespace saml;
-using namespace shibboleth;
+using namespace xmlsignature;
+using namespace xmlconstants;
+using namespace xmltooling;
+using namespace samlconstants;
+using namespace opensaml::saml2md;
+using namespace opensaml;
 using namespace log4cpp;
-
-static const XMLCh TRUST_NS[] = // urn:mace:shibboleth:trust:1.0
-{ chLatin_u, chLatin_r, chLatin_n, chColon, chLatin_m, chLatin_a, chLatin_c, chLatin_e, chColon,
-  chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chColon,
-  chLatin_t, chLatin_r, chLatin_u, chLatin_s, chLatin_t, chColon, chDigit_1, chPeriod, chDigit_0, chNull
-};
-
-static const XMLCh TRUST_SCHEMA_ID[] = // shibboleth-trust-1.0.xsd
-{ chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chDash,
-  chLatin_t, chLatin_r, chLatin_u, chLatin_s, chLatin_t, chDash, chDigit_1, chPeriod, chDigit_0, chPeriod,
-  chLatin_x, chLatin_s, chLatin_d, chNull
-};
-
-static const XMLCh SHIB_SCHEMA_ID[] = // shibboleth.xsd
-{ chLatin_s, chLatin_h, chLatin_i, chLatin_b, chLatin_b, chLatin_o, chLatin_l, chLatin_e, chLatin_t, chLatin_h, chPeriod,
-  chLatin_x, chLatin_s, chLatin_d, chNull
-};
+using namespace std;
 
 void verifySignature(DOMDocument* doc, DOMNode* sigNode, const char* cert=NULL)
 {
@@ -99,7 +92,7 @@ void verifySignature(DOMDocument* doc, DOMNode* sigNode, const char* cert=NULL)
     
         if (!valid) {
             log.error("detected an invalid signature profile");
-            throw InvalidCryptoException("detected an invalid signature profile");
+            throw SignatureException("detected an invalid signature profile");
         }
 
         if (cert) {
@@ -127,7 +120,7 @@ void verifySignature(DOMDocument* doc, DOMNode* sigNode, const char* cert=NULL)
         
         if (!sig->verify()) {
             log.error("detected an invalid signature value");
-            throw InvalidCryptoException("detected an invalid signature value");
+            throw SignatureException("detected an invalid signature value");
         }
 
         prov.releaseSignature(sig);
@@ -179,60 +172,46 @@ int main(int argc,char* argv[])
         return -100;
     }
 
-    static const XMLCh Trust[] = { chLatin_T, chLatin_r, chLatin_u, chLatin_s, chLatin_t, chNull };
-    static const XMLCh SiteGroup[] =
-    { chLatin_S, chLatin_i, chLatin_t, chLatin_e, chLatin_G, chLatin_r, chLatin_o, chLatin_u, chLatin_p, chNull };
-    static const XMLCh EntitiesDescriptor[] =
-    { chLatin_E, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_i, chLatin_e, chLatin_s,
-      chLatin_D, chLatin_e, chLatin_s, chLatin_c, chLatin_r, chLatin_i, chLatin_p, chLatin_t, chLatin_o, chLatin_r, chNull };
-    static const XMLCh EntityDescriptor[] =
-    { chLatin_E, chLatin_n, chLatin_t, chLatin_i, chLatin_t, chLatin_y,
-      chLatin_D, chLatin_e, chLatin_s, chLatin_c, chLatin_r, chLatin_i, chLatin_p, chLatin_t, chLatin_o, chLatin_r, chNull };
-
     Category::setRootPriority(Priority::WARN);
     Category::getRoot().addAppender(new OstreamAppender("default",&cerr));
     Category& log=Category::getInstance("siterefresh");
-    conf.schema_dir=path ? path : SHIB_SCHEMAS;
     if (!conf.init())
         return -10;
 
-    saml::XML::registerSchema(Constants::SHIB_NS,SHIB_SCHEMA_ID);
-    saml::XML::registerSchema(TRUST_NS,TRUST_SCHEMA_ID);
+    /*
     saml::XML::registerSchema(shibtarget::XML::SAML2META_NS,shibtarget::XML::SAML2META_SCHEMA_ID);
     saml::XML::registerSchema(shibtarget::XML::SAML2ASSERT_NS,shibtarget::XML::SAML2ASSERT_SCHEMA_ID);
     saml::XML::registerSchema(shibtarget::XML::XMLENC_NS,shibtarget::XML::XMLENC_SCHEMA_ID);
+    */
 
     try {
         // Parse the specified document.
-        saml::XML::Parser p;
         static XMLCh base[]={chLatin_f, chLatin_i, chLatin_l, chLatin_e, chColon, chForwardSlash, chForwardSlash, chForwardSlash, chNull};
         DOMDocument* doc=NULL;
         if (url_param && *url_param) {
             URLInputSource src(base,url_param);
             Wrapper4InputSource dsrc(&src,false);
-            doc=p.parse(dsrc);
+            doc=XMLToolingConfig::getConfig().getParser().parse(dsrc);
         }
         else {
             StdInInputSource src;
             Wrapper4InputSource dsrc(&src,false);
-            doc=p.parse(dsrc);
+            doc=XMLToolingConfig::getConfig().getParser().parse(dsrc);
         }
     
         // Check root element.
         if (ns_param && name_param) {
             auto_ptr_XMLCh ns(ns_param);
             auto_ptr_XMLCh name(name_param);
-            if (!saml::XML::isElementNamed(doc->getDocumentElement(),ns.get(),name.get()))
-                throw MalformedException(string("Root element does not match specified QName of {") + ns_param + "}:" + name_param);
+            if (!XMLHelper::isNodeNamed(doc->getDocumentElement(),ns.get(),name.get()))
+                throw XMLObjectException(string("Root element does not match specified QName of {") + ns_param + "}:" + name_param);
         }
-        else if (!saml::XML::isElementNamed(doc->getDocumentElement(),Constants::SHIB_NS,SiteGroup) &&
-                 !saml::XML::isElementNamed(doc->getDocumentElement(),shibtarget::XML::SAML2META_NS,EntitiesDescriptor) &&
-                 !saml::XML::isElementNamed(doc->getDocumentElement(),shibtarget::XML::SAML2META_NS,EntityDescriptor) &&
-                 !saml::XML::isElementNamed(doc->getDocumentElement(),TRUST_NS,Trust))
-            throw MalformedException("Root element does not signify a known metadata or trust format");
+        else if (!XMLHelper::isNodeNamed(doc->getDocumentElement(),SAML20MD_NS,EntitiesDescriptor::LOCAL_NAME) &&
+                 !XMLHelper::isNodeNamed(doc->getDocumentElement(),SAML20MD_NS,EntityDescriptor::LOCAL_NAME))
+            throw XMLObjectException("Root element does not signify a known metadata format");
 
         // Verify the "root" signature.
-        DOMElement* rootSig=saml::XML::getFirstChildElement(doc->getDocumentElement(),saml::XML::XMLSIG_NS,L(Signature));
+        DOMElement* rootSig=XMLHelper::getFirstChildElement(doc->getDocumentElement(),XMLSIG_NS,Signature::LOCAL_NAME);
         if (verify) {
             if (rootSig) {
                 verifySignature(doc,rootSig,cert_param);
@@ -240,7 +219,7 @@ int main(int argc,char* argv[])
             else {
                 doc->release();
                 log.error("unable to locate root signature to verify in document");
-                throw InvalidCryptoException("Verification implies that the document must be signed");
+                throw SignatureException("Verification implies that the document must be signed");
             }
         }
         else if (rootSig) {
@@ -252,7 +231,7 @@ int main(int argc,char* argv[])
         }
 
         // Verify all signatures.
-        DOMNodeList* siglist=doc->getElementsByTagNameNS(saml::XML::XMLSIG_NS,L(Signature));
+        DOMNodeList* siglist=doc->getElementsByTagNameNS(XMLSIG_NS,Signature::LOCAL_NAME);
         for (unsigned int i=0; siglist && i<siglist->getLength(); i++)
             verifySignature(doc,siglist->item(i),cert_param);
 
@@ -265,11 +244,11 @@ int main(int argc,char* argv[])
             cout << *(doc->getDocumentElement());
         doc->release();
     }
-    catch (InvalidCryptoException&) {
+    catch (SignatureException&) {
         ret=-1;
     }
-    catch(SAMLException& e) {
-        log.errorStream() << "caught a SAML exception: " << e.what() << CategoryStream::ENDLINE;
+    catch(XMLToolingException& e) {
+        log.errorStream() << "caught an XMLTooling exception: " << e.what() << CategoryStream::ENDLINE;
         ret=-2;
     }
     catch(XMLException& e) {
index b75c9c5..3e0d92d 100644 (file)
@@ -44,7 +44,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib xsec_1.lib saml_5.lib"
+                               AdditionalDependencies="log4cpp.lib xerces-c_2.lib xsec_1.lib saml2.lib"
                                OutputFile=".\Release/siterefresh.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="..\..\cpp-opensaml2\Release;..\..\cpp-xmltooling\Release"
                                ProgramDatabaseFile=".\Release/siterefresh.pdb"
                                SubSystem="1"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_CONSOLE;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib xsec_1D.lib saml_5D.lib"
+                               AdditionalDependencies="log4cppD.lib xerces-c_2D.lib xsec_1D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile=".\Debug/siterefresh.exe"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="..\..\cpp-opensaml2\Debug;..\..\cpp-xmltooling\Debug"
                                GenerateDebugInformation="true"
                                SubSystem="1"
                                TargetMachine="1"
index f198390..712f61b 100644 (file)
@@ -38,7 +38,6 @@
 #endif
 
 #include <shib-target/shib-target.h>
-#include <shib/shib-threads.h>
 #include <openssl/ssl.h>
 
 #define XMLPROVIDERS_LOGCAT "XMLProviders"
index c3e86fe..ac5e5e0 100644 (file)
@@ -4,6 +4,7 @@
        Version="8.00"
        Name="xmlproviders"
        ProjectGUID="{68E46D06-6B91-4C59-A700-78DD4D4C420B}"
+       RootNamespace="xmlproviders"
        Keyword="MFCProj"
        >
        <Platforms>
@@ -49,7 +50,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="2"
                                InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="..,..\..\..\opensaml\c"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
                                StringPooling="true"
                                RuntimeLibrary="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="libeay32_0_9_8.lib ssleay32_0_9_8.lib log4cpp.lib xerces-c_2.lib xsec_1.lib saml_5.lib"
+                               AdditionalDependencies="libeay32_0_9_8.lib ssleay32_0_9_8.lib log4cpp.lib xerces-c_2.lib xsec_1.lib saml_5.lib saml2.lib xmltooling1.lib"
                                OutputFile="Release/xmlproviders.so"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\..\opensaml\c\saml\Release"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Release&quot;;&quot;..\..\cpp-opensaml2\Release&quot;;&quot;..\..\cpp-xmltooling\Release&quot;"
                                ProgramDatabaseFile=".\Release/xmlproviders.pdb"
                                ImportLibrary=".\Release/xmlproviders.lib"
                                TargetMachine="1"
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="0"
-                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;"
+                               AdditionalIncludeDirectories="..;&quot;..\..\cpp-opensaml1&quot;;&quot;..\..\cpp-opensaml2&quot;;&quot;..\..\cpp-xmltooling&quot;"
                                PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="libeay32_0_9_8D.lib ssleay32_0_9_8D.lib log4cppD.lib xerces-c_2D.lib xsec_1D.lib saml_5D.lib"
+                               AdditionalDependencies="libeay32_0_9_8D.lib ssleay32_0_9_8D.lib log4cppD.lib xerces-c_2D.lib xsec_1D.lib saml_5D.lib saml2D.lib xmltooling1D.lib"
                                OutputFile="Debug/xmlproviders.so"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="..\..\cpp-opensaml1\saml\Debug"
+                               AdditionalLibraryDirectories="&quot;..\..\cpp-opensaml1\saml\Debug&quot;;&quot;..\..\cpp-opensaml2\Debug&quot;;&quot;..\..\cpp-xmltooling\Debug&quot;"
                                GenerateDebugInformation="true"
                                ImportLibrary=".\Debug/xmlproviders.lib"
                                TargetMachine="1"