[general]
logger=/opt/shibboleth/etc/shibboleth/shibboleth.logger
schemadir=/opt/shibboleth/etc/shibboleth/
+sharsocket=/tmp/shar-socket
sitesFile=http://wayf.internet2.edu/shibboleth/sites.xml
#sitesFile=file:///mit/shibboleth/src/shibboleth/java/webApplication/sites.xml
eduPerson=/opt/shibboleth/lib/libeduPerson.so
[policies]
-InCommon=urn:mace:InCommon:2003
-
+InCommon=urn:mace:InCommon:pilot:
\ No newline at end of file
namespace {
RPCHandle *rpc_handle = NULL;
- ShibTargetConfig* g_szConfig = NULL;
+ ShibTargetConfig* g_Config = NULL;
map<string,string> g_mapAttribNameToHeader;
map<string,string> g_mapAttribRuleToHeader;
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,
"shibrm_child_init() starting");
- if (g_szConfig) {
+ if (g_Config) {
ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO,s,
"shibrm_child_init(): already initialized!");
exit (1);
try {
// Assume that we've been initialized from the SHIRE module!
- g_szConfig = &(ShibTargetConfig::init(SHIBTARGET_RM, "NOOP"));
+ g_Config = &(ShibTargetConfig::init(SHIBTARGET_RM, "NOOP"));
} catch (...) {
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,
"shibrm_child_init() failed to initialize SHIB Target");
// Create the RPC Handle.. Note: this should be per _thread_
// if there is some way to do that reasonably..
- rpc_handle = new RPCHandle(SHIB_SHAR_SOCKET, SHIBRPC_PROG, SHIBRPC_VERS_1);
+ rpc_handle = new RPCHandle(g_Config->m_SocketName, SHIBRPC_PROG, SHIBRPC_VERS_1);
// 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;
- g_szConfig->shutdown();
- g_szConfig = NULL;
+ g_Config->shutdown();
+ g_Config = NULL;
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,"shibrm_child_exit() done");
}
{
const char* serverName = get_service_name(r);
string tag;
- if ((g_szConfig->getINI()).get_tag (serverName, "normalizeRequest", true, &tag))
+ if ((g_Config->getINI()).get_tag (serverName, "normalizeRequest", true, &tag))
{
if (ShibINI::boolean (tag))
{
threadid << "[" << getpid() << "] shibrm" << '\0';
saml::NDC ndc(threadid.str().c_str());
- ShibINI& ini = g_szConfig->getINI();
+ ShibINI& ini = g_Config->getINI();
const char* serverName = get_service_name (r);
shibrm_dir_config* dc=
char* g_szSHIREURL = NULL;
char* g_szSHIREConfig = NULL;
RPCHandle *rpc_handle = NULL;
- ShibTargetConfig * g_szConfig = NULL;
+ ShibTargetConfig * g_Config = NULL;
}
// per-server configuration structure
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,
"shire_child_init() starting");
- if (g_szConfig) {
+ if (g_Config) {
ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO,s,
"shire_child_init(): already initialized!");
exit (1);
}
try {
- g_szConfig = &(ShibTargetConfig::init(SHIBTARGET_SHIRE, g_szSHIREConfig));
+ g_Config = &(ShibTargetConfig::init(SHIBTARGET_SHIRE, g_szSHIREConfig));
} catch (...) {
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,
"shire_child_init() failed to initialize SHIB Target");
// Create the RPC Handle.. Note: this should be per _thread_
// if there is some way to do that reasonably..
- rpc_handle = new RPCHandle(SHIB_SHAR_SOCKET, SHIBRPC_PROG, SHIBRPC_VERS_1);
+ rpc_handle = new RPCHandle(g_Config->m_SocketName, SHIBRPC_PROG, SHIBRPC_VERS_1);
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;
- g_szConfig->shutdown();
- g_szConfig = NULL;
+ g_Config->shutdown();
+ g_Config = NULL;
ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,"shire_child_exit() done");
}
{
const char* serverName = get_service_name(r);
string tag;
- if ((g_szConfig->getINI()).get_tag (serverName, "normalizeRequest", true, &tag))
+ if ((g_Config->getINI()).get_tag (serverName, "normalizeRequest", true, &tag))
{
if (ShibINI::boolean (tag))
{
static const char* get_shire_location(request_rec* r, const char* target, bool encode)
{
- ShibINI& ini = g_szConfig->getINI();
+ ShibINI& ini = g_Config->getINI();
const char* serverName = get_service_name(r);
string shire_location;
threadid << "[" << getpid() << "] shire" << '\0';
saml::NDC ndc(threadid.str().c_str());
- ShibINI& ini = g_szConfig->getINI();
+ ShibINI& ini = g_Config->getINI();
ShibMLP markupProcessor;
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,r,
threadid << "[" << getpid() << "] shire" << '\0';
saml::NDC ndc(threadid.str().c_str());
- ShibINI& ini = g_szConfig->getINI();
+ ShibINI& ini = g_Config->getINI();
ShibMLP markupProcessor;
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,r,
case 'f':
#ifndef WIN32
/* XXX: I know that this is a string on Unix */
- unlink (SHIB_SHAR_SOCKET);
+ unlink (ShibTargetConfig::getConfig().m_SocketName);
#endif
break;
default:
{ SHIBRPC_PROG, SHIBRPC_VERS_1, shibrpc_prog_1 }
};
- if (parse_args (argc, argv) != 0)
- usage(argv[0]);
-
if (setup_signals() != 0)
return -1;
if (shib_target_initialize(SHIBTARGET_SHAR, config))
return -2;
+ if (parse_args (argc, argv) != 0)
+ usage(argv[0]);
+
/* Create the SHAR listener socket */
if (shib_sock_create (&sock) != 0)
return -3;
/* Bind to the proper port */
- if (shib_sock_bind (sock, SHIB_SHAR_SOCKET) != 0)
+ if (shib_sock_bind (sock, ShibTargetConfig::getConfig().m_SocketName) != 0)
return -4;
/* Initialize the SHAR Utilitites */
/* Finalize the SHAR, close all clients */
shar_utils_fini();
- shib_sock_close(sock, SHIB_SHAR_SOCKET);
+ shib_sock_close(sock, ShibTargetConfig::getConfig().m_SocketName);
fprintf (stderr, "shar_svc_run returned.\n");
return 0;
}
return *g_Config;
}
+ShibTargetConfig::~ShibTargetConfig()
+{
+#ifdef WIN32
+#else
+ if (m_SocketName) free(m_SocketName);
+#endif
+}
/****************************************************************************/
// STConfig
}
delete iter;
}
+
+ string sockname=ini->get(SHIBTARGET_GENERAL, "sharsocket");
+#ifdef WIN32
+ if (sockname.length()>0)
+ m_SocketName=atoi(sockname.c_str());
+ else
+ m_SocketName=SHIB_SHAR_SOCKET;
+#else
+ if (sockname.length()>0)
+ m_SocketName=strdup(sockname.c_str());
+ else
+ m_SocketName=strdup(SHIB_SHAR_SOCKET);
+#endif
ref();
log.debug("finished");
#include <winsock.h>
typedef SOCKET ShibSocket;
typedef u_short ShibSockName;
-#define SHIB_SHAR_SOCKET 12345 /* shar portnumber */
+#define SHIB_SHAR_SOCKET 12345 /* shar portnumber */
#else /* UNIX */
/* application names */
#define SHIBTARGET_GENERAL "general"
-#define SHIBTARGET_SHAR "shar"
+#define SHIBTARGET_SHAR "shar"
#define SHIBTARGET_SHIRE "shire"
#define SHIBTARGET_RM "rm"
#define SHIBTARGET_POLICIES "policies"
static ShibTargetConfig& init(const char* app_name, const char* inifile);
static ShibTargetConfig& getConfig();
virtual void shutdown() = 0;
+ virtual ~ShibTargetConfig();
virtual ShibINI& getINI() = 0;
virtual saml::Iterator<const XMLCh*> getPolicies() = 0;
+
+ ShibSockName m_SocketName;
};
} // namespace