EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SolFS paths containing ".."

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#28654
Posted: 03/03/2014 21:26:24
by Jeremy Spiegel (Standard support level)
Joined: 01/29/2014
Posts: 16

I'm not seeing SolFS handle path traversal with ".." components referring to the parent directory. For example, when trying to use it in a destination path in a call to DeleteAndRenameFile, I'm seeing the function fail. Is this expected? Thanks.
#28656
Posted: 03/04/2014 00:32:06
by Eugene Mayevski (EldoS Corp.)

Please provide the details about the problem - how it looks like and how it can be reproduced. Also please specify the edition (App, OS) and environment (OS, platform etc).


Sincerely yours
Eugene Mayevski
#28657
Posted: 03/04/2014 00:57:01
by Alexander Plas (EldoS Corp.)

Hello

SolFS handles ".." and "." in the paths. However, since SolFS doesn't have current directory as dedicated property, path which starts with dot is invalid. In other words you can use pats "/1/../2/../3" as valid path to "/3" but path "../3" is invalid.

Only one place where relative paths are valid is symlink. In this case part is relative to symlink directory. For example, if the link "/1/link" contains path "../2/file", this path is valid and the link resolves to "/2/file".
#28659
Posted: 03/04/2014 01:17:42
by Jeremy Spiegel (Standard support level)
Joined: 01/29/2014
Posts: 16

Hi, I'm using SolFS Application edition on the mac. The following code sets up a file in a directory:
Code
        SolFSStorage storage;
        storage.set_FileName("/tmp/solfs_test");
        storage.Open(somCreateAlways);
        
        storage.ForceCreateDirectories("/dir1/dir2");
        
        SolFSStream(&storage, "/dir1/dir2/file", "w").Write("abcd", 4);


The following code successfully moves the file:
Code
        storage.DeleteAndRenameFile("/dir1/dir2/file", "/dir1/file");


However, the following fails with error -9 "Path not found":
Code
        storage.DeleteAndRenameFile("/dir1/dir2/file", "/dir1/dir2/../file");


If SolFS was handling the ".." in the new file path, I would expect both to work. Thanks for your help!

Reply

Statistics

Topic viewed 2117 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!