ShibMLPPriv();
~ShibMLPPriv() {}
log4cpp::Category *log;
+
+ static void html_encode(string& os, const char* start);
};
+
+void ShibMLPPriv::html_encode(string& os, const char* start)
+{
+ while (start && *start) {
+ switch (*start) {
+ case '<': os += "<"; break;
+ case '>': os += ">"; break;
+ case '"': os += """; break;
+ case '\'': os += "’"; break;
+ case '(': os += "("; break;
+ case ')': os += ")"; break;
+ case ':': os += ":"; break;
+ default: os += *start;
+ }
+ start++;
+ }
+}
+
ShibMLPPriv::ShibMLPPriv() : log(&(log4cpp::Category::getInstance("shibtarget.ShibMLP"))) {}
static void trimspace (string& s)
#ifdef HAVE_STRCASECMP
if (!strncasecmp(thispos, "<shibmlp ", 9))
#else
- if (!strnicmp(thispos, "<shibmlp ", 9))
+ if (!_strnicmp(thispos, "<shibmlp ", 9))
#endif
{
// Save this position off.
map<string,string>::const_iterator i=m_map.find(key);
if (i != m_map.end()) {
- *output += i->second;
+ m_priv->html_encode(*output,i->second.c_str());
}
else {
pair<bool,const char*> p=props ? props->getString(key.c_str()) : pair<bool,const char*>(false,NULL);
if (p.first) {
- *output += p.second;
+ m_priv->html_encode(*output,p.second);
}
else {
static const char* s1 = "<!-- Unknown SHIBMLP key: ";
#ifdef HAVE_STRCASECMP
else if (!strncasecmp(thispos, "<shibmlpif ", 11))
#else
- else if (!strnicmp(thispos, "<shibmlpif ", 11))
+ else if (!_strnicmp(thispos, "<shibmlpif ", 11))
#endif
{
// Save this position off.
#ifdef HAVE_STRCASECMP
if (!strncasecmp(thispos, "</shibmlpif>", 12))
#else
- if (!strnicmp(thispos, "</shibmlpif>", 12))
+ if (!_strnicmp(thispos, "</shibmlpif>", 12))
#endif
{
// We found our terminator. Process the string in between.
#ifdef HAVE_STRCASECMP
else if (!strncasecmp(thispos, "<shibmlpifnot ", 14))
#else
- else if (!strnicmp(thispos, "<shibmlpifnot ", 14))
+ else if (!_strnicmp(thispos, "<shibmlpifnot ", 14))
#endif
{
// Save this position off.
#ifdef HAVE_STRCASECMP
if (!strncasecmp(thispos, "</shibmlpifnot>", 15))
#else
- if (!strnicmp(thispos, "</shibmlpifnot>", 15))
+ if (!_strnicmp(thispos, "</shibmlpifnot>", 15))
#endif
{
// We found our terminator. Process the string in between.