// internal - get called by the class loader // Called when // - class inheritance // - method overrides private unsafe static bool InheritanceDemand (AppDomain ad, Assembly a, RuntimeDeclSecurityActions *actions) { try { PermissionSet ps = null; bool result = true; if (actions->cas.size > 0) { ps = Decode (actions->cas.blob, actions->cas.size); result = (SecurityManager.CheckPermissionSet (a, ps, false) == null); if (result) { // also check appdomain result = (SecurityManager.CheckPermissionSet (ad, ps) == null); } } if (actions->noncas.size > 0) { ps = Decode (actions->noncas.blob, actions->noncas.size); result = (SecurityManager.CheckPermissionSet (a, ps, true) == null); if (result) { // also check appdomain result = (SecurityManager.CheckPermissionSet (ad, ps) == null); } } return result; } catch (SecurityException) { return false; } }
private unsafe static bool LinkDemand (Assembly a, RuntimeDeclSecurityActions *klass, RuntimeDeclSecurityActions *method) { try { PermissionSet ps = null; bool result = true; if (klass->cas.size > 0) { ps = Decode (klass->cas.blob, klass->cas.size); result = (SecurityManager.CheckPermissionSet (a, ps, false) == null); } if (result && (klass->noncas.size > 0)) { ps = Decode (klass->noncas.blob, klass->noncas.size); result = (SecurityManager.CheckPermissionSet (a, ps, true) == null); } if (result && (method->cas.size > 0)) { ps = Decode (method->cas.blob, method->cas.size); result = (SecurityManager.CheckPermissionSet (a, ps, false) == null); } if (result && (method->noncas.size > 0)) { ps = Decode (method->noncas.blob, method->noncas.size); result = (SecurityManager.CheckPermissionSet (a, ps, true) == null); } return result; } catch (SecurityException) { return false; } }
private static unsafe extern bool GetLinkDemandSecurity (MethodBase method, RuntimeDeclSecurityActions *cdecl, RuntimeDeclSecurityActions *mdecl);
private unsafe static bool LinkDemand (Assembly a, RuntimeDeclSecurityActions *klass, RuntimeDeclSecurityActions *method) { return false; }
// internal - get called by the class loader // Called when // - class inheritance // - method overrides private unsafe static bool InheritanceDemand (AppDomain ad, Assembly a, RuntimeDeclSecurityActions *actions) { return false; }
private static unsafe bool GetLinkDemandSecurity (MethodBase method, RuntimeDeclSecurityActions *cdecl, RuntimeDeclSecurityActions *mdecl) { throw new System.NotImplementedException(); }