Ejemplo n.º 1
0
        [System.Security.SecurityCritical]  // auto-generated
        private void Terminate(PermissionSetTriple currentTriple, PermissionListSet pls) 
        {
#if FEATURE_COMPRESSEDSTACK
            this.UpdateZoneAndOrigin(pls);
#endif // FEATURE_COMPRESSEDSTACK 
            this.UpdatePermissions(currentTriple, pls);
            this.UpdateTripleListAndCreateNewTriple(currentTriple, null); 
        } 
Ejemplo n.º 2
0
        [System.Security.SecurityCritical]  // auto-generated 
        internal void UpdateDomainPLS (PermissionSet grantSet, PermissionSet deniedSet) {
            Contract.Assert(m_permSetTriples == null, "m_permSetTriples != null");
            if (m_firstPermSetTriple == null)
                m_firstPermSetTriple = new PermissionSetTriple(); 

            // update the grant and denied sets 
            m_firstPermSetTriple.UpdateGrant(grantSet); 
            m_firstPermSetTriple.UpdateRefused(deniedSet);
        } 
Ejemplo n.º 3
0
 private void EnsureTriplesListCreated() 
 {
     if (m_permSetTriples == null) 
     {
         m_permSetTriples = new ArrayList();
         if (m_firstPermSetTriple != null)
         { 
             m_permSetTriples.Add(m_firstPermSetTriple);
             m_firstPermSetTriple = null; 
         } 
     }
 } 
Ejemplo n.º 4
0
 [System.Security.SecurityCritical]  // auto-generated
 internal bool Update(PermissionSetTriple psTriple, out PermissionSetTriple retTriple)
 {
     retTriple = null;
     retTriple = UpdateAssert(psTriple.AssertSet);
     // Special case: unrestricted assert. Note: dcs.Assert.IsUnrestricted => dcs.Grant.IsUnrestricted
     if (psTriple.AssertSet != null && psTriple.AssertSet.IsUnrestricted())
     {
         return true; // stop construction
     }
     UpdateGrant(psTriple.GrantSet);
     UpdateRefused(psTriple.RefusedSet);
     return false;
 }
Ejemplo n.º 5
0
 private void UpdateTripleListAndCreateNewTriple(PermissionSetTriple currentTriple, ArrayList tripleList)
 {
     if (!currentTriple.IsEmpty())
     {
         if (m_firstPermSetTriple == null && m_permSetTriples == null)
         {
             m_firstPermSetTriple = new PermissionSetTriple(currentTriple);
         }
         else
         {
             EnsureTriplesListCreated();
             m_permSetTriples.Add(new PermissionSetTriple(currentTriple));
         }
         currentTriple.Reset();
     }
     if (tripleList != null)
     {
         EnsureTriplesListCreated();
         m_permSetTriples.AddRange(tripleList);
     }
 }
