diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-05-17 18:25:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-17 18:25:05 -0700 |
commit | 13e7c4368da664a8b50228b1a5ef01a660fbb2dd (patch) | |
tree | f3f36157c201fab5bc4558beceb9f8e83fbab3f6 /src/md | |
parent | c290deb3bd5331a5d70470e6203f2b4b2059bd90 (diff) | |
download | coreclr-13e7c4368da664a8b50228b1a5ef01a660fbb2dd.tar.gz coreclr-13e7c4368da664a8b50228b1a5ef01a660fbb2dd.tar.bz2 coreclr-13e7c4368da664a8b50228b1a5ef01a660fbb2dd.zip |
Finish deleting dead CAS code from CoreLib (#11436)
Fixes #9321 and deletes CleanupToDoList.cs
Delete unmanaged security implementation
Diffstat (limited to 'src/md')
-rw-r--r-- | src/md/compiler/regmeta_vm.cpp | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/src/md/compiler/regmeta_vm.cpp b/src/md/compiler/regmeta_vm.cpp index a4d9397b0e..5948d2aa88 100644 --- a/src/md/compiler/regmeta_vm.cpp +++ b/src/md/compiler/regmeta_vm.cpp @@ -121,144 +121,7 @@ HRESULT RegMeta::DefineSecurityAttributeSet(// Return code. ULONG cSecAttrs, // [IN] Count of elements in above array. ULONG *pulErrorAttr) // [OUT] On error, index of attribute causing problem. { -#ifdef FEATURE_METADATA_EMIT_ALL - HRESULT hr = S_OK; - - BEGIN_ENTRYPOINT_NOTHROW; - - NewArrayHolder <CORSEC_ATTRSET> rAttrSets; - DWORD i; - mdPermission ps; - DWORD dwAction; - bool fProcessDeclarativeSecurityAtRuntime; - - LOG((LOGMD, "RegMeta::DefineSecurityAttributeSet(0x%08x, 0x%08x, 0x%08x, 0x%08x)\n", - tkObj, rSecAttrs, cSecAttrs, pulErrorAttr)); - START_MD_PERF(); - LOCKWRITE(); - - IfFailGo(m_pStgdb->m_MiniMd.PreUpdate()); - - rAttrSets = new (nothrow) CORSEC_ATTRSET[dclMaximumValue + 1]; - if (rAttrSets == NULL) - { - hr = E_OUTOFMEMORY; - goto ErrExit; - } - - memset(rAttrSets, 0, sizeof(CORSEC_ATTRSET) * (dclMaximumValue + 1)); - - // Initialize error index to indicate a general error. - if (pulErrorAttr) - *pulErrorAttr = cSecAttrs; - - fProcessDeclarativeSecurityAtRuntime = true; - - // See if we should default to old v1.0/v1.1 serialization behavior - if (m_OptionValue.m_MetadataVersion < MDVersion2) - fProcessDeclarativeSecurityAtRuntime = false; - - // Startup the EE just once, no matter how many times we're called (this is - // better on performance and the EE falls over if we try a start-stop-start - // cycle anyway). - if (!m_fStartedEE && !fProcessDeclarativeSecurityAtRuntime) - { - IfFailGo(StartupEE()); - } - - // Group the security attributes by SecurityAction (thus creating an array of CORSEC_PERM's) - IfFailGo(GroupSecurityAttributesByAction(/*OUT*/rAttrSets, rSecAttrs, cSecAttrs, tkObj, pulErrorAttr, &m_pStgdb->m_MiniMd, NULL)); - - // Put appropriate data in the metadata - for (i = 0; i <= dclMaximumValue; i++) - { - NewArrayHolder <BYTE> pbBlob(NULL); - NewArrayHolder <BYTE> pbNonCasBlob(NULL); - DWORD cbBlob = 0; - DWORD cbNonCasBlob = 0; - - rAttrSets[i].pImport = this; - rAttrSets[i].pAppDomain = m_pAppDomain; - if (rAttrSets[i].dwAttrCount == 0) - continue; - if (pulErrorAttr) - *pulErrorAttr = i; - - if(fProcessDeclarativeSecurityAtRuntime) - { - // Put a serialized CORSEC_ATTRSET in the metadata - SIZE_T cbAttrSet = 0; - IfFailGo(AttributeSetToBlob(&rAttrSets[i], NULL, &cbAttrSet, this, i)); // count size required for buffer - if (!FitsIn<DWORD>(cbAttrSet)) - { - hr = COR_E_OVERFLOW; - goto ErrExit; - } - cbBlob = static_cast<DWORD>(cbAttrSet); - - pbBlob = new (nothrow) BYTE[cbBlob]; // allocate buffer - if (pbBlob == NULL) - { - hr = E_OUTOFMEMORY; - goto ErrExit; - } - - IfFailGo(AttributeSetToBlob(&rAttrSets[i], pbBlob, NULL, this, i)); // serialize into the buffer - IfFailGo(_DefinePermissionSet(rAttrSets[i].tkObj, rAttrSets[i].dwAction, pbBlob, cbBlob, &ps)); // put it in metadata - } - else - { - // Now translate the sets of security attributes into a real permission - // set and convert this to a serialized Xml blob. We may possibly end up - // with two sets as the result of splitting CAS and non-CAS permissions - // into separate sets. - hr = TranslateSecurityAttributes(&rAttrSets[i], &pbBlob, &cbBlob, &pbNonCasBlob, &cbNonCasBlob, pulErrorAttr); - IfFailGo(hr); - - // Persist the permission set blob into the metadata. For empty CAS - // blobs this is only done if the corresponding non-CAS blob is empty - if (cbBlob || !cbNonCasBlob) - IfFailGo(_DefinePermissionSet(rAttrSets[i].tkObj, rAttrSets[i].dwAction, pbBlob, cbBlob, &ps)); - - if (pbNonCasBlob) - { - // Map the SecurityAction to a special non-CAS action so this - // blob will have its own entry in the metadata - switch (rAttrSets[i].dwAction) - { - case dclDemand: - dwAction = dclNonCasDemand; - break; - case dclLinktimeCheck: - dwAction = dclNonCasLinkDemand; - break; - case dclInheritanceCheck: - dwAction = dclNonCasInheritance; - break; - default: - PostError(CORSECATTR_E_BAD_NONCAS); - IfFailGo(CORSECATTR_E_BAD_NONCAS); - } - - // Persist to metadata - IfFailGo(_DefinePermissionSet(rAttrSets[i].tkObj, - dwAction, - pbNonCasBlob, - cbNonCasBlob, - &ps)); - } - } - } - -ErrExit: - STOP_MD_PERF(DefineSecurityAttributeSet); - - END_ENTRYPOINT_NOTHROW; - - return (hr); -#else //!FEATURE_METADATA_EMIT_ALL return E_NOTIMPL; -#endif //!FEATURE_METADATA_EMIT_ALL } // RegMeta::DefineSecurityAttributeSet #endif //FEATURE_METADATA_EMIT |