Code around STL problems.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sun, 24 Aug 2003 22:32:17 +0000 (22:32 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sun, 24 Aug 2003 22:32:17 +0000 (22:32 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@696 cb58f699-b61c-0410-a6fe-9272a202ed29

mod_shibrm/mod_shibrm.cpp
shib-target/shib-ccache.cpp
shib-target/shib-rm.cpp
shib-target/shib-rpcerror.cpp
shib-target/shib-target.h
shib/AAP.cpp
shib/ScopedAttribute.cpp
shib/XMLMetadata.cpp
shib/shib.h
test/shibtest.cpp

index 0e3939d..062ad60 100644 (file)
@@ -39,7 +39,6 @@ namespace {
 
        map<string,string> g_mapAttribNameToHeader;
     map<string,string> g_mapAttribRuleToHeader;
-    map<xstring,string> g_mapAttribNames;
 }
 
 extern "C" const char*
@@ -146,14 +145,6 @@ extern "C" void shibrm_child_init(server_rec* s, pool* p)
     // 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();
-        i!=g_mapAttribNameToHeader.end(); i++)
-    {
-        auto_ptr<XMLCh> temp(XMLString::transcode(i->first.c_str()));
-        g_mapAttribNames[temp.get()]=i->first;
-    }
-    
     ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,s,"shibrm_child_init() done");
 }
 
