Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: base/file_util.h

Issue 7718021: Add external extensions json source in proper mac location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use IsParent() Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | base/file_util_posix.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.h
diff --git a/base/file_util.h b/base/file_util.h
index cd7fa9fafcbe68865e578b3c173adb84419e34e7..4a53fbf392f344c25ba0bfde51bfe43f7ab57427 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -659,6 +659,28 @@ enum FileSystemType {
BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type);
#endif
+#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.
Evan Martin 2011/08/30 17:26:38 Does it matter that you check the group, when you
Sam Kerner (Chrome) 2011/09/16 18:12:59 I considered not checking group membership if the
+// * 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 IsPathControlledByUser(const FilePath& base,
+ const FilePath& path,
+ uid_t owner_uid,
+ gid_t group_gid);
+
+// Is |path| writable only by a user with administrator privileges?
+// Check this by testing that |path|, and every parent directory including
+// the root of the filesystem, are owned by root, controlled by the group
+// "admin", are not writable by all users, and contain no symbolic links.
Evan Martin 2011/08/30 17:26:38 What is "admin" here? It is not true that my root
Sam Kerner (Chrome) 2011/09/16 18:12:59 Updated to make it clear that this function is mac
+// Will return false if |path| does not exist.
+BASE_EXPORT bool IsPathControlledByAdmin(const FilePath& path);
+#endif // defined(OS_POSIX)
+
} // namespace file_util
// Deprecated functions have been moved to this separate header file,
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | base/file_util_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698