diff options
author | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-12 15:13:57 +0000 |
---|---|---|
committer | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-12 15:13:57 +0000 |
commit | 01e2a1fabe5a6d0065f535a9de4bdd98f0640906 (patch) | |
tree | 2050dd5669e2907324d13002cb261ffa15c8d1f9 /base/file_util.h | |
parent | 4979b09a75936283a62772b7078de381d60061fc (diff) | |
download | chromium_src-01e2a1fabe5a6d0065f535a9de4bdd98f0640906.zip chromium_src-01e2a1fabe5a6d0065f535a9de4bdd98f0640906.tar.gz chromium_src-01e2a1fabe5a6d0065f535a9de4bdd98f0640906.tar.bz2 |
Use realpath() to find the path to the extension unpack dir on posix systems.
Extensions are unpacked by a sandboxed utility process. The sandbox forbids file access outside the directory the extension will be unpacked in. If the path to that directory contains a symbolic link, then unpacking will fail because following the link will cause file system access outside the sandbox path. Use realpath() to get a symlink free path to the directory where the extension will be unpacked.
A similar issue exists on windows, with junctions instead of symlinks. This will be fixed in another change.
BUG=13044,35198
TEST=FileUtilTest.RealPath
Review URL: http://codereview.chromium.org/2001013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r-- | base/file_util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/file_util.h b/base/file_util.h index a129876..64a91ee 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -279,6 +279,13 @@ bool IsDot(const FilePath& path); // Returns true if the given path's base name is "..". bool IsDotDot(const FilePath& path); +#if defined(OS_POSIX) +// Set |real_path| to |path| with symbolic links expanded. +// Windows support (expanding junctions) comming soon: +// http://crbug.com/13044 +bool RealPath(const FilePath& path, FilePath* real_path); +#endif + // Used to hold information about a given file path. See GetFileInfo below. struct FileInfo { // The size of the file in bytes. Undefined when is_directory is true. |