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, |