diff options
author | skerner@google.com <skerner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 14:47:18 +0000 |
---|---|---|
committer | skerner@google.com <skerner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 14:47:18 +0000 |
commit | 73e4c36f363107b3b625001ebf524ca247c5220c (patch) | |
tree | aeafb62d03121d1881aa36180d7dcab6e047a990 /base/file_util.h | |
parent | e4d9c1fb00637f609fb81e00c8e5be5d3c1c8230 (diff) | |
download | chromium_src-73e4c36f363107b3b625001ebf524ca247c5220c.zip chromium_src-73e4c36f363107b3b625001ebf524ca247c5220c.tar.gz chromium_src-73e4c36f363107b3b625001ebf524ca247c5220c.tar.bz2 |
Add external extensions json source in proper mac location.
The old path will be deprecated once developers have migrated.
BUG=67203
TEST=FileUtilTest.IsPathControledByAdmin
Review URL: http://codereview.chromium.org/7718021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r-- | base/file_util.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/base/file_util.h b/base/file_util.h index 133854b..2cc8caa 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -377,6 +377,32 @@ BASE_EXPORT bool GetCurrentDirectory(FilePath* path); // Sets the current working directory for the process.
BASE_EXPORT bool SetCurrentDirectory(const FilePath& path);
+#if defined(OS_POSIX)
+// Test that |path| can only be changed by a specific user and group.
+// Specifically, test that all parts of |path| under (and including) |base|:
+// * Exist.
+// * Are owned by a specific user and group.
+// * Are not writable by all users.
+// * Are not symbolic links.
+// This is useful for checking that a config file is administrator-controlled.
+// |base| must contain |path|.
+BASE_EXPORT bool VerifyPathControlledByUser(const FilePath& base,
+ const FilePath& path,
+ uid_t owner_uid,
+ gid_t group_gid);
+#endif // defined(OS_POSIX)
+
+#if defined(OS_MACOSX)
+// Is |path| writable only by a user with administrator privileges?
+// This function uses Mac OS conventions. The super user is assumed to have
+// uid 0, and the administrator group is assumed to be named "admin".
+// Testing that |path|, and every parent directory including the root of
+// the filesystem, are owned by the superuser, controlled by the group
+// "admin", are not writable by all users, and contain no symbolic links.
+// Will return false if |path| does not exist.
+BASE_EXPORT bool VerifyPathControlledByAdmin(const FilePath& path);
+#endif // defined(OS_MACOSX)
+
// A class to handle auto-closing of FILE*'s.
class ScopedFILEClose {
public:
|