Ejemplo n.º 6
0
        [System.Security.SecurityCritical]  // auto-generated
        private bool UpdatePermissions(PermissionSetTriple currentTriple, PermissionListSet pls)
        {
            if (pls != null)
            {
                if (pls.m_permSetTriples != null)
                {
                    // DCS has an AGR List. So we need to add the AGR List
                    UpdateTripleListAndCreateNewTriple(currentTriple, pls.m_permSetTriples);
                }
                else
                {
                    // Common case: One AGR set

                    PermissionSetTriple tmp_psTriple = pls.m_firstPermSetTriple;
                    PermissionSetTriple retTriple;
                    // First try and update currentTriple. Return value indicates if we can stop construction
                    if (currentTriple.Update(tmp_psTriple, out retTriple))
                    {
                        return(true);
                    }
                    // If we got a non-null retTriple, what it means is that compression failed,
                    // and we now have 2 triples to deal with: retTriple and currentTriple.
                    // retTriple has to be appended first. then currentTriple.
                    if (retTriple != null)
                    {
                        EnsureTriplesListCreated();
                        // we just created a new triple...add the previous one (returned) to the list
                        m_permSetTriples.Add(retTriple);
                    }
                }
            }
            else
            {
                // pls can be null only outside the loop in CreateCompressedState
                UpdateTripleListAndCreateNewTriple(currentTriple, null);
            }


            return(false);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
 private void UpdateTripleListAndCreateNewTriple(PermissionSetTriple currentTriple, ArrayList tripleList)
 {
     if (!currentTriple.IsEmpty())
     {
         if (this.m_firstPermSetTriple == null && this.m_permSetTriples == null)
         {
             this.m_firstPermSetTriple = new PermissionSetTriple(currentTriple);
         }
         else
         {
             this.EnsureTriplesListCreated();
             this.m_permSetTriples.Add((object)new PermissionSetTriple(currentTriple));
         }
         currentTriple.Reset();
     }
     if (tripleList == null)
     {
         return;
     }
     this.EnsureTriplesListCreated();
     this.m_permSetTriples.AddRange((ICollection)tripleList);
 }
Ejemplo n.º 9
0
        [System.Security.SecurityCritical]  // auto-generated
        static internal PermissionListSet CreateCompressedState(IntPtr unmanagedDCS, out bool bHaltConstruction)
        {
            PermissionListSet   pls           = new PermissionListSet();
            PermissionSetTriple currentTriple = new PermissionSetTriple();

            PermissionSet tmp_g, tmp_r;
            // Construct the descriptor list
            int descCount = DomainCompressedStack.GetDescCount(unmanagedDCS);

            bHaltConstruction = false;
            for (int i = 0; (i < descCount && !bHaltConstruction); i++)
            {
                FrameSecurityDescriptor fsd;
                Assembly assembly;
                if (DomainCompressedStack.GetDescriptorInfo(unmanagedDCS, i, out tmp_g, out tmp_r, out assembly, out fsd))
                {
                    // Got an FSD
                    bHaltConstruction = pls.Update(currentTriple, fsd);
                }
                else
                {
                    pls.Update(currentTriple, tmp_g, tmp_r);
                }
            }
            if (!bHaltConstruction)
            {
                // domain
                if (!DomainCompressedStack.IgnoreDomain(unmanagedDCS))
                {
                    DomainCompressedStack.GetDomainPermissionSets(unmanagedDCS, out tmp_g, out tmp_r);
                    pls.Update(currentTriple, tmp_g, tmp_r);
                }
            }
            pls.Terminate(currentTriple);


            // return the created object
            return(pls);
        }
Ejemplo n.º 10
0
        [System.Security.SecurityCritical]  // auto-generated 
        static internal PermissionListSet CreateCompressedState(IntPtr unmanagedDCS, out bool bHaltConstruction)
        { 
            PermissionListSet pls = new PermissionListSet();
            PermissionSetTriple currentTriple = new PermissionSetTriple();

            PermissionSet tmp_g, tmp_r; 
            // Construct the descriptor list
            int descCount = DomainCompressedStack.GetDescCount(unmanagedDCS); 
            bHaltConstruction = false; 
            for(int i=0; (i < descCount && !bHaltConstruction); i++)
            { 
                FrameSecurityDescriptor fsd;
                Assembly assembly;
                if (DomainCompressedStack.GetDescriptorInfo(unmanagedDCS, i, out tmp_g, out tmp_r, out assembly, out fsd))
                { 
                    // Got an FSD
                    bHaltConstruction = pls.Update(currentTriple, fsd); 
                } 
                else
                { 
                    pls.Update(currentTriple, tmp_g, tmp_r);
                }

            } 
            if (!bHaltConstruction)
            { 
                // domain 
                if (!DomainCompressedStack.IgnoreDomain(unmanagedDCS))
                { 
                    DomainCompressedStack.GetDomainPermissionSets(unmanagedDCS, out tmp_g, out tmp_r);
                    pls.Update(currentTriple, tmp_g, tmp_r);
                }
            } 
            pls.Terminate(currentTriple);
 
 
            // return the created object
            return pls; 

        }
Ejemplo n.º 11
0
 private void UpdateTripleListAndCreateNewTriple(PermissionSetTriple currentTriple, ArrayList tripleList) 
 {
     if (!currentTriple.IsEmpty()) 
     { 
         if (m_firstPermSetTriple == null && m_permSetTriples == null)
         { 
             m_firstPermSetTriple = new PermissionSetTriple(currentTriple);
         }
         else
         { 
             EnsureTriplesListCreated();
             m_permSetTriples.Add(new PermissionSetTriple(currentTriple)); 
         } 
         currentTriple.Reset();
     } 
     if (tripleList != null)
     {
         EnsureTriplesListCreated();
         m_permSetTriples.AddRange(tripleList); 
     }
 } 
Ejemplo n.º 12
0
 [System.Security.SecurityCritical]  // auto-generated
 private void Update(PermissionSet in_g)
 { 
     if (m_firstPermSetTriple == null)
         m_firstPermSetTriple = new PermissionSetTriple(); 
     Update(m_firstPermSetTriple, in_g, null); 
 }
Ejemplo n.º 13
0
        [System.Security.SecurityCritical]  // auto-generated 
        private bool Update2(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd, bool fDeclarative)
        { 
            // Deny 
            PermissionSet deniedPset = fsd.GetDenials(fDeclarative);
            if (deniedPset != null) 
            {
                currentTriple.UpdateRefused(deniedPset);
            }
 
            // permit only
            PermissionSet permitOnlyPset = fsd.GetPermitOnly(fDeclarative); 
            if (permitOnlyPset != null) 
            {
                currentTriple.UpdateGrant(permitOnlyPset); 
            }

            // Assert all possible
            if (fsd.GetAssertAllPossible()) 
            {
                // If we have no grant set, it means that the only assembly we've seen on the stack so 
                // far is mscorlib. Since mscorlib will always be fully trusted, the grant set of the 
                // compressed stack is also FullTrust.
                if (currentTriple.GrantSet == null) 
                    currentTriple.GrantSet = PermissionSet.s_fullTrust;

                return true; // halt the construction
            } 

            // Assert 
            PermissionSet assertPset = fsd.GetAssertions(fDeclarative); 
            if (assertPset != null)
            { 
                if (assertPset.IsUnrestricted())
                {
                    // If we have no grant set, it means that the only assembly we've seen on the stack so
                    // far is mscorlib. Since mscorlib will always be fully trusted, the grant set of the 
                    // compressed stack is also FullTrust.
                    if (currentTriple.GrantSet == null) 
                        currentTriple.GrantSet = PermissionSet.s_fullTrust; 

                    return true; // halt the construction 
                }

                PermissionSetTriple retTriple = currentTriple.UpdateAssert(assertPset);
                if (retTriple != null) 
                {
                    EnsureTriplesListCreated(); 
                    m_permSetTriples.Add(retTriple); 
                }
            } 

            return false;
        }
Ejemplo n.º 14
0
 internal PermissionSetTriple(PermissionSetTriple triple)
 {
     this.AssertSet  = triple.AssertSet;
     this.GrantSet   = triple.GrantSet;
     this.RefusedSet = triple.RefusedSet;
 }
Ejemplo n.º 15
0
 private bool Update(PermissionSetTriple currentTriple, PermissionListSet pls)
 {
     return(this.UpdatePermissions(currentTriple, pls));
 }
 private bool Update2(PermissionSetTriple currentTriple, FrameSecurityDescriptorWithResolver fsdWithResolver)
 {
     System.Reflection.Emit.DynamicResolver resolver = fsdWithResolver.Resolver;
     CompressedStack dynamicCompressedStack = resolver.GetSecurityContext();
     dynamicCompressedStack.CompleteConstruction(null);
     return this.Update(currentTriple, dynamicCompressedStack.PLS);
 }
 private void Update(PermissionSet in_g)
 {
     if (this.m_firstPermSetTriple == null)
     {
         this.m_firstPermSetTriple = new PermissionSetTriple();
     }
     this.Update(this.m_firstPermSetTriple, in_g, null);
 }
 internal PermissionSetTriple UpdateAssert(PermissionSet in_a)
 {
     PermissionSetTriple triple = null;
     if (in_a != null)
     {
         PermissionSet set;
         bool flag;
         if (in_a.IsSubsetOf(this.AssertSet))
         {
             return null;
         }
         if (this.GrantSet != null)
         {
             set = in_a.Intersect(this.GrantSet);
         }
         else
         {
             this.GrantSet = new PermissionSet(true);
             set = in_a.Copy();
         }
         set = PermissionSet.RemoveRefusedPermissionSet(set, this.RefusedSet, out flag);
         if (!flag)
         {
             flag = PermissionSet.IsIntersectingAssertedPermissions(set, this.AssertSet);
         }
         if (flag)
         {
             triple = new PermissionSetTriple(this);
             this.Reset();
             this.GrantSet = triple.GrantSet.Copy();
         }
         if (this.AssertSet == null)
         {
             this.AssertSet = set;
             return triple;
         }
         this.AssertSet.InplaceUnion(set);
     }
     return triple;
 }
 internal bool Update(PermissionSetTriple psTriple, out PermissionSetTriple retTriple)
 {
     retTriple = null;
     if ((psTriple.AssertSet != null) && psTriple.AssertSet.IsUnrestricted())
     {
         return true;
     }
     retTriple = this.UpdateAssert(psTriple.AssertSet);
     this.UpdateGrant(psTriple.GrantSet);
     this.UpdateRefused(psTriple.RefusedSet);
     return false;
 }
 private bool UpdatePermissions(PermissionSetTriple currentTriple, PermissionListSet pls)
 {
     if (pls != null)
     {
         if (pls.m_permSetTriples != null)
         {
             this.UpdateTripleListAndCreateNewTriple(currentTriple, pls.m_permSetTriples);
         }
         else
         {
             PermissionSetTriple triple2;
             PermissionSetTriple firstPermSetTriple = pls.m_firstPermSetTriple;
             if (currentTriple.Update(firstPermSetTriple, out triple2))
             {
                 return true;
             }
             if (triple2 != null)
             {
                 this.EnsureTriplesListCreated();
                 this.m_permSetTriples.Add(triple2);
             }
         }
     }
     else
     {
         this.UpdateTripleListAndCreateNewTriple(currentTriple, null);
     }
     return false;
 }
 internal void UpdateDomainPLS(PermissionSet grantSet, PermissionSet deniedSet)
 {
     if (this.m_firstPermSetTriple == null)
     {
         this.m_firstPermSetTriple = new PermissionSetTriple();
     }
     this.m_firstPermSetTriple.UpdateGrant(grantSet);
     this.m_firstPermSetTriple.UpdateRefused(deniedSet);
 }
 private bool Update2(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd, bool fDeclarative)
 {
     PermissionSet denials = fsd.GetDenials(fDeclarative);
     if (denials != null)
     {
         currentTriple.UpdateRefused(denials);
     }
     PermissionSet permitOnly = fsd.GetPermitOnly(fDeclarative);
     if (permitOnly != null)
     {
         currentTriple.UpdateGrant(permitOnly);
     }
     if (fsd.GetAssertAllPossible())
     {
         if (currentTriple.GrantSet == null)
         {
             currentTriple.GrantSet = PermissionSet.s_fullTrust;
         }
         return true;
     }
     PermissionSet assertions = fsd.GetAssertions(fDeclarative);
     if (assertions != null)
     {
         if (assertions.IsUnrestricted())
         {
             if (currentTriple.GrantSet == null)
             {
                 currentTriple.GrantSet = PermissionSet.s_fullTrust;
             }
             return true;
         }
         PermissionSetTriple triple = currentTriple.UpdateAssert(assertions);
         if (triple != null)
         {
             this.EnsureTriplesListCreated();
             this.m_permSetTriples.Add(triple);
         }
     }
     return false;
 }
 private void Update(PermissionSetTriple currentTriple, PermissionSet in_g, PermissionSet in_r)
 {
     ZoneIdentityPermission permission;
     UrlIdentityPermission permission2;
     currentTriple.UpdateGrant(in_g, out permission, out permission2);
     currentTriple.UpdateRefused(in_r);
     this.AppendZoneOrigin(permission, permission2);
 }
 private bool Update(PermissionSetTriple currentTriple, PermissionListSet pls)
 {
     this.UpdateZoneAndOrigin(pls);
     return this.UpdatePermissions(currentTriple, pls);
 }
        [System.Security.SecurityCritical]  // auto-generated
        private bool Update(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd)
        {
#if FEATURE_COMPRESSEDSTACK
           FrameSecurityDescriptorWithResolver fsdWithResolver = fsd as FrameSecurityDescriptorWithResolver;
           if (fsdWithResolver != null)
           {
               return Update2(currentTriple, fsdWithResolver);
           }
#endif // FEATURE_COMPRESSEDSTACK

           // check imperative
           bool fHalt = Update2(currentTriple, fsd, false);
           if (!fHalt)            
           {
                // then declarative
                fHalt = Update2(currentTriple, fsd, true);
           }
           return fHalt;
        }
Ejemplo n.º 26
0
        [System.Security.SecurityCritical]  // auto-generated
        private bool Update2(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd, bool fDeclarative)
        {
            // Deny
            PermissionSet deniedPset = fsd.GetDenials(fDeclarative);

            if (deniedPset != null)
            {
                currentTriple.UpdateRefused(deniedPset);
            }

            // permit only
            PermissionSet permitOnlyPset = fsd.GetPermitOnly(fDeclarative);

            if (permitOnlyPset != null)
            {
                currentTriple.UpdateGrant(permitOnlyPset);
            }

            // Assert all possible
            if (fsd.GetAssertAllPossible())
            {
                // If we have no grant set, it means that the only assembly we've seen on the stack so
                // far is mscorlib. Since mscorlib will always be fully trusted, the grant set of the
                // compressed stack is also FullTrust.
                if (currentTriple.GrantSet == null)
                {
                    currentTriple.GrantSet = PermissionSet.s_fullTrust;
                }

                UpdateTripleListAndCreateNewTriple(currentTriple, m_permSetTriples);
                currentTriple.GrantSet = PermissionSet.s_fullTrust;
                currentTriple.UpdateAssert(fsd.GetAssertions(fDeclarative));
                return(true);
            }

            // Assert
            PermissionSet assertPset = fsd.GetAssertions(fDeclarative);

            if (assertPset != null)
            {
                if (assertPset.IsUnrestricted())
                {
                    // If we have no grant set, it means that the only assembly we've seen on the stack so
                    // far is mscorlib. Since mscorlib will always be fully trusted, the grant set of the
                    // compressed stack is also FullTrust.
                    if (currentTriple.GrantSet == null)
                    {
                        currentTriple.GrantSet = PermissionSet.s_fullTrust;
                    }

                    UpdateTripleListAndCreateNewTriple(currentTriple, m_permSetTriples);
                    currentTriple.GrantSet = PermissionSet.s_fullTrust;
                    currentTriple.UpdateAssert(assertPset);
                    return(true);
                }

                PermissionSetTriple retTriple = currentTriple.UpdateAssert(assertPset);
                if (retTriple != null)
                {
                    EnsureTriplesListCreated();
                    m_permSetTriples.Add(retTriple);
                }
            }

            return(false);
        }
Ejemplo n.º 27
0
 internal PermissionSetTriple(PermissionSetTriple triple)
 {
     this.AssertSet = triple.AssertSet;
     this.GrantSet = triple.GrantSet;
     this.RefusedSet = triple.RefusedSet;
 }
 private void Terminate(PermissionSetTriple currentTriple, PermissionListSet pls)
 {
     this.UpdateZoneAndOrigin(pls);
     this.UpdatePermissions(currentTriple, pls);
     this.UpdateTripleListAndCreateNewTriple(currentTriple, null);
 }
Ejemplo n.º 29
0
        [System.Security.SecurityCritical]  // auto-generated
        internal PermissionSetTriple UpdateAssert(PermissionSet in_a)
        {
            PermissionSetTriple retTriple = null;
            if (in_a != null)
            {
                Contract.Assert((!in_a.IsUnrestricted() || RefusedSet == null), "Cannot be unrestricted or refused must be null");
                // if we're already asserting in_a, nothing to do
                if (in_a.IsSubsetOf(AssertSet))
                    return null;

                PermissionSet retPs;
                if (GrantSet != null)
                    retPs = in_a.Intersect(GrantSet); // Restrict the assert to what we've already been granted
                else
                {
                    GrantSet = new PermissionSet(true);
                    retPs = in_a.Copy(); // Currently unrestricted Grant: assert the whole assert set
                }
                bool bFailedToCompress = false;
                // removes anything that is already in the refused set from the assert set
                if (RefusedSet != null)
                {
                    retPs = PermissionSet.RemoveRefusedPermissionSet(retPs, RefusedSet, out bFailedToCompress);
                }
                if (!bFailedToCompress)
                    bFailedToCompress = PermissionSet.IsIntersectingAssertedPermissions(retPs, AssertSet);
                if (bFailedToCompress)
                {
                    retTriple = new PermissionSetTriple(this);
                    this.Reset();
                    this.GrantSet = retTriple.GrantSet.Copy();
                }

                if (AssertSet == null)
                    AssertSet = retPs;
                else
                    AssertSet.InplaceUnion(retPs);

            }
            return retTriple;
        }
 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;
 }
