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

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: Address rev comments. 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..f8e11adf7053e72413eb5e2e6cf16c83303c13c3 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -659,6 +659,22 @@ enum FileSystemType {
BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type);
#endif
+#if defined(OS_POSIX)
+// Test that a path is owned by a specific user, and not writable
+// by all users. This is useful for checking that a config file
+// is administrator-controlled. All components of |path| after |base|
+// are checked. Note that |base| is not checked, and |base| must be a
+// parent of |path|.
+BASE_EXPORT bool IsPathControlledByUser(const FilePath& base,
+ const FilePath& path,
+ uid_t owner_uid);
+
+// Is |path| writable only by a user with administrator privileges?
+// Check this by testing that |path|, and every parent directory,
+// are owned by root and not writable by all users.
+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