@@ -428,9 +419,10 @@ extern "C" int shibrm_check_auth(request_rec* r)
             hname=wrapper->getHeader();
         if (!hname)
         {
-               map<xstring,string>::const_iterator iname=g_mapAttribNames.find(attr->getName());
-               if (iname!=g_mapAttribNames.end())
-                       hname=g_mapAttribNameToHeader[iname->second].c_str();
+            auto_ptr<char> tname(XMLString::transcode(attr->getName()));
+               map<string,string>::const_iterator iname=g_mapAttribNameToHeader.find(tname.get());
+               if (iname!=g_mapAttribNameToHeader.end())
+                       hname=iname->second.c_str();
         }
         if (hname)
         {
index 4c5a819..a22475a 100644 (file)
@@ -437,11 +437,11 @@ InternalCCacheEntry::InternalCCacheEntry(SAMLAuthenticationStatement *s, const c
 
   m_subject = s->getSubject();
 
-  xstring name = m_subject->getName();
-  xstring qual = m_subject->getNameQualifier();
+  const XMLCh* name = m_subject->getName();
+  const XMLCh* qual = m_subject->getNameQualifier();
 
-  auto_ptr<char> h(XMLString::transcode(name.c_str()));
-  auto_ptr<char> d(XMLString::transcode(qual.c_str()));
+  auto_ptr<char> h(XMLString::transcode(name));
+  auto_ptr<char> d(XMLString::transcode(qual));
 
   m_handle = h.get();
   m_originSite = d.get();
index 4c44020..5584e02 100644 (file)
@@ -184,7 +184,7 @@ RPCError* RM::getAssertions(const char* cookie, const char* ip,
            Iterator<SAMLCondition*> conds=as->getConditions();
            while (conds.hasNext())
            {
-             SAMLAudienceRestrictionCondition* cond=dynaptr(SAMLAudienceRestrictionCondition,conds.next());
+             SAMLAudienceRestrictionCondition* cond=dynamic_cast<SAMLAudienceRestrictionCondition*>(conds.next());
              if (!cond->eval(ShibTargetConfig::getConfig().getPolicies()))
              {
                m_priv->log->warn("Assertion failed AudienceRestrictionCondition check, skipping it...");
index 2cad73a..d5b360a 100644 (file)
@@ -154,7 +154,7 @@ public:
 
   int          status;
   string       error_msg;
-  xstring      origin;
+  XMLCh*       origin;
   SAMLException* except;
 };
 
@@ -166,7 +166,7 @@ RPCErrorPriv::RPCErrorPriv(int stat, const char* msg, const XMLCh* originSite)
 
   rpcerror_init();
 
-  if (originSite) origin = originSite;
+  origin = XMLString::replicate(originSite);
 
   if (status == SHIBRPC_SAML_EXCEPTION) {
     istringstream estr(msg);
@@ -185,7 +185,7 @@ RPCErrorPriv::RPCErrorPriv(int stat, const char* msg, const XMLCh* originSite)
       log.error ("Caught exception building SAMLException!");
       log.error ("XML: %s", msg);
     }
-    if (dynaptr(ContentTypeException, except)!=NULL)
+    if (dynamic_cast<ContentTypeException*>(except)!=NULL)
         error_msg = 
          "We were unable to contact your identity provider and cannot grant "
          "access at this time. Please contact your provider's help desk or "
@@ -204,6 +204,8 @@ RPCErrorPriv::~RPCErrorPriv()
 {
   if (except)
     delete except;
+  if (origin)
+      XMLString::release(&origin);
 }
 
 RPCError::RPCError(ShibRpcError* error)
@@ -308,9 +310,9 @@ int RPCError::getCode() { return m_priv->status; }
 string RPCError::getOriginErrorURL()
 {
     string res="No URL Available";
-    if (!m_priv->origin.empty())
+    if (m_priv->origin)
     {
-        OriginMetadata mapper(m_priv->origin.c_str());
+        OriginMetadata mapper(m_priv->origin);
         if (!mapper.fail())
         {
             const char* temp=mapper->getErrorURL();
@@ -324,9 +326,9 @@ string RPCError::getOriginErrorURL()
 string RPCError::getOriginContactName()
 { 
     string res="No Name Available";
-    if (!m_priv->origin.empty())
+    if (m_priv->origin)
     {
-        OriginMetadata mapper(m_priv->origin.c_str());
+        OriginMetadata mapper(m_priv->origin);
         Iterator<const IContactInfo*> i=
             mapper.fail() ? EMPTY(const IContactInfo*) : mapper->getContacts();
         while (i.hasNext())
@@ -345,9 +347,9 @@ string RPCError::getOriginContactName()
 string RPCError::getOriginContactEmail()
 {
     string res="No Email Available";
-    if (!m_priv->origin.empty())
+    if (m_priv->origin)
     {
-        OriginMetadata mapper(m_priv->origin.c_str());
+        OriginMetadata mapper(m_priv->origin);
         Iterator<const IContactInfo*> i=
             mapper.fail() ? EMPTY(const IContactInfo*) : mapper->getContacts();
         while (i.hasNext())
index e349368..56ee8d0 100644 (file)
@@ -216,22 +216,20 @@ namespace shibtarget {
   class SHIBTARGET_EXPORTS ShibTargetException : public std::exception
   {
   public:
-    explicit ShibTargetException() { m_code = SHIBRPC_OK; }
-    explicit ShibTargetException(ShibRpcStatus code, const char* msg,
-                                const XMLCh* origin = NULL)
-       { m_code = code; if (msg) m_msg=msg; if (origin) m_origin = origin; }
-    explicit ShibTargetException(ShibRpcStatus code, const std::string& msg,
-                                const XMLCh* origin = NULL) : m_msg(msg)
-       { m_code=code; if(origin) m_origin = origin; }
-    virtual ~ShibTargetException() throw () {}
+    explicit ShibTargetException() : m_origin(NULL), m_code(SHIBRPC_OK) {}
+    explicit ShibTargetException(ShibRpcStatus code, const char* msg, const XMLCh* origin = NULL) : m_code(code)
+    { if (msg) m_msg=msg; m_origin = XMLString::replicate(origin); }
+    explicit ShibTargetException(ShibRpcStatus code, const std::string& msg, const XMLCh* origin = NULL) : m_msg(msg)
+       { m_code=code; m_origin = XMLString::replicate(origin); }
+    virtual ~ShibTargetException() throw () { if (m_origin) XMLString::release(&m_origin); }
     virtual const char* what() const throw () { return (m_msg.c_str()); }
     virtual ShibRpcStatus which() const throw () { return (m_code); }
-    virtual const XMLCh* where() const throw () { return m_origin.c_str(); }
+    virtual const XMLCh* where() const throw () { return m_origin; }
 
   private:
-    ShibRpcStatus      m_code;
-    std::string                m_msg;
-    saml::xstring      m_origin;
+    ShibRpcStatus m_code;
+    std::string m_msg;
+    XMLCh* m_origin;
   };
 
   class RPCErrorPriv;
index 523ecc2..f413cac 100644 (file)
@@ -110,12 +110,22 @@ public:
         };
 
         SiteRule m_anySiteRule;
-        map<xstring,SiteRule> m_siteMap;
+#ifdef HAVE_GOOD_STL
+        typedef map<xstring,SiteRule> sitemap_t;
+#else
+        typedef map<string,SiteRule> sitemap_t;
+#endif
+        sitemap_t m_siteMap;
     };
 
     vector<const IAttributeRule*> m_attrs;
     map<string,const IAttributeRule*> m_aliasMap;
-    map<xstring,AttributeRule*> m_attrMap;
+#ifdef HAVE_GOOD_STL
+    typedef map<xstring,AttributeRule*> attrmap_t;
+#else
+    typedef map<string,AttributeRule*> attrmap_t;
+#endif
+    attrmap_t m_attrMap;
     DOMDocument* m_doc;
 };
 
@@ -147,7 +157,22 @@ XMLAAPImpl::XMLAAPImpl(const char* pathname) : m_doc(NULL)
         for (int i=0; nlist && i<nlist->getLength(); i++)
         {
             AttributeRule* rule=new AttributeRule(static_cast<DOMElement*>(nlist->item(i)));
-            m_attrMap[xstring(rule->getName()) + chBang + chBang + (rule->getNamespace() ? rule->getNamespace() : Constants::SHIB_ATTRIBUTE_NAMESPACE_URI)]=rule;
+#ifdef HAVE_GOOD_STL
+            xstring key=rule->getName();
+            key=key + chBang + chBang + (rule->getNamespace() ? rule->getNamespace() : Constants::SHIB_ATTRIBUTE_NAMESPACE_URI);
+#else
+            auto_ptr<char> aname(XMLString::transcode(rule->getName()));
+            string key(aname.get());
+            key+="!!";
+            if (rule->getNamespace())
+            {
+                auto_ptr<char> ans(XMLString::transcode(rule->getNamespace()));
+                key+=ans.get();
+            }
+            else
+                key+="urn:mace:shibboleth:1.0:attributeNamespace:uri";
+#endif
+            m_attrMap[key]=rule;
             m_attrs.push_back(rule);
             if (rule->getAlias())
                 m_aliasMap[rule->getAlias()]=rule;
@@ -156,7 +181,7 @@ XMLAAPImpl::XMLAAPImpl(const char* pathname) : m_doc(NULL)
     catch (SAMLException& e)
     {
         log.errorStream() << "XML error while parsing AAP: " << e.what() << CategoryStream::ENDLINE;
-        for (map<xstring,AttributeRule*>::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
+        for (attrmap_t::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
             delete i->second;
         if (m_doc)
             m_doc->release();
@@ -165,7 +190,7 @@ XMLAAPImpl::XMLAAPImpl(const char* pathname) : m_doc(NULL)
     catch (...)
     {
         log.error("Unexpected error while parsing AAP");
-        for (map<xstring,AttributeRule*>::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
+        for (attrmap_t::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
             delete i->second;
         if (m_doc)
             m_doc->release();
@@ -176,7 +201,7 @@ XMLAAPImpl::XMLAAPImpl(const char* pathname) : m_doc(NULL)
 
 XMLAAPImpl::~XMLAAPImpl()
 {
-    for (map<xstring,AttributeRule*>::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
+    for (attrmap_t::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
     {
         SAMLAttribute::unregFactory(i->second->getName(),i->second->getNamespace());
         delete i->second;
@@ -187,7 +212,7 @@ XMLAAPImpl::~XMLAAPImpl()
 
 void XMLAAPImpl::regAttributes() const
 {
-    for (map<xstring,AttributeRule*>::const_iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
+    for (attrmap_t::const_iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
     {
         SAMLAttributeFactory* f=ShibConfig::getConfig().getAttributeFactory(i->second->getFactory());
         if (f)
@@ -259,8 +284,15 @@ XMLAAPImpl::AttributeRule::AttributeRule(const DOMElement* e) :
     DOMNodeList* slist = e->getElementsByTagNameNS(XML::SHIB_NS,SHIB_L(SiteRule));
     for (int k=0; slist && k<slist->getLength(); k++)
     {
-        m_siteMap[static_cast<DOMElement*>(slist->item(k))->getAttributeNS(NULL,SHIB_L(Name))]=SiteRule();
-        SiteRule& srule=m_siteMap[static_cast<DOMElement*>(slist->item(k))->getAttributeNS(NULL,SHIB_L(Name))];
+        const XMLCh* srulename=static_cast<DOMElement*>(slist->item(k))->getAttributeNS(NULL,SHIB_L(Name));
+#ifdef HAVE_GOOD_STL
+        m_siteMap[srulename]=SiteRule();
+        SiteRule& srule=m_siteMap[srulename];
+#else
+        auto_ptr<char> srulename2(XMLString::transcode(srulename));
+        m_siteMap[srulename2.get()]=SiteRule();
+        SiteRule& srule=m_siteMap[srulename2.get()];
+#endif
 
         // Process Scope elements.
         DOMNodeList* vlist = static_cast<DOMElement*>(slist->item(k))->getElementsByTagNameNS(XML::SHIB_NS,SHIB_L(Scope));
@@ -393,9 +425,22 @@ void XMLAAP::unlock()
 
 const IAttributeRule* XMLAAP::lookup(const XMLCh* attrName, const XMLCh* attrNamespace) const
 {
-    map<xstring,XMLAAPImpl::AttributeRule*>::const_iterator i=m_impl->m_attrMap.find(
-        xstring(attrName) + chBang + chBang + (attrNamespace ? attrNamespace : Constants::SHIB_ATTRIBUTE_NAMESPACE_URI)
-        );
+#ifdef HAVE_GOOD_STL
+    xstring key=attrName;
+    key=key + chBang + chBang + (attrNamespace ? attrNamespace : Constants::SHIB_ATTRIBUTE_NAMESPACE_URI);
+#else
+    auto_ptr<char> aname(XMLString::transcode(attrName));
+    string key=aname.get();
+    key+="!!";
+    if (attrNamespace)
+    {
+        auto_ptr<char> ans(XMLString::transcode(attrNamespace));
+        key+=ans.get();
+    }
+    else
+        key+="urn:mace:shibboleth:1.0:attributeNamespace:uri";
+#endif
+    XMLAAPImpl::attrmap_t::const_iterator i=m_impl->m_attrMap.find(key);
     return (i==m_impl->m_attrMap.end()) ? NULL : i->second;
 }
 
@@ -461,7 +506,13 @@ bool XMLAAPImpl::AttributeRule::scopeCheck(const XMLCh* originSite, const DOMEle
             log.warn("scope checking does not permit XPath rules");
     }
 
-    map<xstring,SiteRule>::const_iterator srule=m_siteMap.find(originSite);
+#ifdef HAVE_GOOD_STL
+    const XMLCh* os=originSite;
+#else
+    auto_ptr<char> pos(XMLString::transcode(originSite));
+    const char* os=pos.get();
+#endif
+    sitemap_t::const_iterator srule=m_siteMap.find(os);
     if (srule!=m_siteMap.end())
     {
         // Site-specific denials...
@@ -570,7 +621,13 @@ bool XMLAAPImpl::AttributeRule::accept(const XMLCh* originSite, const DOMElement
             log.warn("implementation does not support XPath value rules");
     }
 
-    map<xstring,SiteRule>::const_iterator srule=m_siteMap.find(originSite);
+#ifdef HAVE_GOOD_STL
+    const XMLCh* os=originSite;
+#else
+    auto_ptr<char> pos(XMLString::transcode(originSite));
+    const char* os=pos.get();
+#endif
+    sitemap_t::const_iterator srule=m_siteMap.find(os);
     if (srule==m_siteMap.end())
     {
         if (log.isWarnEnabled())
index e55a03b..272f918 100644 (file)
@@ -75,34 +75,60 @@ ScopedAttribute::ScopedAttribute(const XMLCh* name, const XMLCh* ns, long lifeti
         throw MalformedException(SAMLException::RESPONDER,"ScopedAttribute() requires the number of scopes to equal the number of values");
 
     while (scopes.hasNext())
-        m_values.push_back(scopes.next());
+        m_scopes.push_back(XMLString::replicate(scopes.next()));
 }
 
 ScopedAttribute::ScopedAttribute(DOMElement* e) : SimpleAttribute(e) {}
 
-ScopedAttribute::~ScopedAttribute() {}
+ScopedAttribute::~ScopedAttribute()
+{
+    if (m_bOwnStrings)
+    {
+        for (vector<const XMLCh*>::iterator i=m_scopes.begin(); i!=m_scopes.end(); i++)
+        {
+            XMLCh* p = const_cast<XMLCh*>(*i);
+            XMLString::release(&p);
+        }
+    }
+
+    // We always own any scoped values we've built.
+    for (vector<const XMLCh*>::iterator i=m_scopedValues.begin(); i!=m_scopedValues.end(); i++)
+    {
+        XMLCh* p = const_cast<XMLCh*>(*i);
+        XMLString::release(&p);
+    }
+}
 
 bool ScopedAttribute::addValue(DOMElement* e)
 {
-    static XMLCh empty[] = {chNull};
     if (SAMLAttribute::addValue(e))
     {
         DOMAttr* scope=e->getAttributeNodeNS(NULL,SHIB_L(Scope));
-        m_scopes.push_back(scope ? scope->getNodeValue() : empty);
+        m_scopes.push_back(scope ? scope->getNodeValue() : &chNull);
         return true;
     }
     return false;
 }
 
-Iterator<xstring> ScopedAttribute::getValues() const
+Iterator<const XMLCh*> ScopedAttribute::getValues() const
 {
+    static XMLCh at[]={chAt, chNull};
+
     if (m_scopedValues.empty())
     {
-        vector<xstring>::const_iterator j=m_scopes.begin();
-        for (vector<xstring>::const_iterator i=m_values.begin(); i!=m_values.end(); i++, j++)
-            m_scopedValues.push_back((*i) + chAt + (!j->empty() ? (*j) : m_originSite));
+        vector<const XMLCh*>::const_iterator j=m_scopes.begin();
+        for (vector<const XMLCh*>::const_iterator i=m_values.begin(); i!=m_values.end(); i++, j++)
+        {
+            const XMLCh* scope=((*j) ? (*j) : m_originSite);
+            XMLCh* temp=new XMLCh[XMLString::stringLen(*i) + XMLString::stringLen(scope) + 2];
+            temp[0]=chNull;
+            XMLString::catString(temp,*i);
+            XMLString::catString(temp,at);
+            XMLString::catString(temp,scope);
+            m_scopedValues.push_back(temp);
+        }
     }
-    return Iterator<xstring>(m_scopedValues);
+    return m_scopedValues;
 }
 
 Iterator<string> ScopedAttribute::getSingleByteValues() const
@@ -110,9 +136,9 @@ Iterator<string> ScopedAttribute::getSingleByteValues() const
     getValues();
     if (m_sbValues.empty())
     {
-        for (vector<xstring>::const_iterator i=m_scopedValues.begin(); i!=m_scopedValues.end(); i++)
+        for (vector<const XMLCh*>::const_iterator i=m_scopedValues.begin(); i!=m_scopedValues.end(); i++)
         {
-            auto_ptr<char> temp(toUTF8(i->c_str()));
+            auto_ptr<char> temp(toUTF8(*i));
             if (temp.get())
                 m_sbValues.push_back(temp.get());
         }
@@ -122,10 +148,7 @@ Iterator<string> ScopedAttribute::getSingleByteValues() const
 
 SAMLObject* ScopedAttribute::clone() const
 {
-    ScopedAttribute* dest=new ScopedAttribute(m_name,m_namespace,m_lifetime);
-    dest->m_values.assign(m_values.begin(),m_values.end());
-    dest->m_scopes.assign(m_scopes.begin(),m_scopes.end());
-    return dest;
+    return new ScopedAttribute(m_name,m_namespace,m_lifetime,m_scopes,m_values);
 }
 
 DOMNode* ScopedAttribute::toDOM(DOMDocument* doc,bool xmlns) const
@@ -138,7 +161,7 @@ DOMNode* ScopedAttribute::toDOM(DOMDocument* doc,bool xmlns) const
     {
         if (n->getNodeType()==DOMNode::ELEMENT_NODE)
         {
-            static_cast<DOMElement*>(n)->setAttributeNS(NULL,SHIB_L(Scope),m_scopes[i].c_str());
+            static_cast<DOMElement*>(n)->setAttributeNS(NULL,SHIB_L(Scope),m_scopes[i]);
             i++;
         }
         n=n->getNextSibling();
index 20bddbe..bf44b39 100644 (file)
@@ -131,7 +131,12 @@ public:
         vector<const XMLCh*> m_groups;
     };
 
-    std::map<saml::xstring,OriginSite*> m_sites;
+#ifdef HAVE_GOOD_STL
+    typedef map<xstring,OriginSite*> sitemap_t;
+#else
+    typedef map<string,OriginSite*> sitemap_t;
+#endif
+    sitemap_t m_sites;
     DOMDocument* m_doc;
 };
 
@@ -178,8 +183,13 @@ XMLMetadataImpl::XMLMetadataImpl(const char* pathname) : m_doc(NULL)
 
             OriginSite* os_obj =
                 new OriginSite(os_name,static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,XML::Literals::ErrorURL));
+#ifdef HAVE_GOOD_STL
             m_sites[os_name]=os_obj;
-            
+#else
+            auto_ptr<char> os_name2(XMLString::transcode(os_name));
+            m_sites[os_name2.get()]=os_obj;
+#endif
+
             // Record all the SiteGroups containing this site.
             DOMNode* group=nlist->item(i)->getParentNode();
             while (group && group->getNodeType()==DOMNode::ELEMENT_NODE)
@@ -254,7 +264,7 @@ XMLMetadataImpl::XMLMetadataImpl(const char* pathname) : m_doc(NULL)
     catch (SAMLException& e)
     {
         log.errorStream() << "XML error while parsing site configuration: " << e.what() << CategoryStream::ENDLINE;
-        for (map<xstring,OriginSite*>::iterator i=m_sites.begin(); i!=m_sites.end(); i++)
+        for (sitemap_t::iterator i=m_sites.begin(); i!=m_sites.end(); i++)
             delete i->second;
         if (m_doc)
             m_doc->release();
@@ -263,7 +273,7 @@ XMLMetadataImpl::XMLMetadataImpl(const char* pathname) : m_doc(NULL)
     catch (...)
     {
         log.error("Unexpected error while parsing site configuration");
-        for (map<xstring,OriginSite*>::iterator i=m_sites.begin(); i!=m_sites.end(); i++)
+        for (sitemap_t::iterator i=m_sites.begin(); i!=m_sites.end(); i++)
             delete i->second;
         if (m_doc)
             m_doc->release();
@@ -273,7 +283,7 @@ XMLMetadataImpl::XMLMetadataImpl(const char* pathname) : m_doc(NULL)
 
 XMLMetadataImpl::~XMLMetadataImpl()
 {
-    for (map<xstring,OriginSite*>::iterator i=m_sites.begin(); i!=m_sites.end(); i++)
+    for (sitemap_t::iterator i=m_sites.begin(); i!=m_sites.end(); i++)
         delete i->second;
     if (m_doc)
         m_doc->release();
@@ -356,6 +366,11 @@ void XMLMetadata::unlock()
 
 const ISite* XMLMetadata::lookup(const XMLCh* site) const
 {
-    map<xstring,XMLMetadataImpl::OriginSite*>::const_iterator i=m_impl->m_sites.find(site);
+#ifdef HAVE_GOOD_STL
+    XMLMetadataImpl::sitemap_t::const_iterator i=m_impl->m_sites.find(site);
+#else
+    auto_ptr<char> temp(XMLString::transcode(site));
+    XMLMetadataImpl::sitemap_t::const_iterator i=m_impl->m_sites.find(temp.get());
+#endif
     return (i==m_impl->m_sites.end()) ? NULL : i->second;
 }
index bd8ace0..27b7840 100644 (file)
@@ -84,14 +84,14 @@ namespace shibboleth
         class SHIB_EXPORTS name : public saml::base \
         { \
         public: \
-            name(const char* msg) : saml::base(msg) {RTTI(name); m_typename=#name;} \
-            name(const std::string& msg) : saml::base(msg) {RTTI(name); m_typename=#name;} \
-            name(const saml::Iterator<saml::QName>& codes, const char* msg) : saml::base(codes,msg) {RTTI(name); m_typename=#name;} \
-            name(const saml::Iterator<saml::QName>& codes, const std::string& msg) : saml::base(codes, msg) {RTTI(name); m_typename=#name;} \
-            name(const saml::QName& code, const char* msg) : saml::base(code,msg) {RTTI(name); m_typename=#name;} \
-            name(const saml::QName& code, const std::string& msg) : saml::base(code, msg) {RTTI(name); m_typename=#name;} \
-            name(DOMElement* e) : saml::base(e) {RTTI(name); m_typename=#name;} \
-            name(std::istream& in) : saml::base(in) {RTTI(name); m_typename=#name;} \
+            name(const char* msg) : saml::base(msg) {RTTI(name);} \
+            name(const std::string& msg) : saml::base(msg) {RTTI(name);} \
+            name(const saml::Iterator<saml::QName>& codes, const char* msg) : saml::base(codes,msg) {RTTI(name);} \
+            name(const saml::Iterator<saml::QName>& codes, const std::string& msg) : saml::base(codes, msg) {RTTI(name);} \
+            name(const saml::QName& code, const char* msg) : saml::base(code,msg) {RTTI(name);} \
+            name(const saml::QName& code, const std::string& msg) : saml::base(code, msg) {RTTI(name);} \
+            name(DOMElement* e) : saml::base(e) {RTTI(name);} \
+            name(std::istream& in) : saml::base(in) {RTTI(name);} \
             virtual ~name() throw () {} \
         }
 
@@ -179,8 +179,8 @@ namespace shibboleth
     const unsigned short RTTI_UnsupportedProtocolException=     RTTI_EXTENSION_BASE;
     const unsigned short RTTI_MetadataException=                RTTI_EXTENSION_BASE+1;
 # endif
-    template class SHIB_EXPORTS saml::Iterator<std::pair<saml::xstring,bool> >;
-    template class SHIB_EXPORTS saml::ArrayIterator<std::pair<saml::xstring,bool> >;
+//    template class SHIB_EXPORTS saml::Iterator<std::pair<saml::xstring,bool> >;
+//    template class SHIB_EXPORTS saml::ArrayIterator<std::pair<saml::xstring,bool> >;
     template class SHIB_EXPORTS saml::Iterator<const IContactInfo*>;
     template class SHIB_EXPORTS saml::ArrayIterator<const IContactInfo*>;
     template class SHIB_EXPORTS saml::Iterator<const IAuthority*>;
@@ -222,14 +222,14 @@ namespace shibboleth
         virtual DOMNode* toDOM(DOMDocument* doc=NULL, bool xmlns=true) const;
         virtual saml::SAMLObject* clone() const;
 
-        virtual saml::Iterator<saml::xstring> getValues() const;
+        virtual saml::Iterator<const XMLCh*> getValues() const;
         virtual saml::Iterator<std::string> getSingleByteValues() const;
 
     protected:
         virtual bool addValue(DOMElement* e);
 
-        std::vector<saml::xstring> m_scopes;
-        mutable std::vector<saml::xstring> m_scopedValues;
+        std::vector<const XMLCh*> m_scopes;
+        mutable std::vector<const XMLCh*> m_scopedValues;
     };
 
     class SHIB_EXPORTS ShibPOSTProfile
index 7e4041c..e4dbda6 100644 (file)
@@ -139,11 +139,11 @@ int main(int argc,char* argv[])
                     {
                         SAMLAttribute* attr=attrs.next();
                         cout << "Attribute Name: "; xmlout(cout,attr->getName()); cout << endl;
-                        Iterator<xstring> vals=attr->getValues();
+                        Iterator<const XMLCh*> vals=attr->getValues();
                         while (vals.hasNext())
                         {
                             cout << "Attribute Value: ";
-                            xmlout(cout,vals.next().c_str());
+                            xmlout(cout,vals.next());
                             cout << endl;
                         }
                     }