Ejemplo n.º 31
0
 [System.Security.SecurityCritical]  // auto-generated 
 private bool Update(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd)
 {
    // check imperative
    bool fHalt = Update2(currentTriple, fsd, false); 
    if (!fHalt)
    { 
         // then declarative 
         fHalt = Update2(currentTriple, fsd, true);
    } 
    return fHalt;
 }
 internal static PermissionListSet CreateCompressedState(IntPtr unmanagedDCS, out bool bHaltConstruction)
 {
     PermissionSet set2;
     PermissionSet set3;
     PermissionListSet set = new PermissionListSet();
     PermissionSetTriple currentTriple = new PermissionSetTriple();
     int descCount = DomainCompressedStack.GetDescCount(unmanagedDCS);
     bHaltConstruction = false;
     for (int i = 0; (i < descCount) && !bHaltConstruction; i++)
     {
         FrameSecurityDescriptor descriptor;
         Assembly assembly;
         if (DomainCompressedStack.GetDescriptorInfo(unmanagedDCS, i, out set2, out set3, out assembly, out descriptor))
         {
             bHaltConstruction = set.Update(currentTriple, descriptor);
         }
         else
         {
             set.Update(currentTriple, set2, set3);
         }
     }
     if (!bHaltConstruction && !DomainCompressedStack.IgnoreDomain(unmanagedDCS))
     {
         DomainCompressedStack.GetDomainPermissionSets(unmanagedDCS, out set2, out set3);
         set.Update(currentTriple, set2, set3);
     }
     set.Terminate(currentTriple);
     return set;
 }
