[Mono.Security]: Add new MonoTlsProviderFactory.CreateHttpListener() API to create...
[mono.git] / mcs / class / System / System.Net / SocketPermission.cs
index 7146223eaf35a83c25760f936f7a76389f7ece1c..d4fe9750181a1574752d4f11c8129d7fc5043130 100644 (file)
@@ -5,15 +5,35 @@
 //   Lawrence Pit (loz@cable.a2000.nl)\r
 //\r
 \r
-using System;\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+\r
 using System.Collections;\r
 using System.Security;\r
 using System.Security.Permissions;\r
 \r
-namespace System.Net\r
-{\r
+namespace System.Net {\r
+\r
        [Serializable]\r
-       public class SocketPermission : CodeAccessPermission, IUnrestrictedPermission\r
+       public sealed class SocketPermission : CodeAccessPermission, IUnrestrictedPermission\r
        {\r
                // Fields\r
                ArrayList m_acceptList = new ArrayList ();\r
@@ -224,16 +244,7 @@ namespace System.Net
              \r
                        SecurityElement root = new SecurityElement ("IPermission");\r
 \r
-                       root.AddAttribute ("class", this.GetType ().FullName + ", " + \r
-                                                   "System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");\r
-\r
-/*                     \r
-GetType ().Module doesn't work yet with Mono.. (2002-04-27)\r
-We need to do it as below though, because this class can be extended\r
-\r
-                       root.AddAttribute ("class", this.GetType ().FullName + ", " + \r
-                                                   this.GetType ().Module.Assembly.FullName);\r
-*/                                                 \r
+                       root.AddAttribute ("class", this.GetType ().AssemblyQualifiedName);\r
                        root.AddAttribute ("version", "1");\r
                        if (m_noRestriction) {\r
                                root.AddAttribute ("Unrestricted", "true");                             \r
@@ -275,10 +286,6 @@ We need to do it as below though, because this class can be extended
                        if (securityElement.Tag != "IPermission")\r
                                throw new ArgumentException ("securityElement");\r
                                \r
-                       string classStr = securityElement.Attribute ("class");\r
-                       if (classStr == null || !classStr.StartsWith (this.GetType ().FullName + ","))\r
-                               throw new ArgumentException ("securityElement");\r
-                               \r
                        string unrestricted = securityElement.Attribute ("Unrestricted");\r
                        if (unrestricted != null) {\r
                                this.m_noRestriction = (String.Compare (unrestricted, "true", true) == 0);\r
@@ -343,6 +350,5 @@ We need to do it as below though, because this class can be extended
                        \r
                        return copy;\r
                }\r
-\r
        }\r
 }\r