|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
75 | 75 | * inappropriate.</p>
|
76 | 76 | *
|
77 | 77 | * <p>If there is no SecurityManager, then the access controller will refuse
|
78 |
| - * to create an MBean that is a ClassLoader, which includes MLets, or to |
79 |
| - * execute the method addURL on an MBean that is an MLet. This prevents |
| 78 | + * to create an MBean that is a ClassLoader. This prevents |
80 | 79 | * people from opening security holes unintentionally. Otherwise, it
|
81 | 80 | * would not be obvious that granting write access grants the ability to
|
82 | 81 | * download and execute arbitrary code in the target MBean server. Advanced
|
83 |
| - * users who do want the ability to use MLets are presumably advanced enough |
| 82 | + * users who do want an MBean which is a ClassLoader are presumably advanced enough |
84 | 83 | * to handle policy files and security managers.</p>
|
85 | 84 | */
|
86 | 85 | public abstract class MBeanServerAccessController
|
@@ -468,7 +467,6 @@ public Object invoke(ObjectName name, String operationName,
|
468 | 467 | MBeanException,
|
469 | 468 | ReflectionException {
|
470 | 469 | checkWrite();
|
471 |
| - checkMLetMethods(name, operationName); |
472 | 470 | return getMBeanServer().invoke(name, operationName, params, signature);
|
473 | 471 | }
|
474 | 472 |
|
@@ -620,49 +618,6 @@ private void checkClassLoader(Object object) {
|
620 | 618 | "manager is installed.");
|
621 | 619 | }
|
622 | 620 |
|
623 |
| - private void checkMLetMethods(ObjectName name, String operation) |
624 |
| - throws InstanceNotFoundException { |
625 |
| - // Check if security manager installed |
626 |
| - @SuppressWarnings("removal") |
627 |
| - SecurityManager sm = System.getSecurityManager(); |
628 |
| - if (sm != null) { |
629 |
| - return; |
630 |
| - } |
631 |
| - // Check for addURL and getMBeansFromURL methods |
632 |
| - if (!operation.equals("addURL") && |
633 |
| - !operation.equals("getMBeansFromURL")) { |
634 |
| - return; |
635 |
| - } |
636 |
| - // Check if MBean is instance of MLet |
637 |
| - if (!getMBeanServer().isInstanceOf(name, |
638 |
| - "javax.management.loading.MLet")) { |
639 |
| - return; |
640 |
| - } |
641 |
| - // Throw security exception |
642 |
| - if (operation.equals("addURL")) { // addURL |
643 |
| - throw new SecurityException("Access denied! MLet method addURL " + |
644 |
| - "cannot be invoked unless a security manager is installed."); |
645 |
| - } else { // getMBeansFromURL |
646 |
| - // Whether or not calling getMBeansFromURL is allowed is controlled |
647 |
| - // by the value of the "jmx.remote.x.mlet.allow.getMBeansFromURL" |
648 |
| - // system property. If the value of this property is true, calling |
649 |
| - // the MLet's getMBeansFromURL method is allowed. The default value |
650 |
| - // for this property is false. |
651 |
| - final String propName = "jmx.remote.x.mlet.allow.getMBeansFromURL"; |
652 |
| - GetPropertyAction propAction = new GetPropertyAction(propName); |
653 |
| - @SuppressWarnings("removal") |
654 |
| - String propValue = AccessController.doPrivileged(propAction); |
655 |
| - boolean allowGetMBeansFromURL = "true".equalsIgnoreCase(propValue); |
656 |
| - if (!allowGetMBeansFromURL) { |
657 |
| - throw new SecurityException("Access denied! MLet method " + |
658 |
| - "getMBeansFromURL cannot be invoked unless a " + |
659 |
| - "security manager is installed or the system property " + |
660 |
| - "-Djmx.remote.x.mlet.allow.getMBeansFromURL=true " + |
661 |
| - "is specified."); |
662 |
| - } |
663 |
| - } |
664 |
| - } |
665 |
| - |
666 | 621 | //------------------
|
667 | 622 | // PRIVATE VARIABLES
|
668 | 623 | //------------------
|
|
0 commit comments