1
0
Fork 0

Update for changed SGPath::realpath signature

This commit is contained in:
James Turner 2016-07-04 09:06:42 +01:00
parent 8e875b22f5
commit 400901c239
2 changed files with 7 additions and 7 deletions

View file

@ -2084,7 +2084,7 @@ void Options::initAircraft()
// is a symlink (which is not a problem, since it was given as is by the // is a symlink (which is not a problem, since it was given as is by the
// user---this is very different from a symlink *under* the aircraft dir // user---this is very different from a symlink *under* the aircraft dir
// or a scenery dir). // or a scenery dir).
fgSetString("/sim/aircraft-dir", aircraftDirPath.realpath().c_str()); fgSetString("/sim/aircraft-dir", aircraftDirPath.realpath().utf8Str());
} }
if (isOptionSet("state")) { if (isOptionSet("state")) {

View file

@ -81,7 +81,7 @@ static string_list write_allowed_paths;
*/ */
void fgInitAllowedPaths() void fgInitAllowedPaths()
{ {
if(SGPath("ygjmyfvhhnvdoesnotexist").realpath() == "ygjmyfvhhnvdoesnotexist"){ if(SGPath("ygjmyfvhhnvdoesnotexist").realpath().utf8Str() == "ygjmyfvhhnvdoesnotexist"){
// Forbid using this version of fgValidatePath() with older // Forbid using this version of fgValidatePath() with older
// (not normalizing non-existent files) versions of realpath(), // (not normalizing non-existent files) versions of realpath(),
// as that would be a security hole // as that would be a security hole
@ -92,8 +92,8 @@ void fgInitAllowedPaths()
} }
read_allowed_paths.clear(); read_allowed_paths.clear();
write_allowed_paths.clear(); write_allowed_paths.clear();
std::string fg_root = globals->get_fg_root().realpath(); std::string fg_root = globals->get_fg_root().realpath().utf8Str();
std::string fg_home = globals->get_fg_home().realpath(); std::string fg_home = globals->get_fg_home().realpath().utf8Str();
#if defined(_MSC_VER) /*for MS compilers */ || defined(_WIN32) /*needed for non MS windows compilers like MingW*/ #if defined(_MSC_VER) /*for MS compilers */ || defined(_WIN32) /*needed for non MS windows compilers like MingW*/
std::string sep = "\\"; std::string sep = "\\";
#else #else
@ -122,8 +122,8 @@ void fgInitAllowedPaths()
"or fgInitAllowedPaths() called too early"); "or fgInitAllowedPaths() called too early");
exit(-1); exit(-1);
} }
read_allowed_paths.push_back(it->realpath() + sep + "*"); read_allowed_paths.push_back(it->realpath().utf8Str() + sep + "*");
read_allowed_paths.push_back(it->realpath()); read_allowed_paths.push_back(it->realpath().utf8Str());
} }
write_allowed_paths.push_back(fg_home + sep + "*.sav"); write_allowed_paths.push_back(fg_home + sep + "*.sav");
@ -162,7 +162,7 @@ void fgInitAllowedPaths()
SGPath fgValidatePath (const SGPath& path, bool write) SGPath fgValidatePath (const SGPath& path, bool write)
{ {
// Normalize the path (prevents ../../.. or symlink trickery) // Normalize the path (prevents ../../.. or symlink trickery)
std::string normed_path = path.realpath(); std::string normed_path = path.realpath().utf8Str();
const string_list& allowed_paths(write ? write_allowed_paths : read_allowed_paths); const string_list& allowed_paths(write ? write_allowed_paths : read_allowed_paths);
size_t star_pos; size_t star_pos;