https://issues.shibboleth.net/jira/browse/CPPOST-34
[shibboleth/cpp-opensaml.git] / saml / signature / ContentReference.cpp
index 452ee09..ffc7708 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2009 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ void ContentReference::createReferences(DSIGSignature* sig)
     ref->appendEnvelopedSignatureTransform();
     DSIGTransformC14n* c14n=ref->appendCanonicalizationTransform(m_c14n ? m_c14n : DSIGConstants::s_unicodeStrURIEXC_C14N_NOC);
     if (!m_c14n || m_c14n == DSIGConstants::s_unicodeStrURIEXC_C14N_NOC || m_c14n == DSIGConstants::s_unicodeStrURIEXC_C14N_COM) {
-        //addPrefixes(m_signableObject);
+        addPrefixes(m_signableObject);
 #ifdef HAVE_GOOD_STL
         xstring prefixes;
         for (set<xstring>::const_iterator p = m_prefixes.begin(); p!=m_prefixes.end(); ++p)
@@ -94,8 +94,11 @@ void ContentReference::addInclusivePrefix(const XMLCh* prefix)
 
 void ContentReference::addPrefixes(const std::set<Namespace>& namespaces)
 {
-    for (set<Namespace>::const_iterator n = namespaces.begin(); n!=namespaces.end(); ++n)
-        addInclusivePrefix(n->getNamespacePrefix());
+    for (set<Namespace>::const_iterator n = namespaces.begin(); n!=namespaces.end(); ++n) {
+        // Check for xmlns:xml.
+        if (!XMLString::equals(n->getNamespacePrefix(), xmlconstants::XML_PREFIX) || !XMLString::equals(n->getNamespaceURI(), xmlconstants::XML_NS))
+            addInclusivePrefix(n->getNamespacePrefix());
+    }
 }
 
 void ContentReference::addPrefixes(const XMLObject& xmlObject)