src/java.base/share/classes/java/security/ProtectionDomain.java
author mchung
Tue, 06 Nov 2018 10:01:16 -0800
changeset 52427 3c6aa484536c
parent 49588 ae568aefc5aa
child 52431 b0af758a092c
permissions -rw-r--r--
8211122: Reduce the number of internal classes made accessible to jdk.unsupported Reviewed-by: alanb, dfuchs, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
49588
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
     2
 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5183
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5183
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5183
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5183
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5183
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.security;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
    28
import java.util.ArrayList;
48207
acfac57f4c35 8193156: Need to backout fixes for JDK-8058547, JDK-8055753, JDK-8085903
igerasim
parents: 47216
diff changeset
    29
import java.util.Collections;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.List;
48207
acfac57f4c35 8193156: Need to backout fixes for JDK-8058547, JDK-8055753, JDK-8085903
igerasim
parents: 47216
diff changeset
    32
import java.util.Map;
42153
d57f354dd0ab 8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents: 41596
diff changeset
    33
import java.util.Objects;
48207
acfac57f4c35 8193156: Need to backout fixes for JDK-8058547, JDK-8055753, JDK-8085903
igerasim
parents: 47216
diff changeset
    34
import java.util.WeakHashMap;
52427
3c6aa484536c 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
mchung
parents: 49588
diff changeset
    35
import jdk.internal.access.JavaSecurityAccess;
3c6aa484536c 8211122: Reduce the number of internal classes made accessible to jdk.unsupported
mchung
parents: 49588
diff changeset
    36
import jdk.internal.access.SharedSecrets;
43803
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    37
import sun.security.action.GetPropertyAction;
41377
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
    38
import sun.security.provider.PolicyFile;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import sun.security.util.Debug;
41377
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
    40
import sun.security.util.FilePermCompat;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import sun.security.util.SecurityConstants;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
/**
30687
eb40445ce6d7 8055753: Use ConcurrentHashMap to map ProtectionDomain to PermissionCollection
mullan
parents: 30033
diff changeset
    44
 * The ProtectionDomain class encapsulates the characteristics of a domain,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * which encloses a set of classes whose instances are granted a set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * of permissions when being executed on behalf of a given set of Principals.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * A static set of permissions can be bound to a ProtectionDomain when it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * constructed; such permissions are granted to the domain regardless of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * Policy in force. However, to support dynamic security policies, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * ProtectionDomain can also be constructed such that it is dynamically
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * mapped to a set of permissions by the current Policy whenever a permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * is checked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @author Li Gong
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @author Roland Schemers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * @author Gary Ellison
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 43803
diff changeset
    58
 * @since 1.2
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
public class ProtectionDomain {
30687
eb40445ce6d7 8055753: Use ConcurrentHashMap to map ProtectionDomain to PermissionCollection
mullan
parents: 30033
diff changeset
    62
43803
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    63
    /**
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    64
     * If true, {@link #impliesWithAltFilePerm} will try to be compatible on
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    65
     * FilePermission checking even if a 3rd-party Policy implementation is set.
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    66
     */
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    67
    private static final boolean filePermCompatInPD =
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    68
            "true".equals(GetPropertyAction.privilegedGetProperty(
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    69
                "jdk.security.filePermCompat"));
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
    70
29027
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    71
    private static class JavaSecurityAccessImpl implements JavaSecurityAccess {
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    72
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    73
        private JavaSecurityAccessImpl() {
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    74
        }
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    75
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    76
        @Override
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    77
        public <T> T doIntersectionPrivilege(
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    78
                PrivilegedAction<T> action,
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    79
                final AccessControlContext stack,
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    80
                final AccessControlContext context) {
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    81
            if (action == null) {
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    82
                throw new NullPointerException();
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    83
            }
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    84
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    85
            return AccessController.doPrivileged(
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    86
                action,
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    87
                getCombinedACC(context, stack)
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    88
            );
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    89
        }
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    90
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    91
        @Override
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    92
        public <T> T doIntersectionPrivilege(
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    93
                PrivilegedAction<T> action,
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    94
                AccessControlContext context) {
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    95
            return doIntersectionPrivilege(action,
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    96
                AccessController.getContext(), context);
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    97
        }
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
    98
41596
a6382b6ba29d 8165271: Fix use of reflection to gain access to private fields
ddehaven
parents: 41377
diff changeset
    99
        @Override
a6382b6ba29d 8165271: Fix use of reflection to gain access to private fields
ddehaven
parents: 41377
diff changeset
   100
        public ProtectionDomain[] getProtectDomains(AccessControlContext context) {
a6382b6ba29d 8165271: Fix use of reflection to gain access to private fields
ddehaven
parents: 41377
diff changeset
   101
            return context.getContext();
a6382b6ba29d 8165271: Fix use of reflection to gain access to private fields
ddehaven
parents: 41377
diff changeset
   102
        }
a6382b6ba29d 8165271: Fix use of reflection to gain access to private fields
ddehaven
parents: 41377
diff changeset
   103
30687
eb40445ce6d7 8055753: Use ConcurrentHashMap to map ProtectionDomain to PermissionCollection
mullan
parents: 30033
diff changeset
   104
        private static AccessControlContext getCombinedACC(
eb40445ce6d7 8055753: Use ConcurrentHashMap to map ProtectionDomain to PermissionCollection
mullan
parents: 30033
diff changeset
   105
            AccessControlContext context, AccessControlContext stack) {
eb40445ce6d7 8055753: Use ConcurrentHashMap to map ProtectionDomain to PermissionCollection
mullan
parents: 30033
diff changeset
   106
            AccessControlContext acc =
eb40445ce6d7 8055753: Use ConcurrentHashMap to map ProtectionDomain to PermissionCollection
mullan
parents: 30033
diff changeset
   107
                new AccessControlContext(context, stack.getCombiner(), true);
29027
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
   108
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
   109
            return new AccessControlContext(stack.getContext(), acc).optimize();
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
   110
        }
49588
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   111
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   112
        @Override
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   113
        public ProtectionDomainCache getProtectionDomainCache() {
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   114
            return new ProtectionDomainCache() {
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   115
                private final Map<Key, PermissionCollection> map =
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   116
                        Collections.synchronizedMap(new WeakHashMap<>());
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   117
                public void put(ProtectionDomain pd,
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   118
                                PermissionCollection pc) {
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   119
                    map.put((pd == null ? null : pd.key), pc);
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   120
                }
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   121
                public PermissionCollection get(ProtectionDomain pd) {
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   122
                    return pd == null ? map.get(null) : map.get(pd.key);
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   123
                }
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   124
            };
ae568aefc5aa 8152821: Merge jdk.internal.misc.JavaSecurityAccess and jdk.internal.misc.JavaSecurityProtectionDomainAccess shared secrets
redestad
parents: 48207
diff changeset
   125
        }
29027
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
   126
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
8816
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 7970
diff changeset
   128
    static {
48207
acfac57f4c35 8193156: Need to backout fixes for JDK-8058547, JDK-8055753, JDK-8085903
igerasim
parents: 47216
diff changeset
   129
        // Set up JavaSecurityAccess in SharedSecrets
29027
2df5737b2c8a 8064331: JavaSecurityAccess.doIntersectionPrivilege() drops the information about the domain combiner of the stack ACC
jbachorik
parents: 27181
diff changeset
   130
        SharedSecrets.setJavaSecurityAccess(new JavaSecurityAccessImpl());
8816
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 7970
diff changeset
   131
    }
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 7970
diff changeset
   132
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /* CodeSource */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    private CodeSource codesource ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /* ClassLoader the protection domain was consed from */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    private ClassLoader classloader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /* Principals running-as within this protection domain */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    private Principal[] principals;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /* the rights this protection domain is granted */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    private PermissionCollection permissions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /* if the permissions object has AllPermission */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    private boolean hasAllPerm = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /* the PermissionCollection is static (pre 1.4 constructor)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
       or dynamic (via a policy refresh) */
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   150
    private final boolean staticPermissions;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   152
    /*
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   153
     * An object used as a key when the ProtectionDomain is stored in a Map.
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   154
     */
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   155
    final Key key = new Key();
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   156
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Creates a new ProtectionDomain with the given CodeSource and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * Permissions. If the permissions object is not null, then
37880
60ec48925dc6 8156661: Handful of typos in javadoc
igerasim
parents: 34956
diff changeset
   160
     *  {@code setReadOnly()} will be called on the passed in
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   161
     * Permissions object.
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   162
     * <p>
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   163
     * The permissions granted to this domain are static, i.e.
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   164
     * invoking the {@link #staticPermissionsOnly()} method returns true.
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   165
     * They contain only the ones passed to this constructor and
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   166
     * the current Policy will not be consulted.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @param codesource the codesource associated with this domain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @param permissions the permissions granted to this domain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public ProtectionDomain(CodeSource codesource,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                            PermissionCollection permissions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        this.codesource = codesource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        if (permissions != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            this.permissions = permissions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            this.permissions.setReadOnly();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            if (permissions instanceof Permissions &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                ((Permissions)permissions).allPermission != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                hasAllPerm = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        this.classloader = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        this.principals = new Principal[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        staticPermissions = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * Creates a new ProtectionDomain qualified by the given CodeSource,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * Permissions, ClassLoader and array of Principals. If the
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 18222
diff changeset
   190
     * permissions object is not null, then {@code setReadOnly()}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * will be called on the passed in Permissions object.
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   192
     * <p>
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   193
     * The permissions granted to this domain are dynamic, i.e.
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   194
     * invoking the {@link #staticPermissionsOnly()} method returns false.
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   195
     * They include both the static permissions passed to this constructor,
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   196
     * and any permissions granted to this domain by the current Policy at the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * time a permission is checked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * This constructor is typically used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * {@link SecureClassLoader ClassLoaders}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * and {@link DomainCombiner DomainCombiners} which delegate to
18579
b678846778ad 8019360: Cleanup of the javadoc <code> tag in java.security.*
juh
parents: 18222
diff changeset
   202
     * {@code Policy} to actively associate the permissions granted to
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * this domain. This constructor affords the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Policy provider the opportunity to augment the supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * PermissionCollection to reflect policy changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @param codesource the CodeSource associated with this domain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * @param permissions the permissions granted to this domain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @param classloader the ClassLoader associated with this domain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * @param principals the array of Principals associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * domain. The contents of the array are copied to protect against
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * subsequent modification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @see Policy#refresh
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @see Policy#getPermissions(ProtectionDomain)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    public ProtectionDomain(CodeSource codesource,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                            PermissionCollection permissions,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                            ClassLoader classloader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                            Principal[] principals) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        this.codesource = codesource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        if (permissions != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            this.permissions = permissions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            this.permissions.setReadOnly();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            if (permissions instanceof Permissions &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                ((Permissions)permissions).allPermission != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                hasAllPerm = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        this.classloader = classloader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        this.principals = (principals != null ? principals.clone():
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                           new Principal[0]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        staticPermissions = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Returns the CodeSource of this domain.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * @return the CodeSource of this domain which may be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    public final CodeSource getCodeSource() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        return this.codesource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * Returns the ClassLoader of this domain.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @return the ClassLoader of this domain which may be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    public final ClassLoader getClassLoader() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        return this.classloader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * Returns an array of principals for this domain.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * @return a non-null array of principals for this domain.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * Returns a new array each time this method is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    public final Principal[] getPrincipals() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        return this.principals.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * Returns the static permissions granted to this domain.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * @return the static set of permissions for this domain which may be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @see Policy#refresh
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * @see Policy#getPermissions(ProtectionDomain)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    public final PermissionCollection getPermissions() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        return permissions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    /**
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   280
     * Returns true if this domain contains only static permissions
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   281
     * and does not check the current {@code Policy} at the time of
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   282
     * permission checking.
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   283
     *
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   284
     * @return true if this domain contains only static permissions.
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   285
     *
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   286
     * @since 9
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   287
     */
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   288
    public final boolean staticPermissionsOnly() {
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   289
        return this.staticPermissions;
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   290
    }
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   291
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   292
    /**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * Check and see if this ProtectionDomain implies the permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * expressed in the Permission object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * The set of permissions evaluated is a function of whether the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * ProtectionDomain was constructed with a static set of permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * or it was bound to a dynamically mapped set of permissions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * <p>
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   300
     * If the {@link #staticPermissionsOnly()} method returns
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   301
     * true, then the permission will only be checked against the
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   302
     * PermissionCollection supplied at construction.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * <p>
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   304
     * Otherwise, the permission will be checked against the combination
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   305
     * of the PermissionCollection supplied at construction and
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * the current Policy binding.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     *
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   308
     * @param perm the Permission object to check.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     *
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   310
     * @return true if {@code perm} is implied by this ProtectionDomain.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     */
39747
2d542b973871 8138811: Construction of static protection domains
valeriep
parents: 37882
diff changeset
   312
    public boolean implies(Permission perm) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        if (hasAllPerm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            // internal permission collection already has AllPermission -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            // no need to go to policy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        if (!staticPermissions &&
41377
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   321
            Policy.getPolicyNoCheck().implies(this, perm)) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   322
            return true;
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   323
        }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   324
        if (permissions != null) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   325
            return permissions.implies(perm);
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   326
        }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   327
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   328
        return false;
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   329
    }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   330
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   331
    /**
43803
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   332
     * This method has almost the same logic flow as {@link #implies} but
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   333
     * it ensures some level of FilePermission compatibility after JDK-8164705.
41377
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   334
     *
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   335
     * This method is called by {@link AccessControlContext#checkPermission}
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   336
     * and not intended to be called by an application.
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   337
     */
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   338
    boolean impliesWithAltFilePerm(Permission perm) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   339
43803
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   340
        // If FilePermCompat.compat is set (default value), FilePermission
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   341
        // checking compatibility should be considered.
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   342
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   343
        // If filePermCompatInPD is set, this method checks for alternative
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   344
        // FilePermission to keep compatibility for any Policy implementation.
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   345
        // When set to false (default value), implies() is called since
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   346
        // the PolicyFile implementation already supports compatibility.
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   347
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   348
        // If this is a subclass of ProtectionDomain, call implies()
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   349
        // because most likely user has overridden it.
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   350
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   351
        if (!filePermCompatInPD || !FilePermCompat.compat ||
e1881d258206 8168410: Multiple JCK tests are failing due to SecurityException is not thrown.
weijun
parents: 42153
diff changeset
   352
                getClass() != ProtectionDomain.class) {
41377
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   353
            return implies(perm);
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   354
        }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   355
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   356
        if (hasAllPerm) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   357
            // internal permission collection already has AllPermission -
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   358
            // no need to go to policy
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
            return true;
41377
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   360
        }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   361
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   362
        Permission p2 = null;
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   363
        boolean p2Calculated = false;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
41377
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   365
        if (!staticPermissions) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   366
            Policy policy = Policy.getPolicyNoCheck();
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   367
            if (policy instanceof PolicyFile) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   368
                // The PolicyFile implementation supports compatibility
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   369
                // inside and it also covers the static permissions.
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   370
                return policy.implies(this, perm);
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   371
            } else {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   372
                if (policy.implies(this, perm)) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   373
                    return true;
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   374
                }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   375
                p2 = FilePermCompat.newPermUsingAltPath(perm);
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   376
                p2Calculated = true;
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   377
                if (p2 != null && policy.implies(this, p2)) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   378
                    return true;
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   379
                }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   380
            }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   381
        }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   382
        if (permissions != null) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   383
            if (permissions.implies(perm)) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   384
                return true;
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   385
            } else {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   386
                if (!p2Calculated) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   387
                    p2 = FilePermCompat.newPermUsingAltPath(perm);
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   388
                }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   389
                if (p2 != null) {
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   390
                    return permissions.implies(p2);
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   391
                }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   392
            }
