コード例 #1
0
        // public(internal) interface begins...
        // Creation functions
        static internal PermissionListSet CreateCompressedState(CompressedStack cs, CompressedStack innerCS)
        {
            // function that completes the construction of the compressed stack if not done so already (bottom half for demand evaluation)

            bool bHaltConstruction = false;

            if (cs.CompressedStackHandle == null)
            {
                return(null); //  FT case or Security off
            }
            PermissionListSet   pls           = new PermissionListSet();
            PermissionSetTriple currentTriple = new PermissionSetTriple();
            int numDomains = CompressedStack.GetDCSCount(cs.CompressedStackHandle);

            for (int i = numDomains - 1; (i >= 0 && !bHaltConstruction); i--)
            {
                DomainCompressedStack dcs = CompressedStack.GetDomainCompressedStack(cs.CompressedStackHandle, i);
                if (dcs == null)
                {
                    continue; // we hit a FT Domain
                }
                if (dcs.PLS == null)
                {
                    // We failed on some DCS
                    throw new SecurityException(String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("Security_Generic")));
                }
                pls.UpdateZoneAndOrigin(dcs.PLS);
                pls.Update(currentTriple, dcs.PLS);
                bHaltConstruction = dcs.ConstructionHalted;
            }
            if (!bHaltConstruction)
            {
                PermissionListSet tmp_pls = null;
                // Construction did not halt.
                if (innerCS != null)
                {
                    innerCS.CompleteConstruction(null);
                    tmp_pls = innerCS.PLS;
                }
                pls.Terminate(currentTriple, tmp_pls);
            }
            else
            {
                pls.Terminate(currentTriple);
            }

            return(pls);
        }
コード例 #2
0
        internal static PermissionListSet CreateCompressedState(CompressedStack cs, CompressedStack innerCS)
        {
            bool flag = false;

            if (cs.CompressedStackHandle == null)
            {
                return(null);
            }
            PermissionListSet   permissionListSet = new PermissionListSet();
            PermissionSetTriple currentTriple     = new PermissionSetTriple();
            int dcscount = CompressedStack.GetDCSCount(cs.CompressedStackHandle);
            int num      = dcscount - 1;

            while (num >= 0 && !flag)
            {
                DomainCompressedStack domainCompressedStack = CompressedStack.GetDomainCompressedStack(cs.CompressedStackHandle, num);
                if (domainCompressedStack != null)
                {
                    if (domainCompressedStack.PLS == null)
                    {
                        throw new SecurityException(string.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("Security_Generic"), Array.Empty <object>()));
                    }
                    permissionListSet.UpdateZoneAndOrigin(domainCompressedStack.PLS);
                    permissionListSet.Update(currentTriple, domainCompressedStack.PLS);
                    flag = domainCompressedStack.ConstructionHalted;
                }
                num--;
            }
            if (!flag)
            {
                PermissionListSet pls = null;
                if (innerCS != null)
                {
                    innerCS.CompleteConstruction(null);
                    pls = innerCS.PLS;
                }
                permissionListSet.Terminate(currentTriple, pls);
            }
            else
            {
                permissionListSet.Terminate(currentTriple);
            }
            return(permissionListSet);
        }
コード例 #3
0
        internal static PermissionListSet CreateCompressedState(CompressedStack cs, CompressedStack innerCS)
        {
            bool constructionHalted = false;

            if (cs.CompressedStackHandle == null)
            {
                return(null);
            }
            PermissionListSet   set           = new PermissionListSet();
            PermissionSetTriple currentTriple = new PermissionSetTriple();

            for (int i = CompressedStack.GetDCSCount(cs.CompressedStackHandle) - 1; (i >= 0) && !constructionHalted; i--)
            {
                DomainCompressedStack domainCompressedStack = CompressedStack.GetDomainCompressedStack(cs.CompressedStackHandle, i);
                if (domainCompressedStack != null)
                {
                    if (domainCompressedStack.PLS == null)
                    {
                        throw new SecurityException(string.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("Security_Generic"), new object[0]));
                    }
                    set.UpdateZoneAndOrigin(domainCompressedStack.PLS);
                    set.Update(currentTriple, domainCompressedStack.PLS);
                    constructionHalted = domainCompressedStack.ConstructionHalted;
                }
            }
            if (!constructionHalted)
            {
                PermissionListSet pls = null;
                if (innerCS != null)
                {
                    innerCS.CompleteConstruction(null);
                    pls = innerCS.PLS;
                }
                set.Terminate(currentTriple, pls);
                return(set);
            }
            set.Terminate(currentTriple);
            return(set);
        }