diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index 1f189cea..57a23d37 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -448,7 +448,6 @@ public static void main(String... args) throws Throwable { EnvHelper.checkDangerousParams(); JVMHelper.checkStackTrace(ClientLauncher.class); LogHelper.printVersion("Client Launcher"); - //System.setSecurityManager(new ClientSecurityManager()); engine.readKeys(); HWIDProvider.registerHWIDs(); LauncherGuardManager.initGuard(true); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientSecurityManager.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientSecurityManager.java deleted file mode 100644 index 86fea872..00000000 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientSecurityManager.java +++ /dev/null @@ -1,29 +0,0 @@ -package pro.gravit.launcher.client; - -import java.security.Permission; - -public class ClientSecurityManager extends SecurityManager { - @Override - public void checkPermission(Permission perm) - { - String permName = perm.getName(); - if(permName == null) return; - if (permName.startsWith("exitVM")) - { - Class[] classContexts = getClassContext(); - String callingClass = classContexts.length > 3 ? classContexts[4].getName() : "none"; - if (!(callingClass.startsWith("pro.gravit."))) - { - throw new ExitTrappedException(); - } - } - } - - @Override - public void checkPermission(Permission perm, Object context) { - } - - public static class ExitTrappedException extends SecurityException { - private static final long serialVersionUID = 6929785890434102330L; - } -} diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientJSONPoint.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientJSONPoint.java index e91effcc..488cf589 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientJSONPoint.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientJSONPoint.java @@ -82,7 +82,7 @@ public void openAsync(Runnable onConnect) { new WebSocketClientHandler( WebSocketClientHandshakerFactory.newHandshaker( uri, WebSocketVersion.V13, null, false, EmptyHttpHeaders.INSTANCE, 12800000), this); - ChannelFuture future = bootstrap.connect(); + ChannelFuture future = bootstrap.connect(uri.getHost(), port); future.addListener((e) -> { ch = future.channel(); webSocketClientHandler.handshakeFuture().addListener((e1) -> onConnect.run()); diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java index 23a280ff..6112f0dc 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/LauncherTrustManager.java @@ -40,7 +40,7 @@ public enum CheckMode { } public interface CertificateChecker { - void check(X509Certificate cert, X509Certificate signer) throws SecurityException; + void check(X509Certificate cert, X509Certificate signer, int number) throws SecurityException; } public void checkCertificate(X509Certificate[] certs, CertificateChecker checker) throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { @@ -61,7 +61,7 @@ public void checkCertificate(X509Certificate[] certs, CertificateChecker checker throw new CertificateException(String.format("Certificate %s is not signed by a trusted signer", cert.getSubjectDN().getName())); } } - checker.check(cert, signer); + checker.check(cert, signer, i); } Collections.addAll(trustCache, certs); } @@ -108,11 +108,11 @@ public void isCertificateCodeSign(X509Certificate certificate) } public void isCertificateCA(X509Certificate certificate) { - if(certificate.getBasicConstraints() <= 0) throw new SecurityException("This certificate not CA"); + if(certificate.getBasicConstraints() < 0) throw new SecurityException("This certificate not CA"); } - public void stdCertificateChecker(X509Certificate cert, X509Certificate signer) + public void stdCertificateChecker(X509Certificate cert, X509Certificate signer, int number) { - if(signer == null) + if(number == 0) isCertificateCodeSign(cert); else isCertificateCA(cert); diff --git a/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java b/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java index 093c271a..221df950 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/UniversalJsonAdapter.java @@ -46,6 +46,10 @@ public JsonElement serialize(R src, Type typeOfSrc, JsonSerializationContext con if (classPath == null && src instanceof TypeSerializeInterface) { classPath = ((TypeSerializeInterface) src).getType(); } + if(classPath == null) + { + LogHelper.warning("Class %s type null", src.getClass()); + } jo.add(PROP_NAME, new JsonPrimitive(classPath)); return jo;