[corlib] Disable more CAS code
authorMarek Safar <marek.safar@gmail.com>
Wed, 1 Jun 2016 16:01:10 +0000 (18:01 +0200)
committerMarek Safar <marek.safar@gmail.com>
Wed, 1 Jun 2016 16:01:10 +0000 (18:01 +0200)
mcs/class/corlib/System.Reflection/MonoAssembly.cs
mcs/class/corlib/System.Security/CodeAccessPermission.cs
mcs/class/referencesource/System/net/System/Net/CredentialCache.cs
mcs/class/referencesource/System/net/System/Net/Internal.cs
mcs/class/referencesource/System/net/System/Net/NetworkInformation/NetworkInterface.cs

index 34051bd8368e1e1cebe60a5e72d0aa6ad65a4a76..921cf8b2dd67f51cb7c69d80259589791a65f3d9 100644 (file)
@@ -128,9 +128,11 @@ namespace System.Reflection {
 
                 if (!suppressSecurityChecks)
                 {
+#if !DISABLE_CAS_USE
 #pragma warning disable 618
                     new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
 #pragma warning restore 618
+#endif
                 }
             }
 
index 15fbb4ad39029df6e511b002241ab9ebc47a0124..353d108257dd8c7636d7dc02c0cd5feee1a4c90c 100644 (file)
@@ -60,6 +60,9 @@ namespace System.Security {
 
                public abstract IPermission Copy ();
 
+#if MOBILE && DISABLE_CAS_USE
+               [Obsolete ("CAS support is removed by linker", true)]
+#endif
                public void Demand ()
                {
                        // note: here we're sure it's a CAS demand
index 0df18d001be64a92f9fb759b5f5837e3e05b53c8..d405ca3f657cead1e92f6d19d15248f07e0edd43 100644 (file)
@@ -302,7 +302,9 @@ namespace System.Net {
             get {
                 //This check will not allow to use local user credentials at will.
                 //Hence the username will not be exposed to the network
+#if !DISABLE_CAS_USE
                 new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME").Demand();
+#endif
                 return SystemNetworkCredential.defaultCredential;
             }
         }
@@ -311,7 +313,9 @@ namespace System.Net {
             get {
                 //This check will not allow to use local user credentials at will.
                 //Hence the username will not be exposed to the network
+#if !DISABLE_CAS_USE
                 new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME").Demand();
+#endif
                 return SystemNetworkCredential.defaultCredential;
             }
         }
index e890c070c092c147f5ba45ed0835fc04401bec86..99e10caeaa1084dc04139ada3160e32697f25ead 100644 (file)
@@ -143,7 +143,9 @@ namespace System.Net {
 
         private static void DemandCallback(object state)
         {
+#if !DISABLE_CAS_USE
             ((CodeAccessPermission) state).Demand();
+#endif
         }
 
         // This is for checking if a hostname probably refers to this machine without going to DNS.
index 5f594fdd2cf4b770c4c169802eb739d7e6718468..9fbc8b428b32bfe951fbf2d1f89cb839eb924374 100644 (file)
@@ -8,7 +8,9 @@ namespace System.Net.NetworkInformation
     {
         /// Returns objects that describe the network interfaces on the local computer.
         public static NetworkInterface[] GetAllNetworkInterfaces(){
+#if !DISABLE_CAS_USE
             (new NetworkInformationPermission(NetworkInformationAccess.Read)).Demand();
+#endif
             return SystemNetworkInterface.GetNetworkInterfaces();
         }