mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Check for valid file access first
This commit is contained in:
@ -106,15 +106,16 @@ public class BungeeManager {
|
|||||||
Path legacyFile = plugin.getPluginFolder().resolve(LEGACY_FILE_NAME);
|
Path legacyFile = plugin.getPluginFolder().resolve(LEGACY_FILE_NAME);
|
||||||
try {
|
try {
|
||||||
if (Files.notExists(proxiesFile)) {
|
if (Files.notExists(proxiesFile)) {
|
||||||
if (Files.notExists(legacyFile)) {
|
|
||||||
Files.createFile(proxiesFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Files.exists(legacyFile)) {
|
if (Files.exists(legacyFile)) {
|
||||||
Files.move(legacyFile, proxiesFile);
|
Files.move(legacyFile, proxiesFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Files.notExists(legacyFile)) {
|
||||||
|
Files.createFile(proxiesFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Files.deleteIfExists(legacyFile);
|
||||||
try (Stream<String> lines = Files.lines(proxiesFile)) {
|
try (Stream<String> lines = Files.lines(proxiesFile)) {
|
||||||
return lines.map(String::trim)
|
return lines.map(String::trim)
|
||||||
.map(UUID::fromString)
|
.map(UUID::fromString)
|
||||||
|
@ -85,7 +85,7 @@ public class EncryptionUtil {
|
|||||||
/**
|
/**
|
||||||
* Decrypts the content and extracts the key spec.
|
* Decrypts the content and extracts the key spec.
|
||||||
*
|
*
|
||||||
* @param privateKey decryption cipher initialized with the private key
|
* @param cipher decryption cipher initialized with the private key
|
||||||
* @param sharedKey the encrypted shared key
|
* @param sharedKey the encrypted shared key
|
||||||
* @return shared secret key
|
* @return shared secret key
|
||||||
* @throws GeneralSecurityException if it fails to decrypt the data
|
* @throws GeneralSecurityException if it fails to decrypt the data
|
||||||
|
@ -47,7 +47,7 @@ public class PluginMessageListener implements Listener {
|
|||||||
pluginMessageEvent.setCancelled(true);
|
pluginMessageEvent.setCancelled(true);
|
||||||
|
|
||||||
if (!(pluginMessageEvent.getSender() instanceof Server)) {
|
if (!(pluginMessageEvent.getSender() instanceof Server)) {
|
||||||
//check if the message is sent really from the server and not a malicious client
|
//check if the message is sent from the server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +242,7 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
|
|||||||
Path dataFolder = plugin.getPluginFolder();
|
Path dataFolder = plugin.getPluginFolder();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Files.notExists(dataFolder)) {
|
Files.createDirectories(dataFolder);
|
||||||
Files.createDirectories(dataFolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
Path configFile = dataFolder.resolve(fileName);
|
Path configFile = dataFolder.resolve(fileName);
|
||||||
if (Files.notExists(configFile)) {
|
if (Files.notExists(configFile)) {
|
||||||
|
Reference in New Issue
Block a user