|
|
59b6f52 |
From c004ea96111a4407324a2de7188bb463ba84d28f Mon Sep 17 00:00:00 2001
|
|
|
59b6f52 |
From: Florent Rougon <f.rougon@free.fr>
|
|
|
59b6f52 |
Date: Sat, 26 Aug 2017 17:49:30 +0200
|
|
|
59b6f52 |
Subject: [PATCH] Call fgInitAllowedPaths() earlier: after
|
|
|
59b6f52 |
Options::processOptions()
|
|
|
59b6f52 |
|
|
|
59b6f52 |
Call fgInitAllowedPaths() right after Options::processOptions() (which,
|
|
|
59b6f52 |
among other things, determines $FG_ROOT and processes
|
|
|
59b6f52 |
--allow-nasal-read). This way, fgInitAllowedPaths() can be used in much
|
|
|
59b6f52 |
more code, such as when initializing subsystems.
|
|
|
59b6f52 |
|
|
|
59b6f52 |
(cherry picked from commit c7a2aef59979af3e9ff22daabb37bdaadb91cd75)
|
|
|
59b6f52 |
---
|
|
|
59b6f52 |
src/Main/fg_init.cxx | 7 ++++++-
|
|
|
59b6f52 |
src/Main/main.cxx | 5 +++++
|
|
|
59b6f52 |
src/Scripting/NasalSys.cxx | 4 ----
|
|
|
59b6f52 |
3 files changed, 11 insertions(+), 5 deletions(-)
|
|
|
59b6f52 |
|
|
|
59b6f52 |
diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx
|
|
|
59b6f52 |
index edb464ef2..ff261870a 100644
|
|
|
59b6f52 |
--- a/src/Main/fg_init.cxx
|
|
|
59b6f52 |
+++ b/src/Main/fg_init.cxx
|
|
|
59b6f52 |
@@ -1117,7 +1117,12 @@ void fgStartNewReset()
|
|
|
59b6f52 |
fgInitGeneral(); // all of this?
|
|
|
59b6f52 |
|
|
|
59b6f52 |
flightgear::Options::sharedInstance()->processOptions();
|
|
|
59b6f52 |
-
|
|
|
59b6f52 |
+
|
|
|
59b6f52 |
+ // Rebuild the lists of allowed paths for cases where a path comes from an
|
|
|
59b6f52 |
+ // untrusted source, such as the global property tree (this uses $FG_HOME
|
|
|
59b6f52 |
+ // and other paths set by Options::processOptions()).
|
|
|
59b6f52 |
+ fgInitAllowedPaths();
|
|
|
59b6f52 |
+
|
|
|
59b6f52 |
// PRESERVED properties over-write state from options, intentionally
|
|
|
59b6f52 |
if ( copyProperties(preserved, globals->get_props()) ) {
|
|
|
59b6f52 |
SG_LOG( SG_GENERAL, SG_INFO, "Preserved state restored successfully" );
|
|
|
59b6f52 |
diff --git a/src/Main/main.cxx b/src/Main/main.cxx
|
|
|
59b6f52 |
index b7ee1e67e..ec5ca1bbb 100644
|
|
|
59b6f52 |
--- a/src/Main/main.cxx
|
|
|
59b6f52 |
+++ b/src/Main/main.cxx
|
|
|
59b6f52 |
@@ -537,6 +537,11 @@ int fgMainInit( int argc, char **argv )
|
|
|
59b6f52 |
return EXIT_SUCCESS;
|
|
|
59b6f52 |
}
|
|
|
59b6f52 |
|
|
|
59b6f52 |
+ // Set the lists of allowed paths for cases where a path comes from an
|
|
|
59b6f52 |
+ // untrusted source, such as the global property tree (this uses $FG_HOME
|
|
|
59b6f52 |
+ // and other paths set by Options::processOptions()).
|
|
|
59b6f52 |
+ fgInitAllowedPaths();
|
|
|
59b6f52 |
+
|
|
|
59b6f52 |
// Initialize the Window/Graphics environment.
|
|
|
59b6f52 |
fgOSInit(&argc, argv);
|
|
|
59b6f52 |
_bootstrap_OSInit++;
|
|
|
59b6f52 |
diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx
|
|
|
59b6f52 |
index 36657a970..7b808981a 100644
|
|
|
59b6f52 |
--- a/src/Scripting/NasalSys.cxx
|
|
|
59b6f52 |
+++ b/src/Scripting/NasalSys.cxx
|
|
|
59b6f52 |
@@ -911,10 +911,6 @@ void FGNasalSys::init()
|
|
|
59b6f52 |
.member("simulatedTime", &TimerObj::isSimTime, &f_timerObj_setSimTime)
|
|
|
59b6f52 |
.member("isRunning", &TimerObj::isRunning);
|
|
|
59b6f52 |
|
|
|
59b6f52 |
-
|
|
|
59b6f52 |
- // Set allowed paths for Nasal I/O
|
|
|
59b6f52 |
- fgInitAllowedPaths();
|
|
|
59b6f52 |
-
|
|
|
59b6f52 |
// Now load the various source files in the Nasal directory
|
|
|
59b6f52 |
simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));
|
|
|
59b6f52 |
loadScriptDirectory(nasalDir);
|
|
|
59b6f52 |
--
|
|
|
59b6f52 |
2.13.5
|
|
|
59b6f52 |
|