Path resolution for error templates.
[shibboleth/sp.git] / shibsp / handler / impl / LogoutHandler.cpp
index 5342397..3ef1cd2 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <fstream>
 #include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/util/PathResolver.h>
 #include <xmltooling/util/URLEncoder.h>
 
 using namespace shibsp;
@@ -40,17 +41,19 @@ pair<bool,long> LogoutHandler::sendLogoutPage(
     const Application& application, const HTTPRequest& request, HTTPResponse& response, bool local, const char* status
     ) const
 {
-    pair<bool,const char*> prop = application.getString(local ? "localLogout" : "globalLogout");
+    const PropertySet* props = application.getPropertySet("Errors");
+    pair<bool,const char*> prop = props ? props->getString(local ? "localLogout" : "globalLogout") : pair<bool,const char*>(false,NULL);
     if (prop.first) {
         response.setContentType("text/html");
         response.setResponseHeader("Expires","01-Jan-1997 12:00:00 GMT");
         response.setResponseHeader("Cache-Control","private,no-store,no-cache");
-        ifstream infile(prop.second);
+        string fname(prop.second);
+        ifstream infile(XMLToolingConfig::getConfig().getPathResolver()->resolve(fname, PathResolver::XMLTOOLING_CFG_FILE).c_str());
         if (!infile)
             throw ConfigurationException("Unable to access $1 HTML template.", params(1,local ? "localLogout" : "globalLogout"));
         TemplateParameters tp;
         tp.m_request = &request;
-        tp.setPropertySet(application.getPropertySet("Errors"));
+        tp.setPropertySet(props);
         if (status)
             tp.m_map["logoutStatus"] = status;
         stringstream str;