99 lines
3.9 KiB
Diff
99 lines
3.9 KiB
Diff
From 2f1c27ad92f12ee3ed2165b6ac43b52e41f3b2d8 Mon Sep 17 00:00:00 2001
|
|
From: wang--ge <wang__ge@126.com>
|
|
Date: Wed, 2 Aug 2023 11:48:21 +0800
|
|
Subject: [PATCH] aaaaaa
|
|
|
|
---
|
|
.../manager/WildFlySecurityManager.java | 44 ++++++++++---------
|
|
1 file changed, 23 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/src/main/java/org/wildfly/security/manager/WildFlySecurityManager.java b/src/main/java/org/wildfly/security/manager/WildFlySecurityManager.java
|
|
index 6feb16e..b5e35f4 100644
|
|
--- a/src/main/java/org/wildfly/security/manager/WildFlySecurityManager.java
|
|
+++ b/src/main/java/org/wildfly/security/manager/WildFlySecurityManager.java
|
|
@@ -56,7 +56,7 @@ import org.wildfly.security.manager.action.ReadEnvironmentPropertyAction;
|
|
import org.wildfly.security.manager.action.ReadPropertyAction;
|
|
import org.wildfly.security.manager.action.SetContextClassLoaderAction;
|
|
import org.wildfly.security.manager.action.WritePropertyAction;
|
|
-import sun.reflect.Reflection;
|
|
+//import sun.reflect.Reflection;
|
|
|
|
import static java.lang.System.clearProperty;
|
|
import static java.lang.System.getProperties;
|
|
@@ -100,7 +100,7 @@ public final class WildFlySecurityManager extends SecurityManager {
|
|
|
|
private static final Field PD_STACK;
|
|
private static final WildFlySecurityManager INSTANCE;
|
|
- private static final boolean hasGetCallerClass;
|
|
+ //private static final boolean hasGetCallerClass;
|
|
private static final int callerOffset;
|
|
|
|
static {
|
|
@@ -110,17 +110,18 @@ public final class WildFlySecurityManager extends SecurityManager {
|
|
return new WildFlySecurityManager();
|
|
}
|
|
});
|
|
- boolean result = false;
|
|
- int offset = 0;
|
|
- try {
|
|
+ //boolean result = false;
|
|
+ //int offset = 0;
|
|
+ //try {
|
|
//noinspection deprecation
|
|
- result = Reflection.getCallerClass(1) == WildFlySecurityManager.class || Reflection.getCallerClass(2) == WildFlySecurityManager.class;
|
|
+ // result = Reflection.getCallerClass(1) == WildFlySecurityManager.class || Reflection.getCallerClass(2) == WildFlySecurityManager.class;
|
|
//noinspection deprecation
|
|
- offset = Reflection.getCallerClass(1) == Reflection.class ? 2 : 1;
|
|
+ // offset = Reflection.getCallerClass(1) == Reflection.class ? 2 : 1;
|
|
|
|
- } catch (Throwable ignored) {}
|
|
- hasGetCallerClass = result;
|
|
- callerOffset = offset;
|
|
+ //} catch (Throwable ignored) {}
|
|
+ //hasGetCallerClass = result;
|
|
+ //callerOffset = offset;
|
|
+ callerOffset = 0;
|
|
}
|
|
|
|
private static final RuntimePermission ACCESS_DECLARED_MEMBERS_PERMISSION = new RuntimePermission("accessDeclaredMembers");
|
|
@@ -141,11 +142,12 @@ public final class WildFlySecurityManager extends SecurityManager {
|
|
|
|
@SuppressWarnings("deprecation")
|
|
static Class<?> getCallerClass(int n) {
|
|
- if (hasGetCallerClass) {
|
|
- return Reflection.getCallerClass(n + callerOffset);
|
|
- } else {
|
|
- return getCallStack()[n + callerOffset];
|
|
- }
|
|
+ //if (hasGetCallerClass) {
|
|
+ // return Reflection.getCallerClass(n + callerOffset);
|
|
+ //} else {
|
|
+ // return getCallStack()[n + callerOffset];
|
|
+ //}
|
|
+ return getCallStack()[n + callerOffset];
|
|
}
|
|
|
|
static Class<?>[] getCallStack() {
|
|
@@ -429,12 +431,12 @@ public final class WildFlySecurityManager extends SecurityManager {
|
|
}
|
|
}
|
|
|
|
- @Deprecated @SuppressWarnings("deprecation")
|
|
- public void checkMulticast(final InetAddress maddr, final byte ttl) {
|
|
- if (doCheck()) {
|
|
- super.checkMulticast(maddr, ttl);
|
|
- }
|
|
- }
|
|
+ //@Deprecated @SuppressWarnings("deprecation")
|
|
+ //public void checkMulticast(final InetAddress maddr, final byte ttl) {
|
|
+ // if (doCheck()) {
|
|
+ // super.checkMulticast(maddr, ttl);
|
|
+ // }
|
|
+ //}
|
|
|
|
public void checkPropertiesAccess() {
|
|
if (doCheck()) {
|
|
--
|
|
2.33.0
|
|
|