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

Side by Side Diff: ipc/ipc_channel_posix.cc

Issue 6585001: Expand comment for named IPC chmod(). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ipc/ipc_channel_posix.h" 5 #include "ipc/ipc_channel_posix.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 // Bind the socket. 187 // Bind the socket.
188 if (bind(fd, reinterpret_cast<const sockaddr*>(&unix_addr), 188 if (bind(fd, reinterpret_cast<const sockaddr*>(&unix_addr),
189 unix_addr_len) != 0) { 189 unix_addr_len) != 0) {
190 PLOG(ERROR) << "bind " << pipe_name; 190 PLOG(ERROR) << "bind " << pipe_name;
191 if (HANDLE_EINTR(close(fd)) < 0) 191 if (HANDLE_EINTR(close(fd)) < 0)
192 PLOG(ERROR) << "close " << pipe_name; 192 PLOG(ERROR) << "close " << pipe_name;
193 return false; 193 return false;
194 } 194 }
195 195
196 // Adjust the socket permissions. 196 // Adjust the socket permissions as a precaution on ChromeOS.
Wez 2011/02/25 10:23:14 Nit: We're adjusting the permissions even on Linux
197 // Do not rely on these file permissions to provide security - the file is
198 // created during the above bind() call so there is still a window for
199 // malicious abuse because the file exists between bind() and chmod(). Also,
200 // the file permissions may not be enforced for unix sockets on all platforms.
197 if (chmod(pipe_name.c_str(), 0600)) { 201 if (chmod(pipe_name.c_str(), 0600)) {
198 PLOG(ERROR) << "fchmod " << pipe_name; 202 PLOG(ERROR) << "chmod " << pipe_name;
199 if (HANDLE_EINTR(close(fd)) < 0) 203 if (HANDLE_EINTR(close(fd)) < 0)
200 PLOG(ERROR) << "close " << pipe_name; 204 PLOG(ERROR) << "close " << pipe_name;
201 return false; 205 return false;
202 } 206 }
203 207
204 // Start listening on the socket. 208 // Start listening on the socket.
205 const int listen_queue_length = 1; 209 const int listen_queue_length = 1;
206 if (listen(fd, listen_queue_length) != 0) { 210 if (listen(fd, listen_queue_length) != 0) {
207 PLOG(ERROR) << "listen " << pipe_name; 211 PLOG(ERROR) << "listen " << pipe_name;
208 if (HANDLE_EINTR(close(fd)) < 0) 212 if (HANDLE_EINTR(close(fd)) < 0)
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1152
1149 bool Channel::HasAcceptedConnection() const { 1153 bool Channel::HasAcceptedConnection() const {
1150 return channel_impl_->HasAcceptedConnection(); 1154 return channel_impl_->HasAcceptedConnection();
1151 } 1155 }
1152 1156
1153 void Channel::ResetToAcceptingConnectionState() { 1157 void Channel::ResetToAcceptingConnectionState() {
1154 channel_impl_->ResetToAcceptingConnectionState(); 1158 channel_impl_->ResetToAcceptingConnectionState();
1155 } 1159 }
1156 1160
1157 } // namespace IPC 1161 } // namespace IPC
OLDNEW
« 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