Menu

#479 loadxml: reading 'file.xml' denied (unauthorized access) from --aircraft directory

Fixed
nobody
None
Low
2011-12-28
2011-11-04
Anonymous
No

Originally created by: val... (code.google.com)@gmail.com

*What steps will reproduce the problem?*
1.
Put tu154b aircraft to any folder outside %FG_ROOT
($ svn co http://svn.flightgear.ru/tu154b/ tu154b)
2.
Add this folder to command line with $ fgfs --fg-aircraft=/path/to/folder
3.
Run FG

*What is the expected output? What do you see instead?*
I expected that all files in aircraft loaded same as if it was in fgdata/Aircraft/tu154b

Instead some path become absolute to system, and so denied to open.

*Any output in the console (black window)?*

PNK started

Engines support started
Fuel support started
Warning subsystem started
loadxml: reading '/home/v/progs/fg-osg/CustomAircrafts//tu154b/Dialogs/nav.xml' denied (unauthorized access)
Nasal runtime error: Dialog class: XML dialog must have <name>
at /home/v/progs/fg-osg/data/Nasal/gui.nas, line 324
called from: /home/v/progs/fg-osg/data/Nasal/gui.nas, line 309
called from: /home/v/progs/fg-osg/data/Nasal/globals.nas, line 100
Nasal runtime error: container index not scalar
at /home/v/progs/fg-osg/data/Nasal/gui.nas, line 311
called from: /home/v/progs/fg-osg/CustomAircrafts//tu154b/Nasal/absu.nas, line 914
View registered
Hydro systems started
loadxml: reading '/home/v/progs/fg-osg/CustomAircrafts//tu154b/Model/Liveries/85131-AFL.xml' denied (unauthorized access)
Nasal runtime error: non-objects have no members
at /home/v/progs/fg-osg/data/Nasal/gui.nas, line 446
called from: /home/v/progs/fg-osg/data/Nasal/gui.nas, line 430
called from: /home/v/progs/fg-osg/data/Nasal/gui.nas, line 420
called from: /home/v/progs/fg-osg/data/Nasal/aircraft.nas, line 519
called from: /home/v/progs/fg-osg/CustomAircrafts//tu154b/Nasal/liveries.nas, line 7
Help subsystem started

*What FlightGear version are you using (when using GIT version, please
mention date)?*
FG-git from 04nov2011

*What operating system and graphics card?*
Ubuntu10.04, GF gtx550ti

*Please provide any additional information below or as attachment (Avoid
expiring external links, such as to imageshack/pastebin/...).*

Some xml are loaded, some not...
I discovered, that, for example:

1.
In dialogs.nas:

var load_dlg=gui.Dialog.new("/tu154/dialogs/Loads/dialog","Aircraft/tu154b/Dialogs/Loads.xml");

--- WORKS ---

2.
In absu.nas:

gui.Dialog.new("/sim/gui/dialogs/Tu-154B-2/nav/dialog", "Aircraft/tu154b/Dialogs/nav.xml");

--- DON'T WORK ---
As you can see in upper console output, that path become absolute:
'/home/v/progs/fg-osg/CustomAircrafts//tu154b/Dialogs/nav.xml'

Related

Tickets: #479

Discussion

  • Anonymous

    Anonymous - 2011-11-07

    Originally posted by: bre... (code.google.com)@gmail.com

    Not reproducible here using "fgfs --fg-aircraft=/path/to/folder".
    However, it is reproducible when using "fgfs --fg-aircraft=/path/to/folder/" (notice the extra "/" at the end of the path).

    @valleo: can you check whether the extra "/" was the cause for the issue on your machine?

    @james: can we somehow strip superfluous directory separators from given command-line arguments to avoid such issues?

    Labels: Priority-Low
    Cc: zakalawe@mac.com
    Status: Accepted

     
  • Anonymous

    Anonymous - 2011-11-08

    Originally posted by: val... (code.google.com)@gmail.com

    Yes, same here - without last "/" all works fine.
    Usually I use fgrun, and its command line look like

    /usr/local/bin/fgfs
      --fg-root=/home/v/progs/fg-osg/data
      --fg-scenery=/home/v/progs/fg-osg/Scenery_TerraSync/
      --fg-aircraft=/home/v/progs/fg-osg/CustomAircrafts/

    and I even unable edit it; and need copypast it to console.
    So its fgrun issue too, as it add slashes not to all paths.

    Thank you for catching this, hope its will be not hard to fix it.

     
  • Anonymous

    Anonymous - 2011-11-08

    Originally posted by: frbo... (code.google.com)@gmail.com

    fgrun [r635] now remove trailing slash after dir selection

     
  • Anonymous

    Anonymous - 2011-12-18

    Originally posted by: bre... (code.google.com)@gmail.com

    I also changed simgear to cut trailing "/" when converting from string to sgpath - this
    should avoid any similar issues.
    https://www.gitorious.org/fg/simgear/commit/54db2e0ab196b659e4297c0d93f088b2212409f5

    Status: Testing

     
  • Anonymous

    Anonymous - 2011-12-26

    Originally posted by: j...@flygarna.se

    I argue that the commit http://gitorious.org/fg/simgear/commit/54db2e0ab196b659e4297c0d93f088b2212409f5 is bad.

    In unix double slashes are legal, i.e., /home/v/progs/fg-osg/CustomAircrafts//tu154b/Dialogs/nav.xml should be treated as /home/v/progs/fg-osg/CustomAircrafts/tu154b/Dialogs/nav.xml. It should not be SGPath's responsibility to avoid double / in paths. In the specific case of trailing /, how can it be SGPath responsibility to make sure that a user will create a double // (which should be legal). I am not the designer of the SGPath class and I do not know what it's responsibility should be but not allowing trailing slash is unexpected behaviour. Therefore I considered the commit on Dec 18 to be flawed.

    A side effect is already visible: The commit breaks Map in the atlas project.

     
  • Anonymous

    Anonymous - 2011-12-27

    Originally posted by: bre... (code.google.com)@gmail.com

    It is legal to have multiple "//" in a path, but it does not add functionality. It is also common to use functions like "canonicalPath" to convert paths specs to there simple representation, i.e. "bla/../foo" to "foo" etc - which would also remove consecutive "/" characters and trailing "/". Having simple, unique represenations of paths has many advatanges.

    This indeed "breaks" the Atlas utility - but that's more a bug in Atlas (uses "concat" instead of "append" to add a subdirectory). See patch:
    https://build.opensuse.org/package/view_file?file=DirectoryStructure.patch&package=Atlas&project=home%3Athorstenbr%3Aflightgear&rev=bcfba42cbe08916e8dc06ccfcfb23f32

    Status: Fixed

     
  • Anonymous

    Anonymous - 2011-12-27

    Originally posted by: j...@flygarna.se

    Thanks for the link. However, it doesn't solve my atlas/Map problem. I need to do

    $ cvs diff Tiles.cxx
    Index: Tiles.cxx
    ===================================================================
    RCS file: /cvsroot/atlas/Atlas/src/Tiles.cxx,v
    retrieving [r1].14
    diff -[r1].14 Tiles.cxx
    391,392c391,392
    <     result.concat(str);
    <     result.append("");
    ---
    >     result.append(str);
    >     result.append("/foobar");

    because of the stripping of foobar by the SGPath/mapPath treatment. With your changes and my additional fix I get a working Map.

     
  • Anonymous

    Anonymous - 2011-12-27

    Originally posted by: j...@flygarna.se

    Sorry, it is late.

    I meant to say that adding the /foobar will make the SGPath/mapPath implementation to strip away foobar rather than the 'level' (i.e., 4, 6, 8, 9, 10).

     
  • Anonymous

    Anonymous - 2011-12-28

    Originally posted by: j...@flygarna.se

    I understand that fixing atlas is not a part of this issue but I want to correct my previous post that fixes Map _BUT_ breaks Atlas. The fix should not be inside mapPath but rather in TileManager::setMapLevels after the call to mapPath before creating directories. The problem I am chasing in Map/Atlas only happens in a pristine fgdata without the Atlas/4, Atlas/6, ... directories. The fix in comment 6 (https://code.google.com/p/flightgear-bugs/issues/detail?id=479#c6) works only if the tile directories already exists.

    $ cvs diff Tiles.cxx
    Index: Tiles.cxx
    ===================================================================
    RCS file: /cvsroot/atlas/Atlas/src/Tiles.cxx,v
    retrieving [r1].14
    diff -[r1].14 Tiles.cxx
    391c391
    <     result.concat(str);
    ---
    >     result.append(str);
    393d392
    <
    412c411
    <         dir.concat(entity->d_name);
    ---
    >         dir.append(entity->d_name);
    417c416
    <         file.concat(entity->d_name);
    ---
    >         file.append(entity->d_name);
    441a441,445
    >         // SGPath treats the path as a path to a file and
    >         // consequently strips away the last part of the path.
    >         // Adding a dummy filename to make SGPath.create_dir() to
    >         // actually create the directory.
    >         mapDir.append("/foobar");

     

    Related

    Tickets: #479


Log in to post a comment.

MongoDB Logo MongoDB