author | avstepan |
Fri, 24 Apr 2015 20:51:41 +0400 | |
changeset 30037 | 3e785fad2c3b |
parent 25859 | 3317bb8137f4 |
child 34894 | 3248b89d1921 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
20742
diff
changeset
|
2 |
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package com.sun.jdi; |
|
27 |
||
28 |
/** |
|
30037 | 29 |
* The {@code JDIPermission} class represents access rights to |
30 |
* the {@code VirtualMachineManager}. This is the permission |
|
2 | 31 |
* which the SecurityManager will check when code that is running with |
32 |
* a SecurityManager requests access to the VirtualMachineManager, as |
|
33 |
* defined in the Java Debug Interface (JDI) for the Java platform. |
|
34 |
* <P> |
|
30037 | 35 |
* A {@code JDIPermission} object contains a name (also referred |
2 | 36 |
* to as a "target name") but no actions list; you either have the |
37 |
* named permission or you don't. |
|
38 |
* <P> |
|
39 |
* The following table provides a summary description of what the |
|
40 |
* permission allows, and discusses the risks of granting code the |
|
41 |
* permission. |
|
30037 | 42 |
* |
2 | 43 |
* <table border=1 cellpadding=5 summary="Table shows permission |
44 |
* target name, what the permission allows, and associated risks"> |
|
45 |
* <tr> |
|
46 |
* <th>Permission Target Name</th> |
|
47 |
* <th>What the Permission Allows</th> |
|
48 |
* <th>Risks of Allowing this Permission</th> |
|
49 |
* </tr> |
|
50 |
* |
|
51 |
* <tr> |
|
52 |
* <td>virtualMachineManager</td> |
|
53 |
* <td>Ability to inspect and modify the JDI objects in the |
|
30037 | 54 |
* {@code VirtualMachineManager} |
2 | 55 |
* </td> |
56 |
* <td>This allows an attacker to control the |
|
30037 | 57 |
* {@code VirtualMachineManager} and cause the system to |
2 | 58 |
* misbehave. |
59 |
* </td> |
|
60 |
* </tr> |
|
61 |
* |
|
62 |
* </table> |
|
63 |
* |
|
64 |
* <p> |
|
65 |
* Programmers do not normally create JDIPermission objects directly. |
|
66 |
* Instead they are created by the security policy code based on reading |
|
67 |
* the security policy file. |
|
68 |
* |
|
69 |
* @author Tim Bell |
|
70 |
* @since 1.5 |
|
71 |
* |
|
72 |
* @see com.sun.jdi.Bootstrap |
|
73 |
* @see java.security.BasicPermission |
|
74 |
* @see java.security.Permission |
|
75 |
* @see java.security.Permissions |
|
76 |
* @see java.security.PermissionCollection |
|
77 |
* @see java.lang.SecurityManager |
|
78 |
* |
|
79 |
*/ |
|
80 |
||
20742
4ae78e8060d6
8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents:
14342
diff
changeset
|
81 |
@jdk.Exported |
2 | 82 |
public final class JDIPermission extends java.security.BasicPermission { |
11277 | 83 |
private static final long serialVersionUID = -6988461416938786271L; |
2 | 84 |
/** |
30037 | 85 |
* The {@code JDIPermission} class represents access rights to the |
86 |
* {@code VirtualMachineManager} |
|
2 | 87 |
* @param name Permission name. Must be "virtualMachineManager". |
88 |
* @throws IllegalArgumentException if the name argument is invalid. |
|
89 |
*/ |
|
90 |
public JDIPermission(String name) { |
|
91 |
super(name); |
|
92 |
if (!name.equals("virtualMachineManager")) { |
|
93 |
throw new IllegalArgumentException("name: " + name); |
|
94 |
} |
|
95 |
} |
|
96 |
||
97 |
/** |
|
98 |
* Constructs a new JDIPermission object. |
|
99 |
* |
|
100 |
* @param name Permission name. Must be "virtualMachineManager". |
|
101 |
* @param actions Must be either null or the empty string. |
|
102 |
* @throws IllegalArgumentException if arguments are invalid. |
|
103 |
*/ |
|
104 |
public JDIPermission(String name, String actions) |
|
105 |
throws IllegalArgumentException { |
|
106 |
super(name); |
|
107 |
if (!name.equals("virtualMachineManager")) { |
|
108 |
throw new IllegalArgumentException("name: " + name); |
|
109 |
} |
|
110 |
if (actions != null && actions.length() > 0) { |
|
111 |
throw new IllegalArgumentException("actions: " + actions); |
|
112 |
} |
|
113 |
} |
|
114 |
} |