Index: base/file_util.h |
diff --git a/base/file_util.h b/base/file_util.h |
index 133854b5c7c66906cddea171dc15bf98d2a88678..f4f8756bc5505d2a3bfa9aa33712e8f6c1342529 100644 |
--- a/base/file_util.h |
+++ b/base/file_util.h |
@@ -43,6 +43,41 @@ class Time; |
namespace file_util { |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
Evan Martin
2011/09/21 18:15:24
Probably didn't mean for so much whitespace here a
Sam Kerner (Chrome)
2011/09/21 18:57:07
Trybots have been failing to patch changes to this
|
+#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, and 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, |
Evan Martin
2011/09/21 18:15:24
Why is this a pointer? If it being NULL has a mea
Sam Kerner (Chrome)
2011/09/21 18:57:07
Fixed.
|
+ 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 privlages? |
+// This function uses Mac OS conventions. It assumes that the superuser |
+// has uid 0, and the administrator group is named "admin". Test that |
+// |path| and every parent directory (including the root of the |
+// filesystem) are owned by the superuser, controlled by the admin |
+// group, 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) |
+ |
+ |
+ |
+ |
+ |
+ |
//----------------------------------------------------------------------------- |
// Functions that operate purely on a path string w/o touching the filesystem: |
Evan Martin
2011/09/21 18:15:24
It looks like this file might be organized into ca
Sam Kerner (Chrome)
2011/09/21 18:57:07
Put them with functions that touch the filesystem.
|