From 061538bcce7af3c3828929e2f36bc9720814c3db Mon Sep 17 00:00:00 2001 From: cantor Date: Sun, 19 Sep 2010 18:05:05 +0000 Subject: [PATCH] Add conditional remoting, remove nullptr reference. git-svn-id: https://svn.middleware.georgetown.edu/shib-extension/cpp-sp-resolver/trunk@268 3ebe4818-3638-0410-822d-ece5924dabe2 --- config_win32.h | 3 +++ cpp-sp-resolver.sln | 14 ++++++++++++-- shibresolver/resolver.cpp | 21 +++++++++++++-------- shibresolver/resolver.h | 2 +- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/config_win32.h b/config_win32.h index a7b3a24..a389d7b 100644 --- a/config_win32.h +++ b/config_win32.h @@ -40,6 +40,9 @@ /* Define if Shibboleth SP library was found */ #define HAVE_SHIBSP 1 +/* Define to 1 if Shibboleth SP supports non-plugin remoting. */ +#define SHIBRESOLVER_SHIBSP_HAS_REMOTING 1 + /* Define to 1 if you have the header file. */ /* #undef HAVE_STDINT_H */ diff --git a/cpp-sp-resolver.sln b/cpp-sp-resolver.sln index d1fdab8..2ad7344 100644 --- a/cpp-sp-resolver.sln +++ b/cpp-sp-resolver.sln @@ -1,9 +1,19 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resolver", "shibresolver\resolver.vcxproj", "{36D4FABF-ACDE-4947-9C4A-7AE1B50CD83A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shibresolver", "shibresolver\resolver.vcxproj", "{36D4FABF-ACDE-4947-9C4A-7AE1B50CD83A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resolver-lite", "shibresolver\resolver-lite.vcxproj", "{36D4FABF-ACDE-4947-9C4A-7AE1B50CD83B}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shibresolver-lite", "shibresolver\resolver-lite.vcxproj", "{36D4FABF-ACDE-4947-9C4A-7AE1B50CD83B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3408DF00-FE03-41B1-AB95-9C45FF22DD44}" + ProjectSection(SolutionItems) = preProject + bootstrap = bootstrap + config_win32.h = config_win32.h + configure.ac = configure.ac + Makefile.am = Makefile.am + Portfile.in = Portfile.in + resolver.spec.in = resolver.spec.in + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/shibresolver/resolver.cpp b/shibresolver/resolver.cpp index 9a95fe8..dfea7c3 100644 --- a/shibresolver/resolver.cpp +++ b/shibresolver/resolver.cpp @@ -35,19 +35,20 @@ using namespace xmltooling; using namespace std; namespace shibresolver { - class SHIBRESOLVER_DLLLOCAL ResolverImpl : public ShibbolethResolver, public Remoted { + class SHIBRESOLVER_DLLLOCAL RemotedResolver : public Remoted { public: - ResolverImpl() {} - ~ResolverImpl() {} + RemotedResolver() {} + ~RemotedResolver() {} - void resolve(); void receive(DDF& in, ostream& out); }; + + static RemotedResolver g_Remoted; }; ShibbolethResolver* ShibbolethResolver::create() { - return new ResolverImpl(); + return new ShibbolethResolver(); } ShibbolethResolver::ShibbolethResolver() @@ -112,17 +113,21 @@ RequestMapper::Settings ShibbolethResolver::getSettings() const return m_settings; } -void ResolverImpl::resolve() +void ShibbolethResolver::resolve() { } -void ResolverImpl::receive(DDF& in, ostream& out) +void RemotedResolver::receive(DDF& in, ostream& out) { } extern "C" int SHIBRESOLVER_EXPORTS xmltooling_extension_init(void*) { - // Register factory functions with appropriate plugin managers in the XMLTooling/SAML/SPConfig objects. +#ifdef SHIBRESOLVER_SHIBSP_HAS_REMOTING + SPConfig& conf = SPConfig::getConfig(); + if (conf.isEnabled(SPConfig::OutOfProcess) && !conf.isEnabled(SPConfig::InProcess) && conf.isEnabled(SPConfig::Listener)) + conf.getServiceProvider()->regListener("org.project-moonshot.shibresolver", &g_Remoted); +#endif return 0; // signal success } diff --git a/shibresolver/resolver.h b/shibresolver/resolver.h index 947e8ab..e3a6c0c 100644 --- a/shibresolver/resolver.h +++ b/shibresolver/resolver.h @@ -149,7 +149,7 @@ namespace shibresolver { #else unsigned long features = shibsp::SPConfig::OutOfProcess, #endif - const char* config = nullptr, + const char* config = NULL, bool rethrow = false ); -- 2.1.4