Nasal security: don't break file dialogs
Include the directory itself when allowing reading Don't kill the script on a denied directory read
This commit is contained in:
parent
74356e84f7
commit
f749953493
2 changed files with 4 additions and 1 deletions
|
@ -101,6 +101,8 @@ void fgInitAllowedPaths()
|
|||
#endif
|
||||
read_allowed_paths.push_back(fg_root + sep + "*");
|
||||
read_allowed_paths.push_back(fg_home + sep + "*");
|
||||
read_allowed_paths.push_back(fg_root);
|
||||
read_allowed_paths.push_back(fg_home);
|
||||
string_list const aircraft_paths = globals->get_aircraft_paths();
|
||||
string_list const scenery_paths = globals->get_secure_fg_scenery();
|
||||
// not plain fg_scenery, to avoid making
|
||||
|
@ -124,6 +126,7 @@ void fgInitAllowedPaths()
|
|||
exit(-1);
|
||||
}
|
||||
read_allowed_paths.push_back(SGPath(*it).realpath() + sep + "*");
|
||||
read_allowed_paths.push_back(SGPath(*it).realpath());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -581,7 +581,7 @@ static naRef f_directory(naContext c, naRef me, int argc, naRef* args)
|
|||
naStr_data(args[0]) << "' denied (unauthorized directory - authorization"
|
||||
" no longer follows symlinks; to authorize reading additional "
|
||||
"directories, add them to --fg-aircraft)");
|
||||
naRuntimeError(c, "directory(): access denied (unauthorized directory)");
|
||||
// to avoid breaking dialogs, pretend it doesn't exist rather than erroring out
|
||||
return naNil();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue