mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Check to "which java" doesn't return none
This commit is contained in:
parent
1b2fef06fb
commit
f5cdd9f573
@ -242,32 +242,36 @@ class ServerInstance:
|
|||||||
"Detected nebulous java in start command. "
|
"Detected nebulous java in start command. "
|
||||||
"Replacing with full java path."
|
"Replacing with full java path."
|
||||||
)
|
)
|
||||||
# Checks for Oracle Java. Only Oracle Java's helper will cause a re-exec.
|
oracle_path = shutil.which("java")
|
||||||
if "/Oracle/Java/" in str(self.helper.wtol_path(shutil.which("java"))):
|
if oracle_path:
|
||||||
logger.info(
|
# Checks for Oracle Java. Only Oracle Java's helper will cause a re-exec.
|
||||||
"Oracle Java detected. Changing start command to avoid re-exec."
|
if "/Oracle/Java/" in str(self.helper.wtol_path(oracle_path)):
|
||||||
)
|
logger.info(
|
||||||
which_java_raw = self.helper.which_java()
|
"Oracle Java detected. Changing"
|
||||||
try:
|
" start command to avoid re-exec."
|
||||||
java_path = which_java_raw + "\\bin\\java"
|
|
||||||
except TypeError:
|
|
||||||
logger.warning(
|
|
||||||
"Could not find java in the registry even though"
|
|
||||||
" Oracle java is installed. Re-exec expected, but we have no"
|
|
||||||
" other options. CPU stats will not work for process."
|
|
||||||
)
|
)
|
||||||
java_path = ""
|
which_java_raw = self.helper.which_java()
|
||||||
if str(which_java_raw) != str(self.helper.get_servers_root_dir) or str(
|
try:
|
||||||
self.helper.get_servers_root_dir
|
java_path = which_java_raw + "\\bin\\java"
|
||||||
) in str(which_java_raw):
|
except TypeError:
|
||||||
if java_path != "":
|
logger.warning(
|
||||||
self.server_command[0] = java_path
|
"Could not find java in the registry even though"
|
||||||
else:
|
" Oracle java is installed."
|
||||||
logger.critcal(
|
" Re-exec expected, but we have no"
|
||||||
"Possible attack detected. User attempted to exec "
|
" other options. CPU stats will not work for process."
|
||||||
"java binary from server directory."
|
)
|
||||||
)
|
java_path = ""
|
||||||
return
|
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):
|
||||||
|
if java_path != "":
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user