From 69d00920324d4ac3a6f7e622ef7e006c4b1e63f1 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Mon, 2 Mar 2015 21:02:12 -0800 Subject: Delete host authentication enforcement --- src/coreclr/hosts/coreconsole/coreconsole.cpp | 11 ---- src/coreclr/hosts/corerun/corerun.cpp | 11 ---- src/dlls/mscoree/unixinterface.cpp | 3 -- src/inc/MSCOREE.IDL | 8 +-- src/vm/corhost.cpp | 72 +-------------------------- 5 files changed, 4 insertions(+), 101 deletions(-) diff --git a/src/coreclr/hosts/coreconsole/coreconsole.cpp b/src/coreclr/hosts/coreconsole/coreconsole.cpp index eeb3e04c88..7523bb61ee 100644 --- a/src/coreclr/hosts/coreconsole/coreconsole.cpp +++ b/src/coreclr/hosts/coreconsole/coreconsole.cpp @@ -424,17 +424,6 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo return false; } - log << W("Authenticating ICLRRuntimeHost2") << Logger::endl; - - // Authenticate with either - // CORECLR_HOST_AUTHENTICATION_KEY or - // CORECLR_HOST_AUTHENTICATION_KEY_NONGEN - hr = host->Authenticate(CORECLR_HOST_AUTHENTICATION_KEY); - if (FAILED(hr)) { - log << W("Failed authenticate. ") << hr << Logger::endl; - return false; - } - log << W("Starting ICLRRuntimeHost2") << Logger::endl; hr = host->Start(); diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp index cfae1b1b73..fdcb140607 100644 --- a/src/coreclr/hosts/corerun/corerun.cpp +++ b/src/coreclr/hosts/corerun/corerun.cpp @@ -462,17 +462,6 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo return false; } - log << W("Authenticating ICLRRuntimeHost2") << Logger::endl; - - // Authenticate with either - // CORECLR_HOST_AUTHENTICATION_KEY or - // CORECLR_HOST_AUTHENTICATION_KEY_NONGEN - hr = host->Authenticate(CORECLR_HOST_AUTHENTICATION_KEY); - if (FAILED(hr)) { - log << W("Failed authenticate. ") << hr << Logger::endl; - return false; - } - log << W("Starting ICLRRuntimeHost2") << Logger::endl; hr = host->Start(); diff --git a/src/dlls/mscoree/unixinterface.cpp b/src/dlls/mscoree/unixinterface.cpp index 8ecd5703a5..169b0aab13 100644 --- a/src/dlls/mscoree/unixinterface.cpp +++ b/src/dlls/mscoree/unixinterface.cpp @@ -135,9 +135,6 @@ HRESULT ExecuteAssembly( STARTUP_FLAGS::STARTUP_SINGLE_APPDOMAIN)); IfFailRet(hr); - hr = host->Authenticate(CORECLR_HOST_AUTHENTICATION_KEY); - IfFailRet(hr); - hr = host->Start(); IfFailRet(hr); diff --git a/src/inc/MSCOREE.IDL b/src/inc/MSCOREE.IDL index f7fbf810d1..957b02f44a 100644 --- a/src/inc/MSCOREE.IDL +++ b/src/inc/MSCOREE.IDL @@ -1980,11 +1980,8 @@ interface ICLRRuntimeHost : IUnknown }; #ifdef FEATURE_CORECLR -// This is the key that the host needs to pass to us in the call to ICLRRuntmeHost2::Authenticate. -// This key is generated using the CalcFileTime utility under ndp\clr\src\coreclr\CalcFileTime. -// See comments of CorHost2::Authenticate for details. -// This key corresponds to 28th August 2006 +// Keys for ICLRRuntmeHost2::Authenticate. No longer required. cpp_quote("#define CORECLR_HOST_AUTHENTICATION_KEY 0x1C6CA6F94025800LL") cpp_quote("#define CORECLR_HOST_AUTHENTICATION_KEY_NONGEN 0x1C6CA6F94025801LL") @@ -2018,8 +2015,7 @@ interface ICLRRuntimeHost2 : ICLRRuntimeHost [in] LPCWSTR wszMethodName, [out] INT_PTR* fnPtr); - // Authenticates a host based upon a key value. See CorHost2::Authenticate comments - // for details. + // Authenticates a host based upon a key value. No longer required. HRESULT Authenticate([in] ULONGLONG authKey); // Ensures CLR-set Mac (Mach) EH port is registered. diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp index 9abbed4495..8f4769d0fe 100644 --- a/src/vm/corhost.cpp +++ b/src/vm/corhost.cpp @@ -778,11 +778,6 @@ CorHost2::CorHost2() m_fStarted = FALSE; m_fFirstToLoadCLR = FALSE; m_fAppDomainCreated = FALSE; - - // By default, the host is assumed to be unauthenticated and is expected to invoke - // ICLRRuntimeHost2::Authenticate to authenticate before invoking - // ICLRRuntimeHost2::Start. - m_fIsHostAuthenticated = FALSE; #endif // FEATURE_CORECLR } @@ -797,18 +792,8 @@ STDMETHODIMP CorHost2::Start() ENTRY_POINT; }CONTRACTL_END; - HRESULT hr; -#ifdef FEATURE_CORECLR - // Is the host authenticated? - if (FALSE == m_fIsHostAuthenticated) - { - // Attempting to start the runtime without authentication is an invalid operation. - return HOST_E_INVALIDOPERATION; - } -#endif // FEATURE_CORECLR - BEGIN_ENTRYPOINT_NOTHROW; #ifdef FEATURE_CORECLR @@ -1918,14 +1903,6 @@ HRESULT CorHost2::CreateDelegate( return _CreateDelegate(appDomainID, wszAssemblyName, wszClassName, wszMethodName, fnPtr); } -// To prevent any unmanaged application from hosting CoreCLR, we require the host to authenticate -// with the runtime by passing a secret key. This key is a constant value, CORECLR_HOST_AUTHENTICATION_KEY, -// defined in mscoree.h. If the authentication fails, E_FAIL will be returned. S_OK is returned on -// successful authentication. -// -// If the host is not authentication and ICLRRuntimeHost2::Start is invoked, it will return -// HOST_E_INVALIDOPERATION. - HRESULT CorHost2::Authenticate(ULONGLONG authKey) { CONTRACTL @@ -1936,53 +1913,8 @@ HRESULT CorHost2::Authenticate(ULONGLONG authKey) } CONTRACTL_END; - // Initialize... - HRESULT hr = E_FAIL; - -#ifdef FEATURE_CORECLR - // Host is not yet authenticated - playing safe here though we set this to FALSE - // in CorHost2 constructor. - m_fIsHostAuthenticated = FALSE; - - // Is the authentication key valid? - if (CORECLR_HOST_AUTHENTICATION_KEY == authKey || - CORECLR_HOST_AUTHENTICATION_KEY_NONGEN == authKey) - { - hr = S_OK; - m_fIsHostAuthenticated = TRUE; - } - - // - // For Silverlight 4, we overload this API to tell us if we are not allowed - // to use native images. - // - // This was added to address Silverlight bug #88577: crash loading Silverlight netflix player. - // The basic scenario is: - // 1. install Silverlight 4. At the end of setup, coregen.exe is invoked asynchronously to generate - // native images. - // 2. start IE (while native images are still being generated) and load a Silverlight application. - // This SL app loads some native images (mscorlib.ni.dll, System.ni.dll), but not others, since - // they don't exist yet, as coregen.exe is still working in the background. - // 3. Navigate to a different Silverlight app (in the case of the bug, the Netflix movie player). By - // now, all the native images have been generated. When we go to load a native image for an - // assembly that was not loaded by the first application, we get confused -- we check its native - // image dependencies early in loading and it looks good. Then, we choose to use shared assemblies - // that it depends on, that were only loaded as IL assemblies by the first Silverlight application. - // It is also hard-bound to the native images of these dependent native images. At the end, we - // re-check the native image dependencies, and throw an exception (in DomainFile::FinishLoad()). - // - if (CORECLR_HOST_AUTHENTICATION_KEY_NONGEN == authKey) - { - g_fAllowNativeImages = false; // The host told us not to use native images in this process - } - -#else - // Host authentication is (currently) only supported for CoreCLR. For all other CLR implementations, - // we return S_OK incase someone calls us. - hr = S_OK; -#endif - - return hr; + // Host authentication was used by Silverlight. It is no longer relevant for CoreCLR. + return S_OK; } HRESULT CorHost2::RegisterMacEHPort() -- cgit v1.2.3