Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2007-01-23 21:48:18 +0300
committerAtsushi Eno <atsushieno@gmail.com>2007-01-23 21:48:18 +0300
commit037c955757a9d2ca1c886a6a01972c5e0038f2e8 (patch)
treec132b99838e16e6bf92ddbb9eff34105d0c15bc4
parent8dae7307e894c8084c0929c7565d02bbaba18427 (diff)
2007-01-23 Atsushi Enomoto <atsushi@ximian.com>
* DataObject.cs : it should not append created DataObject element to the owner document. It affects on XPath selection, though currently SignedXml.GetReferenceHash() is bogus so I cannot add meaningful tests for it. * XmlCanonicalizer.cs : in Canonicalize(XmlNodeList), nodes [0] could be XmlDocument and thus it could cause NullReferenceException. svn path=/trunk/mcs/; revision=71540
-rw-r--r--mcs/class/System.Security/Mono.Xml/ChangeLog5
-rw-r--r--mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs5
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog7
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs7
4 files changed, 17 insertions, 7 deletions
diff --git a/mcs/class/System.Security/Mono.Xml/ChangeLog b/mcs/class/System.Security/Mono.Xml/ChangeLog
index 502863cc6c9..3e4652c3f2f 100644
--- a/mcs/class/System.Security/Mono.Xml/ChangeLog
+++ b/mcs/class/System.Security/Mono.Xml/ChangeLog
@@ -1,5 +1,10 @@
2007-01-23 Atsushi Enomoto <atsushi@ximian.com>
+ * XmlCanonicalizer.cs : in Canonicalize(XmlNodeList), nodes [0] could
+ be XmlDocument and thus it could cause NullReferenceException.
+
+2007-01-23 Atsushi Enomoto <atsushi@ximian.com>
+
* XmlCanonicalizer.cs : it should be reset before being reused.
2007-01-22 Atsushi Enomoto <atsushi@ximian.com>
diff --git a/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs b/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs
index 9da0c48a363..b750e3426e4 100644
--- a/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs
+++ b/mcs/class/System.Security/Mono.Xml/XmlCanonicalizer.cs
@@ -78,6 +78,8 @@ namespace Mono.Xml {
public Stream Canonicalize (XmlDocument doc)
{
+ if (doc == null)
+ throw new ArgumentNullException ("doc");
Initialize ();
WriteDocumentNode (doc);
@@ -92,7 +94,8 @@ namespace Mono.Xml {
xnl = nodes;
if (nodes == null || nodes.Count < 1)
return new MemoryStream ();
- return Canonicalize (nodes[0].OwnerDocument);
+ XmlNode n = nodes [0];
+ return Canonicalize (n.NodeType == XmlNodeType.Document ? n as XmlDocument : n.OwnerDocument);
}
// See xml-enc-c14n specification
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
index 78fca9cdbf0..4f62ac57972 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-23 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DataObject.cs : it should not append created DataObject element to
+ the owner document. It affects on XPath selection, though currently
+ SignedXml.GetReferenceHash() is bogus so I cannot add meaningful
+ tests for it.
+
2007-01-22 Atsushi Enomoto <atsushi@ximian.com>
* SignedInfo.cs : removed incorrect CanonicalizationMethodObject
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs
index d50ac992e4d..bd7c529f137 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/DataObject.cs
@@ -72,9 +72,7 @@ namespace System.Security.Cryptography.Xml {
XmlNode newNode = document.ImportNode (data, true);
xel.AppendChild (newNode);
}
- document.AppendChild (xel); // FIXME: it should not be appended
-
- element = document.DocumentElement;
+ element = xel;
}
// why is data a XmlNodeList instead of a XmlElement ?
@@ -87,7 +85,6 @@ namespace System.Security.Cryptography.Xml {
throw new ArgumentNullException ("value");
XmlDocument doc = new XmlDocument ();
XmlElement el = (XmlElement) doc.ImportNode (element, true);
- doc.AppendChild (el); // FIXME: it should not be appended
while (el.LastChild != null)
el.RemoveChild (el.LastChild);
foreach (XmlNode n in value)
@@ -132,7 +129,6 @@ namespace System.Security.Cryptography.Xml {
else {
XmlDocument document = new XmlDocument ();
XmlElement el = document.ImportNode (element, true) as XmlElement;
- document.AppendChild (el); // FIXME: it should not be appended
el.SetAttribute (attribute, value);
element = el;
propertyModified = true;
@@ -146,7 +142,6 @@ namespace System.Security.Cryptography.Xml {
XmlElement oldElement = element;
XmlDocument doc = new XmlDocument ();
element = doc.CreateElement (XmlSignature.ElementNames.Object, XmlSignature.NamespaceURI);
- doc.AppendChild (element); // FIXME: it should not be appended
foreach (XmlAttribute attribute in oldElement.Attributes) {
switch (attribute.Name) {
case XmlSignature.AttributeNames.Id: