[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Class Library (pnetlib)
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Class Library (pnetlib) branch, master, updated. 32a628eb0d4de16e8a7754edf9bdd622ca7d413c |
Date: |
Mon, 15 Mar 2010 18:56:58 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET Class Library (pnetlib)".
The branch, master has been updated
via 32a628eb0d4de16e8a7754edf9bdd622ca7d413c (commit)
from 3e9ace578aeacadca58a7b6ae0756c80d703f07b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnetlib.git/commit/?id=32a628eb0d4de16e8a7754edf9bdd622ca7d413c
commit 32a628eb0d4de16e8a7754edf9bdd622ca7d413c
Author: Klaus Treichel <address@hidden>
Date: Mon Mar 15 19:56:33 2010 +0100
Add the System.Xml.XmlSecureResolver class and fix some access permissions.
diff --git a/ChangeLog b/ChangeLog
index e3b3756..73d681b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-15 Klaus Treichel <address@hidden>
+
+ * System.Xml/XmlSecureResolver.cs: Added
+
2010-03-14 Klaus Treichel <address@hidden>
* System/Net/Security/AuthenticationLevel.cs,
diff --git a/System.Xml/ConformanceLevel.cs b/System.Xml/ConformanceLevel.cs
old mode 100755
new mode 100644
diff --git a/System.Xml/NewLineHandling.cs b/System.Xml/NewLineHandling.cs
old mode 100755
new mode 100644
diff --git a/System.Xml/XmlOutputMethod.cs b/System.Xml/XmlOutputMethod.cs
old mode 100755
new mode 100644
diff --git a/System.Xml/XmlSecureResolver.cs b/System.Xml/XmlSecureResolver.cs
new file mode 100644
index 0000000..4a6944b
--- /dev/null
+++ b/System.Xml/XmlSecureResolver.cs
@@ -0,0 +1,141 @@
+/*
+ * XmlSecureResolver.cs - Implementation of the
+ * "System.Xml.XmlSecureResolver"
class.
+ *
+ * Copyright (C) 2010 Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+namespace System.Xml
+{
+
+#if !ECMA_COMPAT && CONFIG_PERMISSIONS && CONFIG_POLICY_OBJECTS
+
+ using System.Net;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.Security.Policy;
+
+ [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
+ public class XmlSecureResolver : XmlResolver
+ {
+
+ private XmlResolver resolver;
+ private PermissionSet permissionSet;
+
+ // Constructors
+ public XmlSecureResolver(XmlResolver resolver,
+ PermissionSet
permissionSet)
+ {
+ this.resolver = resolver;
+ this.permissionSet = permissionSet;
+ }
+
+ public XmlSecureResolver(XmlResolver resolver,
+ Evidence
evidence)
+ {
+ this.resolver = resolver;
+ if(SecurityManager.SecurityEnabled)
+ {
+ this.permissionSet =
SecurityManager.ResolvePolicy(evidence);
+ }
+ }
+
+ public XmlSecureResolver(XmlResolver resolver,
+ string
securityUrl)
+ {
+ this.resolver = resolver;
+ if(SecurityManager.SecurityEnabled)
+ {
+ this.permissionSet =
+ SecurityManager.ResolvePolicy
+
(CreateEvidenceForUrl(securityUrl));
+ }
+ }
+
+ // static members
+ public static Evidence CreateEvidenceForUrl(string securityUrl)
+ {
+ Evidence evidence = new Evidence();
+
+ if((securityUrl != null) && (securityUrl.Length > 0))
+ {
+ try
+ {
+ Url url = new Url(securityUrl);
+ evidence.AddHost(url);
+ }
+ catch(ArgumentException)
+ {
+ }
+
+ try
+ {
+ Zone zone =
Zone.CreateFromUrl(securityUrl);
+ evidence.AddHost(zone);
+ }
+ catch (ArgumentException)
+ {
+ }
+
+ try
+ {
+ Site site =
Site.CreateFromUrl(securityUrl);
+ evidence.AddHost(site);
+ }
+ catch (ArgumentException)
+ {
+ }
+ }
+
+ return evidence;
+ }
+
+ // instance members
+ public override object GetEntity(Uri absoluteUri, string role,
+
Type ofObjectToReturn)
+ {
+ if(SecurityManager.SecurityEnabled)
+ {
+ // in case the security manager was switched
after the constructor was called
+ if(permissionSet == null)
+ {
+ throw new SecurityException(
+ S._("Security Manager wasn't
active when instance was created."));
+ }
+ permissionSet.PermitOnly();
+ }
+ return resolver.GetEntity(absoluteUri, role,
ofObjectToReturn);
+ }
+
+ public override Uri ResolveUri(Uri baseUri, string relativeUri)
+ {
+ return resolver.ResolveUri(baseUri, relativeUri);
+ }
+
+ public override ICredentials Credentials
+ {
+ set
+ {
+ resolver.Credentials = value;
+ }
+ }
+
+ }; // class XmlSecureResolver
+
+#endif // !ECMA_COMPAT && CONFIG_PERMISSIONS && CONFIG_POLICY_OBJECTS
+
+}; // namespace System.Xml
diff --git a/System.Xml/XmlWriterSettings.cs b/System.Xml/XmlWriterSettings.cs
old mode 100755
new mode 100644
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 4 +
System.Xml/XmlSecureResolver.cs | 141 +++++++++++++++++++++++++++++++++++++++
2 files changed, 145 insertions(+), 0 deletions(-)
mode change 100755 => 100644 System.Xml/ConformanceLevel.cs
mode change 100755 => 100644 System.Xml/NewLineHandling.cs
mode change 100755 => 100644 System.Xml/XmlOutputMethod.cs
create mode 100644 System.Xml/XmlSecureResolver.cs
mode change 100755 => 100644 System.Xml/XmlWriterSettings.cs
hooks/post-receive
--
DotGNU Portable.NET Class Library (pnetlib)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Class Library (pnetlib) branch, master, updated. 32a628eb0d4de16e8a7754edf9bdd622ca7d413c,
Klaus Treichel <=