// SAML Runtime
#include <saml/saml.h>
#include <shib/shib.h>
+#include <shib/shib-threads.h>
#include <shib-target/shib-target.h>
// Apache specific header files
using namespace shibtarget;
namespace {
- RPCHandle *rpc_handle = NULL;
+ ThreadKey* rpc_handle_key = NULL;
ShibTargetConfig* g_Config = NULL;
map<string,string> g_mapAttribNameToHeader;
{NULL}
};
+namespace {
+ void destroy_handle(void* data)
+ {
+ delete (RPCHandle*)data;
+ }
+}
/*
saml::NDC ndc("shibrm_child_init");
- // Create the RPC Handle.. Note: this should be per _thread_
- // if there is some way to do that reasonably..
- rpc_handle = new RPCHandle(shib_target_sockname(), SHIBRPC_PROG, SHIBRPC_VERS_1);
+ // Create the RPC Handle TLS key.
+ rpc_handle_key=ThreadKey::create(destroy_handle);
// Transcode the attribute names we know about for quick handling map access.
for (map<string,string>::const_iterator i=g_mapAttribNameToHeader.begin();
*/
extern "C" void shibrm_child_exit(server_rec* s, pool* p)
{
- delete rpc_handle;
+ delete rpc_handle_key;
g_Config->shutdown();
g_Config = NULL;
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,"shibrm_child_exit() done");
// Now grab the attributes...
has_tag = ini.get_tag (serverName, "checkIPAddress", true, &tag);
dc->config.checkIPAddress = (has_tag ? ShibINI::boolean (tag) : false);
+
+ // Get an RPC handle and build the RM object.
+ RPCHandle* rpc_handle = (RPCHandle*)rpc_handle_key->getData();
+ if (!rpc_handle)
+ {
+ rpc_handle = new RPCHandle(shib_target_sockname(), SHIBRPC_PROG, SHIBRPC_VERS_1);
+ rpc_handle_key->setData(rpc_handle);
+ }
RM rm(rpc_handle, dc->config);
vector<SAMLAssertion*> assertions;
// SAML Runtime
#include <saml/saml.h>
#include <shib/shib.h>
+#include <shib/shib-threads.h>
#include <shib-target/shib-target.h>
// Apache specific header files
namespace {
char* g_szSHIREURL = NULL;
char* g_szSHIREConfig = NULL;
- RPCHandle *rpc_handle = NULL;
- ShibTargetConfig * g_Config = NULL;
+ ThreadKey* rpc_handle_key = NULL;
+ ShibTargetConfig* g_Config = NULL;
}
// per-dir module configuration structure
{NULL}
};
+namespace {
+ void destroy_handle(void* data)
+ {
+ delete (RPCHandle*)data;
+ }
+}
/*
* shire_child_init()
exit (1);
}
- // Create the RPC Handle.. Note: this should be per _thread_
- // if there is some way to do that reasonably..
- rpc_handle = new RPCHandle(shib_target_sockname(), SHIBRPC_PROG, SHIBRPC_VERS_1);
+ // Create the RPC Handle TLS key.
+ rpc_handle_key=ThreadKey::create(destroy_handle);
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,"shire_child_init() done");
}
*/
extern "C" void shire_child_exit(server_rec* s, pool* p)
{
- delete rpc_handle;
+ delete rpc_handle_key;
g_Config->shutdown();
g_Config = NULL;
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,"shire_child_exit() done");
return SERVER_ERROR;
}
+ // Get an RPC handle and build the SHIRE object.
+ RPCHandle* rpc_handle = (RPCHandle*)rpc_handle_key->getData();
+ if (!rpc_handle)
+ {
+ rpc_handle = new RPCHandle(shib_target_sockname(), SHIBRPC_PROG, SHIBRPC_VERS_1);
+ rpc_handle_key->setData(rpc_handle);
+ }
SHIRE shire(rpc_handle, dc->config, shire_url);
// We're in charge, so check for cookie.
markupProcessor.insert("logoLocation", has_tag ? tag : "");
markupProcessor.insert("requestURL", targeturl);
- SHIRE shire(rpc_handle, config, shire_url);
+ // Get an RPC handle and build the SHIRE object.
+ RPCHandle* rpc_handle = (RPCHandle*)rpc_handle_key->getData();
+ if (!rpc_handle)
+ {
+ rpc_handle = new RPCHandle(shib_target_sockname(), SHIBRPC_PROG, SHIBRPC_VERS_1);
+ rpc_handle_key->setData(rpc_handle);
+ }
+ SHIRE shire(rpc_handle, config, shire_url);
// Process SHIRE POST