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

Unified Diff: ipc/ipc_channel_posix.cc

Issue 6280009: Adjust Unix domain IPC permissions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change from fchmod() to chmod(), hopefully this will fix mac. Created 9 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_posix.cc
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 5ff25aa73a55476a8624c68edbbd7e29b46fa4f6..34fbca988ef037fb494e26f334373f052a3e4822 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -167,14 +167,14 @@ bool CreateServerUnixDomainSocket(const std::string& pipe_name,
// Delete any old FS instances.
unlink(pipe_name.c_str());
- // Make sure the path we need exists.
+ // Make sure the path we need exists.
FilePath path(pipe_name);
FilePath dir_path = path.DirName();
if (!file_util::CreateDirectory(dir_path)) {
return false;
}
- // Create unix_addr structure
+ // Create unix_addr structure.
struct sockaddr_un unix_addr;
memset(&unix_addr, 0, sizeof(unix_addr));
unix_addr.sun_family = AF_UNIX;
@@ -193,6 +193,14 @@ bool CreateServerUnixDomainSocket(const std::string& pipe_name,
return false;
}
+ // Adjust the socket permissions.
+ if (chmod(pipe_name.c_str(), 0600)) {
+ PLOG(ERROR) << "fchmod " << pipe_name;
Nirnimesh 2011/01/21 02:41:55 s/fchmod/chmod/
+ if (HANDLE_EINTR(close(fd)) < 0)
+ PLOG(ERROR) << "close " << pipe_name;
+ return false;
+ }
+
// Start listening on the socket.
const int listen_queue_length = 1;
if (listen(fd, listen_queue_length) != 0) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698