diff options
Diffstat (limited to 'src/vm/securitydeclarative.cpp')
-rw-r--r-- | src/vm/securitydeclarative.cpp | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/src/vm/securitydeclarative.cpp b/src/vm/securitydeclarative.cpp index 25418d03e8..e0aff16ddd 100644 --- a/src/vm/securitydeclarative.cpp +++ b/src/vm/securitydeclarative.cpp @@ -596,109 +596,6 @@ void SecurityDeclarative::MethodInheritanceCheck(MethodDesc *pMethod, MethodDesc MDSecDesc.InvokeInheritanceChecks(pMethod); } -//--------------------------------------------------------- -// Invoke linktime checks on the caller if demands exist -// for the callee. -//--------------------------------------------------------- -/*static*/ -void SecurityDeclarative::LinktimeCheckMethod(Assembly *pCaller, MethodDesc *pCallee) -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } CONTRACTL_END; - -#ifdef FEATURE_CAS_POLICY - // Do a fulltrust check on the caller if the callee is fully trusted - if (FullTrustCheckForLinkOrInheritanceDemand(pCaller)) - { - return; - } - -#ifdef CROSSGEN_COMPILE - CrossGenNotSupported("SecurityDeclarative::LinktimeCheckMethod"); -#else - GCX_COOP(); - - MethodTable *pTargetMT = pCallee->GetMethodTable(); - - // If it's a delegate BeginInvoke, we need to perform a HostProtection check for synchronization - if(pTargetMT->IsDelegate()) - { - DelegateEEClass* pDelegateClass = (DelegateEEClass*)pTargetMT->GetClass(); - if(pCallee == pDelegateClass->m_pBeginInvokeMethod) - { - EApiCategories eProtectedCategories = GetHostProtectionManager()->GetProtectedCategories(); - if((eProtectedCategories & eSynchronization) == eSynchronization) - { - if(!pCaller->GetSecurityDescriptor()->IsFullyTrusted()) - { - ThrowHPException(eProtectedCategories, eSynchronization); - } - } - } - } - - // the rest of the LinkDemand checks - { - // Track perfmon counters. Linktime security checkes. - COUNTER_ONLY(GetPerfCounters().m_Security.cLinkChecks++); - -#ifdef FEATURE_APTCA - // APTCA check - SecurityDeclarative::DoUntrustedCallerChecks(pCaller, pCallee, FALSE); -#endif // FEATURE_APTCA - - // If the class has its own linktime checks, do them first... - if (pTargetMT->GetClass()->RequiresLinktimeCheck()) - { - TypeSecurityDescriptor::InvokeLinktimeChecks(pTargetMT, pCaller); - } - - // If the previous check passed, check the method for - // method-specific linktime checks... - if (IsMdHasSecurity(pCallee->GetAttrs()) && - (TokenMightHaveDeclarations(pTargetMT->GetMDImport(), - pCallee->GetMemberDef(), - dclLinktimeCheck) || - TokenMightHaveDeclarations(pTargetMT->GetMDImport(), - pCallee->GetMemberDef(), - dclNonCasLinkDemand) )) - { - MethodSecurityDescriptor::InvokeLinktimeChecks(pCallee, pCaller); - } - - // We perform automatic linktime checks for UnmanagedCode in three cases: - // o P/Invoke calls - // o Calls through an interface that have a suppress runtime check - // attribute on them (these are almost certainly interop calls). - // o Interop calls made through method impls. - if (pCallee->IsNDirect() || - (pTargetMT->IsInterface() && - (pTargetMT->GetMDImport()->GetCustomAttributeByName(pTargetMT->GetCl(), - COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI, - NULL, - NULL) == S_OK || - pTargetMT->GetMDImport()->GetCustomAttributeByName(pCallee->GetMemberDef(), - COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI, - NULL, - NULL) == S_OK) ) || - (pCallee->IsComPlusCall() && !pCallee->IsInterface())) - { - if (!pCaller->GetSecurityDescriptor()->CanCallUnmanagedCode()) - { - Security::ThrowSecurityException(g_SecurityPermissionClassName, SPFLAGSUNMANAGEDCODE); - } - } - } - -#endif // !CROSSGEN_COMPILE - -#endif // FEATURE_CAS_POLICY -} - #ifndef CROSSGEN_COMPILE //----------------------------------------------------------------------------- // @@ -708,53 +605,6 @@ void SecurityDeclarative::LinktimeCheckMethod(Assembly *pCaller, MethodDesc *pCa // //----------------------------------------------------------------------------- -void SecurityDeclarative::_GetSharedPermissionInstance(OBJECTREF *perm, int index) -{ - CONTRACTL { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - } CONTRACTL_END; - - _ASSERTE(index < (int) NUM_PERM_OBJECTS); - - AppDomain *pDomain = GetAppDomain(); - SharedPermissionObjects *pShared = &pDomain->m_pSecContext->m_rPermObjects[index]; - - if (pShared->hPermissionObject == NULL) { - pShared->hPermissionObject = pDomain->CreateHandle(NULL); - *perm = NULL; - } - else - *perm = ObjectFromHandle(pShared->hPermissionObject); - - if (*perm == NULL) - { - MethodTable *pMT = NULL; - OBJECTREF p = NULL; - - GCPROTECT_BEGIN(p); - - pMT = MscorlibBinder::GetClass(pShared->idClass); - MethodDescCallSite ctor(pShared->idConstructor); - - p = AllocateObject(pMT); - - ARG_SLOT argInit[2] = - { - ObjToArgSlot(p), - (ARG_SLOT) pShared->dwPermissionFlag - }; - - ctor.Call(argInit); - - StoreObjectInHandle(pShared->hPermissionObject, p); - *perm = p; - - GCPROTECT_END(); - } -} - #ifdef FEATURE_APTCA void DECLSPEC_NORETURN SecurityDeclarative::ThrowAPTCAException(Assembly *pCaller, MethodDesc *pCallee) { |