Ejemplo n.º 33
0
        [System.Security.SecurityCritical]  // auto-generated 
        private void Update(PermissionSetTriple currentTriple, PermissionSet in_g, PermissionSet in_r)
        { 
#if FEATURE_COMPRESSEDSTACK 
            ZoneIdentityPermission z;
            UrlIdentityPermission u; 
            currentTriple.UpdateGrant(in_g, out z, out u);
            currentTriple.UpdateRefused(in_r);
            AppendZoneOrigin(z, u);
#else // !FEATURE_COMPRESEDSTACK 
            currentTriple.UpdateGrant(in_g);
            currentTriple.UpdateRefused(in_r); 
#endif // FEATURE_COMPRESSEDSTACK 
        }
Ejemplo n.º 34
0
 private void Terminate(PermissionSetTriple currentTriple, PermissionListSet pls)
 {
     this.UpdatePermissions(currentTriple, pls);
     this.UpdateTripleListAndCreateNewTriple(currentTriple, null);
 }
Ejemplo n.º 35
0
        [System.Security.SecurityCritical]  // auto-generated 
        private bool UpdatePermissions(PermissionSetTriple currentTriple, PermissionListSet pls)
        { 
            if (pls != null)
            {
                if (pls.m_permSetTriples != null)
                { 
                    // DCS has an AGR List. So we need to add the AGR List
                    UpdateTripleListAndCreateNewTriple(currentTriple,pls.m_permSetTriples); 
                } 
                else
                { 
                    // Common case: One AGR set

                    PermissionSetTriple tmp_psTriple = pls.m_firstPermSetTriple;
                    PermissionSetTriple retTriple; 
                    // First try and update currentTriple. Return value indicates if we can stop construction
                    if (currentTriple.Update(tmp_psTriple, out retTriple)) 
                        return true; 
                    // If we got a non-null retTriple, what it means is that compression failed,
                    // and we now have 2 triples to deal with: retTriple and currentTriple. 
                    // retTriple has to be appended first. then currentTriple.
                    if (retTriple != null)
                    {
                        EnsureTriplesListCreated(); 
                        // we just created a new triple...add the previous one (returned) to the list
                        m_permSetTriples.Add(retTriple); 
                    } 
                }
            } 
            else
            {
                // pls can be null only outside the loop in CreateCompressedState
                UpdateTripleListAndCreateNewTriple(currentTriple, null); 
            }
 
 
            return false;
 
        }
