X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fdeclsec.c;h=65e38d7f8fe5b29cb3e0b517954faace3cd71875;hb=9342e7d1d4e5d0d3248de33d05b2c2b993314bd6;hp=ce4aa7296d37ca42ce1657e70bebec27f3e66a06;hpb=6b6435d1b3206b0162c37e5ecce8d9a699fe6467;p=mono.git diff --git a/mono/mini/declsec.c b/mono/mini/declsec.c index ce4aa7296d3..65e38d7f8fe 100644 --- a/mono/mini/declsec.c +++ b/mono/mini/declsec.c @@ -19,7 +19,7 @@ mono_method_has_declsec (MonoMethod *method) { mono_jit_stats.cas_declsec_check++; - if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) { + if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE || method->wrapper_type == MONO_WRAPPER_MANAGED_TO_MANAGED) { method = mono_marshal_method_from_wrapper (method); if (!method) return FALSE; @@ -70,7 +70,8 @@ mono_declsec_create_frame (MonoDomain *domain, MonoJitInfo *jinfo) jinfo->cas_inited = TRUE; } - frame->method = mono_method_get_object (domain, jinfo->method, NULL); + MONO_OBJECT_SETREF (frame, method, mono_method_get_object (domain, jinfo->method, NULL)); + MONO_OBJECT_SETREF (frame, domain, domain->domain); /* stack modifiers on methods have priority on (i.e. replaces) modifiers on class */ @@ -174,7 +175,7 @@ mono_declsec_is_assembly_fulltrust (MonoDomain *domain, MonoAssembly *assembly) * @domain The current application domain * @caller The method calling * @callee The called method - * return value: TRUE if a security violation is detection, FALSE otherwise. + * return value: TRUE if a security violation is detected, FALSE otherwise. * * If callee's assembly is strongnamed and doesn't have an * [AllowPartiallyTrustedCallers] attribute then we must enforce a LinkDemand @@ -213,6 +214,8 @@ mono_declsec_linkdemand_aptc (MonoDomain *domain, MonoMethod *caller, MonoMethod /* look for AllowPartiallyTrustedCallersAttribute */ result = mono_custom_attrs_has_attr (cinfo, secman->allowpartiallytrustedcallers); } + if (cinfo) + mono_custom_attrs_free (cinfo); MONO_SECMAN_FLAG_SET_VALUE (assembly->aptc, result); } @@ -220,6 +223,7 @@ mono_declsec_linkdemand_aptc (MonoDomain *domain, MonoMethod *caller, MonoMethod return FALSE; /* E - the caller's assembly must have full trust permissions */ + assembly = mono_image_get_assembly (caller->klass->image); if (mono_declsec_is_assembly_fulltrust (domain, assembly)) return FALSE; @@ -235,7 +239,7 @@ mono_declsec_linkdemand_aptc (MonoDomain *domain, MonoMethod *caller, MonoMethod * @domain The current application domain * @caller The method calling * @native The native method called - * return value: TRUE if a security violation is detection, FALSE otherwise. + * return value: TRUE if a security violation is detected, FALSE otherwise. * * Executing Platform Invokes (P/Invoke) is a is a restricted operation. * The security policy must allow (SecurityPermissionFlag.UnmanagedCode) @@ -266,6 +270,7 @@ mono_declsec_linkdemand_pinvoke (MonoDomain *domain, MonoMethod *caller, MonoMet if (MONO_SECMAN_FLAG_INIT (assembly->fulltrust) && MONO_SECMAN_FLAG_GET_VALUE (assembly->fulltrust)) { /* FullTrust includes UnmanagedCode permission */ MONO_SECMAN_FLAG_SET_VALUE (assembly->unmanaged, TRUE); + return FALSE; } else { MonoReflectionAssembly *refass = (MonoReflectionAssembly*) mono_assembly_get_object (domain, assembly); MonoSecurityManager* secman = mono_security_manager_get_methods (); @@ -300,7 +305,7 @@ mono_declsec_linkdemand_pinvoke (MonoDomain *domain, MonoMethod *caller, MonoMet * @domain The current application domain * @caller The method calling * @icall The internal call method - * return value: TRUE if a security violation is detection, FALSE otherwise. + * return value: TRUE if a security violation is detected, FALSE otherwise. * * We can't trust the icall flags/iflags as it comes from the assembly * that we may want to restrict and we do not have the public/restricted