[Mono-list] System.Security
Gaurav Vaish
gvaish@iitk.ac.in
Mon, 31 Dec 2001 09:02:44 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_000D_01C191D9.E8D41B30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi,
Though I cannot tell how to solve the problem but there seems to be a bug in the system provided. The function does not throw
NotImplementedException, yet, it always returns a "true"!
I am attaching a code where I did the following:
* Pass an empty WebPermission instance
* Pass a null
* Pass a WebPermission instance with permissions as "None", and you get a "true".
Either I am testing it wrongly, or there's a bug. I am attaching the code.
Cheers,
Gaurav Vaish
http://mastergaurav.virtualave.net
http://calendar.yahoo.com/mastergaurav
---------------------------------
----- Original Message -----
From: "Nick Drochak" <ndrochak@gol.com>
To: "'Miguel de Icaza'" <miguel@ximian.com>
Cc: <mono-list@ximian.com>
Sent: Monday, December 31, 2001 04:16
Subject: RE: [Mono-list] System.Security
: > For those bits, just bring the topics up on the mailing list,
: > and we can discuss them here. Paolo and Dietmar are coming
: > back from holidays the next week.
: >
:
: For implementing System.Security.SecurityManger.IsGranted(Ipermission):
: How does one obtain the permissions granted to the calling code
: assembly? The docs indicate that the runtime grants permissions based
: on policy and on any declarative security requests (required, optional,
: refused). So, I am assuming there must be a window into the runtime
: (some API) where we can get this info.
:
: Regards,
: Nick D.
:
:
:
: _______________________________________________
: Mono-list maillist - Mono-list@ximian.com
: http://lists.ximian.com/mailman/listinfo/mono-list
------=_NextPart_000_000D_01C191D9.E8D41B30
Content-Type: application/octet-stream;
name="SecurityManagerTest.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="SecurityManagerTest.cs"
/**
* Class: SecurityManagerTest
*
* Author: Gaurav Vaish
* Maintainer: gvaish@iitk.ac.in
* Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
* Implementation: yes
* Status: 100%
*
* (C) Gaurav Vaish (2001)
*/
using System;
using System.Net;
using System.Security;
using System.Security.Permissions;
public class SecurityManagerTest
{
public static void Main()
{
WebPermission wp = new WebPermission();
bool isGranted = SecurityManager.IsGranted(wp);
System.Console.WriteLine("Granted: {0}", (isGranted ? "yes" : "no"));
isGranted = SecurityManager.IsGranted(null);
System.Console.WriteLine("Granted: {0}", (isGranted ? "yes" : "no"));
wp = new WebPermission(PermissionState.None);
isGranted = SecurityManager.IsGranted(wp);
System.Console.WriteLine("Granted: {0}", (isGranted ? "yes" : "no"));
}
}
------=_NextPart_000_000D_01C191D9.E8D41B30--