summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 20:12:24 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 20:12:24 +0000
commit39a1a06a6a01617cc5f8f81db8ae23704700a73f (patch)
tree00ee129dcafc9b096f4b79037f8bb1486af93e76 /base
parente2b56436aa3784f9a1bdf506b1430f68f2ec49eb (diff)
downloadchromium_src-39a1a06a6a01617cc5f8f81db8ae23704700a73f.zip
chromium_src-39a1a06a6a01617cc5f8f81db8ae23704700a73f.tar.gz
chromium_src-39a1a06a6a01617cc5f8f81db8ae23704700a73f.tar.bz2
posix: directories should only be readable by the user.
Almost all the data we store is private, so we shouldn't even allow it to be group-readable. Note that files still obey the user's umask and if someone wants to make their download directory world-readable we won't undo that. BUG=11776 Review URL: http://codereview.chromium.org/113287 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15890 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_util.h2
-rw-r--r--base/file_util_posix.cc5
2 files changed, 3 insertions, 4 deletions
diff --git a/base/file_util.h b/base/file_util.h
index 47254ab..3d07229 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -316,7 +316,7 @@ bool CreateNewTempDirectory(const std::wstring& prefix,
// Creates a directory, as well as creating any parent directories, if they
// don't exist. Returns 'true' on successful creation, or if the directory
-// already exists.
+// already exists. The directory is only readable by the current user.
bool CreateDirectory(const FilePath& full_path);
// Deprecated temporary compatibility function.
bool CreateDirectory(const std::wstring& full_path);
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 06f3c1a..ae296ca 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -214,8 +214,7 @@ bool CopyDirectory(const FilePath& from_path,
}
// Try creating the target dir, continuing on it if it exists already.
- // Rely on the user's umask to produce correct permissions.
- if (mkdir(target_path.value().c_str(), 0777) != 0) {
+ if (mkdir(target_path.value().c_str(), 0700) != 0) {
if (errno != EEXIST)
error = errno;
}
@@ -425,7 +424,7 @@ bool CreateDirectory(const FilePath& full_path) {
for (std::vector<FilePath>::reverse_iterator i = subpaths.rbegin();
i != subpaths.rend(); ++i) {
if (!DirectoryExists(*i)) {
- if (mkdir(i->value().c_str(), 0777) != 0)
+ if (mkdir(i->value().c_str(), 0700) != 0)
return false;
}
}