271ee055cb31 8164705: Remove pathname canonicalization from FilePermission
weijun
parents: 39747
diff changeset
   393
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
18222
2b50015e08db 8001330: Improve on checking order
mullan
parents: 10336
diff changeset
   397
    // called by the VM -- do not remove
2b50015e08db 8001330: Improve on checking order
mullan
parents: 10336
diff changeset
   398
    boolean impliesCreateAccessControlContext() {
2b50015e08db 8001330: Improve on checking order
mullan
parents: 10336
diff changeset
   399
        return implies(SecurityConstants.CREATE_ACC_PERMISSION);
2b50015e08db 8001330: Improve on checking order
mullan
parents: 10336
diff changeset
   400
    }
2b50015e08db 8001330: Improve on checking order
mullan
parents: 10336
diff changeset
   401
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * Convert a ProtectionDomain to a String.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     */
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   405
    @Override public String toString() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        String pals = "<no principals>";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        if (principals != null && principals.length > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            StringBuilder palBuf = new StringBuilder("(principals ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            for (int i = 0; i < principals.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
                palBuf.append(principals[i].getClass().getName() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                            " \"" + principals[i].getName() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                            "\"");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                if (i < principals.length-1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
                    palBuf.append(",\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
                else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                    palBuf.append(")\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            pals = palBuf.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        // Check if policy is set; we don't want to load
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        // the policy prematurely here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        PermissionCollection pc = Policy.isSet() && seeAllp() ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                                      mergePermissions():
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                                      getPermissions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        return "ProtectionDomain "+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            " "+codesource+"\n"+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            " "+classloader+"\n"+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            " "+pals+"\n"+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            " "+pc+"\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
37882
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   435
    /*
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   436
     * holder class for the static field "debug" to delay its initialization
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   437
     */
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   438
    private static class DebugHolder {
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   439
        private static final Debug debug = Debug.getInstance("domain");
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   440
    }
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   441
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * Return true (merge policy permissions) in the following cases:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * . SecurityManager is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * . SecurityManager is not null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     *          debug is not null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     *          SecurityManager impelmentation is in bootclasspath,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     *          Policy implementation is in bootclasspath
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     *          (the bootclasspath restrictions avoid recursion)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * . SecurityManager is not null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     *          debug is null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     *          caller has Policy.getPolicy permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    private static boolean seeAllp() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        SecurityManager sm = System.getSecurityManager();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        if (sm == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        } else {
37882
e7f3cf12e739 6328855: String: Matches hangs at short and easy Strings containing \r \n
sherman
parents: 37880
diff changeset
   463
            if (DebugHolder.debug != null) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
                if (sm.getClass().getClassLoader() == null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
                    Policy.getPolicyNoCheck().getClass().getClassLoader()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
                                                                == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
                    return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
                    sm.checkPermission(SecurityConstants.GET_POLICY_PERMISSION);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
                    return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
                } catch (SecurityException se) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                    // fall thru and return false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    private PermissionCollection mergePermissions() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        if (staticPermissions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            return permissions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        PermissionCollection perms =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
            java.security.AccessController.doPrivileged
30033
b9c86c17164a 8078468: Update security libraries to use diamond with anonymous classes
darcy
parents: 29492
diff changeset
   488
            (new java.security.PrivilegedAction<>() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                    public PermissionCollection run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                        Policy p = Policy.getPolicyNoCheck();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
                        return p.getPermissions(ProtectionDomain.this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
                });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        Permissions mergedPerms = new Permissions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
        int swag = 32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        int vcap = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        Enumeration<Permission> e;
7970
af1579474d16 7008728: diamond conversion of basic security, permissions, authentication
smarks
parents: 5506
diff changeset
   499
        List<Permission> pdVector = new ArrayList<>(vcap);
af1579474d16 7008728: diamond conversion of basic security, permissions, authentication
smarks
parents: 5506
diff changeset
   500
        List<Permission> plVector = new ArrayList<>(swag);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        // Build a vector of domain permissions for subsequent merge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        if (permissions != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
            synchronized (permissions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
                e = permissions.elements();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
                while (e.hasMoreElements()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
                    pdVector.add(e.nextElement());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        // Build a vector of Policy permissions for subsequent merge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
        if (perms != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            synchronized (perms) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
                e = perms.elements();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                while (e.hasMoreElements()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                    plVector.add(e.nextElement());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
                    vcap++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        if (perms != null && permissions != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
            // Weed out the duplicates from the policy. Unless a refresh
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 18579
diff changeset
   528
            // has occurred since the pd was consed this should result in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
            // an empty vector.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
            synchronized (permissions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
                e = permissions.elements();   // domain vs policy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
                while (e.hasMoreElements()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
                    Permission pdp = e.nextElement();
10336
0bb1999251f8 7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents: 9035
diff changeset
   534
                    Class<?> pdpClass = pdp.getClass();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
                    String pdpActions = pdp.getActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
                    String pdpName = pdp.getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
                    for (int i = 0; i < plVector.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
                        Permission pp = plVector.get(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
                        if (pdpClass.isInstance(pp)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
                            // The equals() method on some permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
                            // have some side effects so this manual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
                            // comparison is sufficient.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
                            if (pdpName.equals(pp.getName()) &&
42153
d57f354dd0ab 8043252: Debug of access control is obfuscated - NullPointerException in ProtectionDomain
jnimeh
parents: 41596
diff changeset
   544
                                Objects.equals(pdpActions, pp.getActions())) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
                                plVector.remove(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
                                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        if (perms !=null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
            // the order of adding to merged perms and permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
            // needs to preserve the bugfix 4301064
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
            for (int i = plVector.size()-1; i >= 0; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
                mergedPerms.add(plVector.get(i));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
        if (permissions != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
            for (int i = pdVector.size()-1; i >= 0; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
                mergedPerms.add(pdVector.get(i));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        return mergedPerms;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    }
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   570
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   571
    /**
48207
acfac57f4c35 8193156: Need to backout fixes for JDK-8058547, JDK-8055753, JDK-8085903
igerasim
parents: 47216
diff changeset
   572
     * Used for storing ProtectionDomains as keys in a Map.
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2
diff changeset
   573
     */
48207
acfac57f4c35 8193156: Need to backout fixes for JDK-8058547, JDK-8055753, JDK-8085903
igerasim
parents: 47216
diff changeset
   574
    final class Key {}
30687
eb40445ce6d7 8055753: Use ConcurrentHashMap to map ProtectionDomain to PermissionCollection
mullan
parents: 30033
diff changeset
   575
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
}