classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Access control contexts (silly idea)


From: Casey Marshall
Subject: Access control contexts (silly idea)
Date: Tue, 10 Feb 2004 11:18:34 -0800
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I was looking into ways to implement the AccessController.getContext
method, and devised a way to do it without dipping into native
methods. In short, it uses the getStackTrace method of Throwable to
obtain the current stack, fetches each Class named in the stack, then
gets the ProtectionDomain for that Class.

This is a kludge, and I would not be surprised that certain conditions
cause this to fail.

At any rate, there is a bug in the AccessControlContext constructor
that references the protectionDomain array before it is created.

Patches attached. Comments?

2004-02-10  Casey Marshall <address@hidden>

        * java/security/AccessControlContext.java
        (<init>): compare entries in the `context' array.
        Use `equals', not `=='.
        (toString): new method.

2004-02-10  Casey Marshall <address@hidden>

        * java/security/AccessController.java
        (contexts): new class field.
        (defaultContext): new constant.
        (doPrivileged): put supplied contexts into `contexts'.
        (doPrivileged): likewise.
        (getContext): implemented.

        * java/lang/SecurityManager.java
        (getSecurityContext): use AccessController.getContext().
        (checkPermission): use AccessControlContext.checkPermission().
        (checkPermission): likewise.
        (checkConnect): likewise.

- -- 
Casey Marshall || address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.7 <http://mailcrypt.sourceforge.net/>

iD8DBQFAKS4PgAuWMgRGsWsRAkO5AJ9uKub/3ocBRbYyYKzgnYZZ+KSbrwCeMRDc
mmymlIQIaDZrsJ2cwA/PlBU=
=DvZ9
-----END PGP SIGNATURE-----

Attachment: ac.patch
Description: Patch to AccessController

Attachment: acc.patch
Description: Patch to AccessControlContext

Attachment: sm.patch
Description: Patch to SecurityManager.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]