Merge branch 'tweak/java-version' into 'dev'

Tweak/java version

See merge request crafty-controller/crafty-4!364
This commit is contained in:
Iain Powrie 2022-06-18 21:19:24 +00:00
commit cb69bdabc0
2 changed files with 19 additions and 14 deletions

View File

@ -1,12 +1,12 @@
# Changelog # Changelog
## [4.0.3] - TBD ## [4.0.3] - 2022/06/18
### New features ### New features
TBD None
### Bug fixes ### Bug fixes
TBD - Amend Java system variable fix to be more specfic since they only affect Oracle. ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/364))
### Tweaks ### Tweaks
- Add better error logging for statistic collection ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/359)) - Add better error logging for statistic collection ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/359))

View File

@ -239,18 +239,23 @@ class ServerInstance:
"Detected nebulous java in start command. " "Detected nebulous java in start command. "
"Replacing with full java path." "Replacing with full java path."
) )
which_java_raw = self.helper.which_java() # Checks for Oracle Java. Only Oracle Java's helper will cause a re-exec.
java_path = which_java_raw + "\\bin\\java" if "/Oracle/Java/" in str(shutil.which("java")):
if str(which_java_raw) != str(self.helper.get_servers_root_dir) or str( logger.info(
self.helper.get_servers_root_dir "Oracle Java detected. Changing start command to avoid re-exec."
) in str(which_java_raw):
self.server_command[0] = java_path
else:
logger.critcal(
"Possible attack detected. User attempted to exec "
"java binary from server directory."
) )
return which_java_raw = self.helper.which_java()
java_path = which_java_raw + "\\bin\\java"
if str(which_java_raw) != str(self.helper.get_servers_root_dir) or str(
self.helper.get_servers_root_dir
) in str(which_java_raw):
self.server_command[0] = java_path
else:
logger.critcal(
"Possible attack detected. User attempted to exec "
"java binary from server directory."
)
return
self.server_path = Helpers.get_os_understandable_path(self.settings["path"]) self.server_path = Helpers.get_os_understandable_path(self.settings["path"])
# let's do some quick checking to make sure things actually exists # let's do some quick checking to make sure things actually exists