Ejemplo n.º 36
0
 private void Terminate(PermissionSetTriple currentTriple, PermissionListSet pls)
 {
     this.UpdateZoneAndOrigin(pls);
     this.UpdatePermissions(currentTriple, pls);
     this.UpdateTripleListAndCreateNewTriple(currentTriple, (ArrayList)null);
 }
Ejemplo n.º 37
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; 
        }
Ejemplo n.º 38
0
 private bool Update(PermissionSetTriple currentTriple, PermissionListSet pls)
 {
     this.UpdateZoneAndOrigin(pls);
     return(this.UpdatePermissions(currentTriple, pls));
 }
Ejemplo n.º 39
0
 private void Terminate(PermissionSetTriple currentTriple)
 {
     UpdateTripleListAndCreateNewTriple(currentTriple, null);
 }
 private bool Update(PermissionSetTriple currentTriple, FrameSecurityDescriptor fsd)
 {
     bool flag = this.Update2(currentTriple, fsd, false);
     if (!flag)
     {
         flag = this.Update2(currentTriple, fsd, true);
     }
     return flag;
 }
Ejemplo n.º 41
0
 private void Terminate(PermissionSetTriple currentTriple)
 { 
     UpdateTripleListAndCreateNewTriple(currentTriple, null);
 } 
Ejemplo n.º 42
0
 private void Terminate(PermissionSetTriple currentTriple)
 {
     this.UpdateTripleListAndCreateNewTriple(currentTriple, (ArrayList)null);
 }
Ejemplo n.º 43
0
        [System.Security.SecurityCritical]  // auto-generated 
        private bool Update(PermissionSetTriple currentTriple, PermissionListSet pls)
        {
#if FEATURE_COMPRESSEDSTACK
            this.UpdateZoneAndOrigin(pls); 
#endif // FEATURE_COMPRESSEDSTACK
            return this.UpdatePermissions(currentTriple, pls); 
        } 
Ejemplo n.º 44
0
 private void Update(PermissionSetTriple currentTriple, PermissionSet in_g, PermissionSet in_r)
 {
     currentTriple.UpdateGrant(in_g);
     currentTriple.UpdateRefused(in_r);
 }