projects
/
shibboleth
/
cpp-sp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c754e83
)
Adjust logging categories.
author
Scott Cantor
<cantor.2@osu.edu>
Sun, 25 Nov 2007 22:28:49 +0000
(22:28 +0000)
committer
Scott Cantor
<cantor.2@osu.edu>
Sun, 25 Nov 2007 22:28:49 +0000
(22:28 +0000)
apache/mod_apache.cpp
patch
|
blob
|
history
fastcgi/shibauthorizer.cpp
patch
|
blob
|
history
fastcgi/shibresponder.cpp
patch
|
blob
|
history
isapi_shib/isapi_shib.cpp
patch
|
blob
|
history
nsapi_shib/nsapi_shib.cpp
patch
|
blob
|
history
shibsp/AbstractSPRequest.cpp
patch
|
blob
|
history
shibsp/AbstractSPRequest.h
patch
|
blob
|
history
shibsp/ServiceProvider.cpp
patch
|
blob
|
history
shibsp/base.h
patch
|
blob
|
history
diff --git
a/apache/mod_apache.cpp
b/apache/mod_apache.cpp
index
cbd7c2e
..
421a7ec
100644
(file)
--- a/
apache/mod_apache.cpp
+++ b/
apache/mod_apache.cpp
@@
-309,7
+309,7
@@
public:
shib_server_config* m_sc;
shib_request_config* m_rc;
shib_server_config* m_sc;
shib_request_config* m_rc;
- ShibTargetApache(request_rec* req, bool handler) : m_handler(handler), m_gotBody(false) {
+ ShibTargetApache(request_rec* req, bool handler) :
AbstractSPRequest(SHIBSP_LOGCAT".Apache"),
m_handler(handler), m_gotBody(false) {
m_sc = (shib_server_config*)ap_get_module_config(req->server->module_config, &mod_shib);
m_dc = (shib_dir_config*)ap_get_module_config(req->per_dir_config, &mod_shib);
m_rc = (shib_request_config*)ap_get_module_config(req->request_config, &mod_shib);
m_sc = (shib_server_config*)ap_get_module_config(req->server->module_config, &mod_shib);
m_dc = (shib_dir_config*)ap_get_module_config(req->per_dir_config, &mod_shib);
m_rc = (shib_request_config*)ap_get_module_config(req->request_config, &mod_shib);
diff --git
a/fastcgi/shibauthorizer.cpp
b/fastcgi/shibauthorizer.cpp
index
8fdaf3f
..
f0fd99e
100644
(file)
--- a/
fastcgi/shibauthorizer.cpp
+++ b/
fastcgi/shibauthorizer.cpp
@@
-67,7
+67,8
@@
class ShibTargetFCGIAuth : public AbstractSPRequest
public:
\r
map<string,string> m_request_headers;
\r
\r
public:
\r
map<string,string> m_request_headers;
\r
\r
- ShibTargetFCGIAuth(FCGX_Request* req, const char* scheme=NULL, const char* hostname=NULL, int port=0) : m_req(req) {
\r
+ ShibTargetFCGIAuth(FCGX_Request* req, const char* scheme=NULL, const char* hostname=NULL, int port=0)
\r
+ : AbstractSPRequest(SHIBSP_LOGCAT".FastCGI"), m_req(req) {
\r
const char* server_name_str = hostname;
\r
if (!server_name_str || !*server_name_str)
\r
server_name_str = FCGX_GetParam("SERVER_NAME", req->envp);
\r
const char* server_name_str = hostname;
\r
if (!server_name_str || !*server_name_str)
\r
server_name_str = FCGX_GetParam("SERVER_NAME", req->envp);
\r
diff --git
a/fastcgi/shibresponder.cpp
b/fastcgi/shibresponder.cpp
index
247eb7c
..
940ebe3
100644
(file)
--- a/
fastcgi/shibresponder.cpp
+++ b/
fastcgi/shibresponder.cpp
@@
-68,7
+68,7
@@
class ShibTargetFCGI : public AbstractSPRequest
\r
public:
\r
ShibTargetFCGI(FCGX_Request* req, char* post_data, const char* scheme=NULL, const char* hostname=NULL, int port=0)
\r
\r
public:
\r
ShibTargetFCGI(FCGX_Request* req, char* post_data, const char* scheme=NULL, const char* hostname=NULL, int port=0)
\r
- : m_req(req), m_body(post_data) {
\r
+ :
AbstractSPRequest(SHIBSP_LOGCAT".FastCGI"),
m_req(req), m_body(post_data) {
\r
\r
const char* server_name_str = hostname;
\r
if (!server_name_str || !*server_name_str)
\r
\r
const char* server_name_str = hostname;
\r
if (!server_name_str || !*server_name_str)
\r
diff --git
a/isapi_shib/isapi_shib.cpp
b/isapi_shib/isapi_shib.cpp
index
f608c72
..
d286c4b
100644
(file)
--- a/
isapi_shib/isapi_shib.cpp
+++ b/
isapi_shib/isapi_shib.cpp
@@
-360,7
+360,7
@@
class ShibTargetIsapiF : public AbstractSPRequest
public:
ShibTargetIsapiF(PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_PREPROC_HEADERS pn, const site_t& site)
public:
ShibTargetIsapiF(PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_PREPROC_HEADERS pn, const site_t& site)
- : m_pfc(pfc), m_pn(pn), m_allhttp(4096) {
+ :
AbstractSPRequest(SHIBSP_LOGCAT".ISAPI"),
m_pfc(pfc), m_pn(pn), m_allhttp(4096) {
// URL path always come from IIS.
dynabuf var(256);
// URL path always come from IIS.
dynabuf var(256);
@@
-640,7
+640,8
@@
class ShibTargetIsapiE : public AbstractSPRequest
mutable string m_remote_addr,m_remote_user;
public:
mutable string m_remote_addr,m_remote_user;
public:
- ShibTargetIsapiE(LPEXTENSION_CONTROL_BLOCK lpECB, const site_t& site) : m_lpECB(lpECB), m_gotBody(false) {
+ ShibTargetIsapiE(LPEXTENSION_CONTROL_BLOCK lpECB, const site_t& site)
+ : AbstractSPRequest(SHIBSP_LOGCAT".ISAPI"), m_lpECB(lpECB), m_gotBody(false) {
dynabuf ssl(5);
GetServerVariable(lpECB,"HTTPS",ssl,5);
bool SSL=(ssl=="on" || ssl=="ON");
dynabuf ssl(5);
GetServerVariable(lpECB,"HTTPS",ssl,5);
bool SSL=(ssl=="on" || ssl=="ON");
diff --git
a/nsapi_shib/nsapi_shib.cpp
b/nsapi_shib/nsapi_shib.cpp
index
13497db
..
b8f88bc
100644
(file)
--- a/
nsapi_shib/nsapi_shib.cpp
+++ b/
nsapi_shib/nsapi_shib.cpp
@@
-192,7
+192,7
@@
class ShibTargetNSAPI : public AbstractSPRequest
set<string> m_allhttp;
public:
set<string> m_allhttp;
public:
- ShibTargetNSAPI(pblock* pb, ::Session* sn, Request* rq) : m_gotBody(false) {
+ ShibTargetNSAPI(pblock* pb, ::Session* sn, Request* rq) :
AbstractSPRequest(SHIBSP_LOGCAT".NSAPI"),
m_gotBody(false) {
m_pb = pb;
m_sn = sn;
m_rq = rq;
m_pb = pb;
m_sn = sn;
m_rq = rq;
diff --git
a/shibsp/AbstractSPRequest.cpp
b/shibsp/AbstractSPRequest.cpp
index
bdceb28
..
cb2d3eb
100644
(file)
--- a/
shibsp/AbstractSPRequest.cpp
+++ b/
shibsp/AbstractSPRequest.cpp
@@
-31,9
+31,9
@@
using namespace opensaml;
using namespace xmltooling;
using namespace std;
using namespace xmltooling;
using namespace std;
-AbstractSPRequest::AbstractSPRequest()
+AbstractSPRequest::AbstractSPRequest(
const char* category
)
: m_sp(NULL), m_mapper(NULL), m_app(NULL), m_sessionTried(false), m_session(NULL),
: m_sp(NULL), m_mapper(NULL), m_app(NULL), m_sessionTried(false), m_session(NULL),
- m_log(&Category::getInstance(
SHIBSP_LOGCAT".SPRequest"
)), m_parser(NULL)
+ m_log(&Category::getInstance(
category
)), m_parser(NULL)
{
m_sp=SPConfig::getConfig().getServiceProvider();
m_sp->lock();
{
m_sp=SPConfig::getConfig().getServiceProvider();
m_sp->lock();
diff --git
a/shibsp/AbstractSPRequest.h
b/shibsp/AbstractSPRequest.h
index
f1b64b1
..
7b710b0
100644
(file)
--- a/
shibsp/AbstractSPRequest.h
+++ b/
shibsp/AbstractSPRequest.h
@@
-40,7
+40,12
@@
namespace shibsp {
class SHIBSP_API AbstractSPRequest : public virtual SPRequest
{
protected:
class SHIBSP_API AbstractSPRequest : public virtual SPRequest
{
protected:
- AbstractSPRequest();
+ /**
+ * Constructor.
+ *
+ * @param category logging category to use
+ */
+ AbstractSPRequest(const char* category);
/**
* Stores a normalized request URI to ensure it contains no %-encoded characters
/**
* Stores a normalized request URI to ensure it contains no %-encoded characters
diff --git
a/shibsp/ServiceProvider.cpp
b/shibsp/ServiceProvider.cpp
index
e441e3c
..
18b43f1
100644
(file)
--- a/
shibsp/ServiceProvider.cpp
+++ b/
shibsp/ServiceProvider.cpp
@@
-39,13
+39,16
@@
#include <xmltooling/util/XMLHelper.h>
using namespace shibsp;
#include <xmltooling/util/XMLHelper.h>
using namespace shibsp;
+using namespace xmltooling::logging;
using namespace xmltooling;
using namespace std;
namespace shibsp {
SHIBSP_DLLLOCAL PluginManager<ServiceProvider,string,const DOMElement*>::Factory XMLServiceProviderFactory;
using namespace xmltooling;
using namespace std;
namespace shibsp {
SHIBSP_DLLLOCAL PluginManager<ServiceProvider,string,const DOMElement*>::Factory XMLServiceProviderFactory;
- long SHIBSP_DLLLOCAL sendError(SPRequest& request, const Application* app, const char* page, TemplateParameters& tp, bool mayRedirect=true)
+ long SHIBSP_DLLLOCAL sendError(
+ Category& log, SPRequest& request, const Application* app, const char* page, TemplateParameters& tp, bool mayRedirect=true
+ )
{
// The properties we need can be set in the RequestMap, or the Errors element.
bool mderror = dynamic_cast<const opensaml::saml2md::MetadataException*>(tp.getRichException())!=NULL;
{
// The properties we need can be set in the RequestMap, or the Errors element.
bool mderror = dynamic_cast<const opensaml::saml2md::MetadataException*>(tp.getRichException())!=NULL;
@@
-66,7
+69,7
@@
namespace shibsp {
redirectErrors = settings.first->getString("redirectErrors");
}
catch (exception& ex) {
redirectErrors = settings.first->getString("redirectErrors");
}
catch (exception& ex) {
-
request.log(SPRequest::SPError,
ex.what());
+
log.error(
ex.what());
}
if (mayRedirect) {
}
if (mayRedirect) {
@@
-105,8
+108,7
@@
namespace shibsp {
return request.sendResponse(msg, HTTPResponse::XMLTOOLING_HTTP_STATUS_UNAUTHORIZED);
}
return request.sendResponse(msg, HTTPResponse::XMLTOOLING_HTTP_STATUS_UNAUTHORIZED);
}
- string errstr = string("sendError could not process error template (") + page + ")";
- request.log(SPRequest::SPError, errstr);
+ log.error("sendError could not process error template (%s)", page);
istringstream msg("Internal Server Error. Please contact the site administrator.");
return request.sendError(msg);
}
istringstream msg("Internal Server Error. Please contact the site administrator.");
return request.sendError(msg);
}
@@
-135,6
+137,7
@@
pair<bool,long> ServiceProvider::doAuthentication(SPRequest& request, bool handl
#ifdef _DEBUG
xmltooling::NDC ndc("doAuthentication");
#endif
#ifdef _DEBUG
xmltooling::NDC ndc("doAuthentication");
#endif
+ Category& log = Category::getInstance(SHIBSP_LOGCAT".ServiceProvider");
const Application* app=NULL;
string targetURL = request.getRequestURL();
const Application* app=NULL;
string targetURL = request.getRequestURL();
@@
-163,7
+166,7
@@
pair<bool,long> ServiceProvider::doAuthentication(SPRequest& request, bool handl
else {
TemplateParameters tp;
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
else {
TemplateParameters tp;
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
- return make_pair(true,sendError(request, app, "ssl", tp, false));
+ return make_pair(true,sendError(
log,
request, app, "ssl", tp, false));
}
}
}
}
}
}
@@
-205,7
+208,7
@@
pair<bool,long> ServiceProvider::doAuthentication(SPRequest& request, bool handl
session = request.getSession();
}
catch (exception& e) {
session = request.getSession();
}
catch (exception& e) {
-
request.log(SPRequest::SPWarn, string("error during session lookup: ") +
e.what());
+
log.warn("error during session lookup: %s",
e.what());
// If it's not a retryable session failure, we throw to the outer handler for reporting.
if (dynamic_cast<opensaml::RetryableProfileException*>(&e)==NULL)
throw;
// If it's not a retryable session failure, we throw to the outer handler for reporting.
if (dynamic_cast<opensaml::RetryableProfileException*>(&e)==NULL)
throw;
@@
-220,11
+223,11
@@
pair<bool,long> ServiceProvider::doAuthentication(SPRequest& request, bool handl
const Handler* initiator=NULL;
if (requireSessionWith.first) {
initiator=app->getSessionInitiatorById(requireSessionWith.second);
const Handler* initiator=NULL;
if (requireSessionWith.first) {
initiator=app->getSessionInitiatorById(requireSessionWith.second);
- if (!initiator)
+ if (!initiator)
{
throw ConfigurationException(
throw ConfigurationException(
- "No session initiator found with id ($1), check requireSessionWith command.",
- params(1,requireSessionWith.second)
+ "No session initiator found with id ($1), check requireSessionWith command.", params(1,requireSessionWith.second)
);
);
+ }
}
else {
initiator=app->getDefaultSessionInitiator();
}
else {
initiator=app->getDefaultSessionInitiator();
@@
-237,13
+240,13
@@
pair<bool,long> ServiceProvider::doAuthentication(SPRequest& request, bool handl
// We're done. Everything is okay. Nothing to report. Nothing to do..
// Let the caller decide how to proceed.
// We're done. Everything is okay. Nothing to report. Nothing to do..
// Let the caller decide how to proceed.
-
request.log(SPRequest::SPDebug,
"doAuthentication succeeded");
+
log.debug(
"doAuthentication succeeded");
return make_pair(false,0L);
}
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
return make_pair(false,0L);
}
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
- return make_pair(true,sendError(request, app, "session", tp));
+ return make_pair(true,sendError(
log,
request, app, "session", tp));
}
}
}
}
@@
-252,6
+255,7
@@
pair<bool,long> ServiceProvider::doAuthorization(SPRequest& request) const
#ifdef _DEBUG
xmltooling::NDC ndc("doAuthorization");
#endif
#ifdef _DEBUG
xmltooling::NDC ndc("doAuthorization");
#endif
+ Category& log = Category::getInstance(SHIBSP_LOGCAT".ServiceProvider");
const Application* app=NULL;
string targetURL = request.getRequestURL();
const Application* app=NULL;
string targetURL = request.getRequestURL();
@@
-283,21
+287,21
@@
pair<bool,long> ServiceProvider::doAuthorization(SPRequest& request) const
session = request.getSession(false);
}
catch (exception& e) {
session = request.getSession(false);
}
catch (exception& e) {
-
request.log(SPRequest::SPWarn, string("unable to obtain session to pass to access control provider: ") +
e.what());
+
log.warn("unable to obtain session to pass to access control provider: %s",
e.what());
}
Locker acllock(settings.second);
switch (settings.second->authorized(request,session)) {
case AccessControl::shib_acl_true:
}
Locker acllock(settings.second);
switch (settings.second->authorized(request,session)) {
case AccessControl::shib_acl_true:
-
request.log(SPRequest::SPDebug,
"access control provider granted access");
+
log.debug(
"access control provider granted access");
return make_pair(true,request.returnOK());
case AccessControl::shib_acl_false:
{
return make_pair(true,request.returnOK());
case AccessControl::shib_acl_false:
{
-
request.log(SPRequest::SPWarn,
"access control provider denied access");
+
log.warn(
"access control provider denied access");
TemplateParameters tp;
tp.m_map["requestURL"] = targetURL;
TemplateParameters tp;
tp.m_map["requestURL"] = targetURL;
- return make_pair(true,sendError(request, app, "access", tp, false));
+ return make_pair(true,sendError(
log,
request, app, "access", tp, false));
}
default:
}
default:
@@
-312,7
+316,7
@@
pair<bool,long> ServiceProvider::doAuthorization(SPRequest& request) const
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
- return make_pair(true,sendError(request, app, "access", tp));
+ return make_pair(true,sendError(
log,
request, app, "access", tp));
}
}
}
}
@@
-321,6
+325,7
@@
pair<bool,long> ServiceProvider::doExport(SPRequest& request, bool requireSessio
#ifdef _DEBUG
xmltooling::NDC ndc("doExport");
#endif
#ifdef _DEBUG
xmltooling::NDC ndc("doExport");
#endif
+ Category& log = Category::getInstance(SHIBSP_LOGCAT".ServiceProvider");
const Application* app=NULL;
string targetURL = request.getRequestURL();
const Application* app=NULL;
string targetURL = request.getRequestURL();
@@
-334,7
+339,7
@@
pair<bool,long> ServiceProvider::doExport(SPRequest& request, bool requireSessio
session = request.getSession(false);
}
catch (exception& e) {
session = request.getSession(false);
}
catch (exception& e) {
-
request.log(SPRequest::SPWarn, string("unable to obtain session to export to request: ") +
e.what());
+
log.warn("unable to obtain session to export to request: %s",
e.what());
// If we have to have a session, then this is a fatal error.
if (requireSession)
throw;
// If we have to have a session, then this is a fatal error.
if (requireSession)
throw;
@@
-373,7
+378,7
@@
pair<bool,long> ServiceProvider::doExport(SPRequest& request, bool requireSessio
const PropertySet* sessions=app->getPropertySet("Sessions");
pair<bool,const char*> exportLocation = sessions ? sessions->getString("exportLocation") : pair<bool,const char*>(false,NULL);
if (!exportLocation.first)
const PropertySet* sessions=app->getPropertySet("Sessions");
pair<bool,const char*> exportLocation = sessions ? sessions->getString("exportLocation") : pair<bool,const char*>(false,NULL);
if (!exportLocation.first)
-
request.log(SPRequest::SPWarn,
"can't export assertions without an exportLocation Sessions property");
+
log.warn(
"can't export assertions without an exportLocation Sessions property");
else {
const URLEncoder* encoder = XMLToolingConfig::getConfig().getURLEncoder();
string exportName = "Shib-Assertion-00";
else {
const URLEncoder* encoder = XMLToolingConfig::getConfig().getURLEncoder();
string exportName = "Shib-Assertion-00";
@@
-434,7
+439,7
@@
pair<bool,long> ServiceProvider::doExport(SPRequest& request, bool requireSessio
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
- return make_pair(true,sendError(request, app, "session", tp));
+ return make_pair(true,sendError(
log,
request, app, "session", tp));
}
}
}
}
@@
-443,6
+448,7
@@
pair<bool,long> ServiceProvider::doHandler(SPRequest& request) const
#ifdef _DEBUG
xmltooling::NDC ndc("doHandler");
#endif
#ifdef _DEBUG
xmltooling::NDC ndc("doHandler");
#endif
+ Category& log = Category::getInstance(SHIBSP_LOGCAT".ServiceProvider");
const Application* app=NULL;
string targetURL = request.getRequestURL();
const Application* app=NULL;
string targetURL = request.getRequestURL();
@@
-487,6
+493,6
@@
pair<bool,long> ServiceProvider::doHandler(SPRequest& request) const
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
catch (exception& e) {
TemplateParameters tp(&e);
tp.m_map["requestURL"] = targetURL.substr(0,targetURL.find('?'));
- return make_pair(true,sendError(request, app, "session", tp));
+ return make_pair(true,sendError(
log,
request, app, "session", tp));
}
}
}
}
diff --git
a/shibsp/base.h
b/shibsp/base.h
index
00ecd2d
..
648fce4
100644
(file)
--- a/
shibsp/base.h
+++ b/
shibsp/base.h
@@
-91,7
+91,7
@@
/**
* Logging category for Service Provider functions.
*/
/**
* Logging category for Service Provider functions.
*/
-#define SHIBSP_LOGCAT "Shibboleth
.SP
"
+#define SHIBSP_LOGCAT "Shibboleth"
/**
* Logging category for Service Provider auditing.
/**
* Logging category for Service Provider auditing.