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

Side by Side Diff: ipc/ipc_channel_posix.cc

Issue 1262543003: ipc: Create an unforgeable mechanism to get the process id of the sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dchecks. Created 5 years, 4 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
« no previous file with comments | « ipc/ipc_channel_posix.h ('k') | ipc/ipc_channel_reader.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/socket.h> 10 #include <sys/socket.h>
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 NOTREACHED(); 944 NOTREACHED();
945 } 945 }
946 } else { 946 } else {
947 QueueCloseFDMessage(fd, hops); 947 QueueCloseFDMessage(fd, hops);
948 } 948 }
949 break; 949 break;
950 #endif 950 #endif
951 } 951 }
952 } 952 }
953 953
954 base::ProcessId ChannelPosix::GetSenderPID() {
955 return GetPeerPID();
956 }
957
954 void ChannelPosix::Close() { 958 void ChannelPosix::Close() {
955 // Close can be called multiple time, so we need to make sure we're 959 // Close can be called multiple time, so we need to make sure we're
956 // idempotent. 960 // idempotent.
957 961
958 ResetToAcceptingConnectionState(); 962 ResetToAcceptingConnectionState();
959 963
960 if (must_unlink_) { 964 if (must_unlink_) {
961 unlink(pipe_name_.c_str()); 965 unlink(pipe_name_.c_str());
962 must_unlink_ = false; 966 must_unlink_ = false;
963 } 967 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 } 1037 }
1034 1038
1035 #if defined(OS_LINUX) 1039 #if defined(OS_LINUX)
1036 // static 1040 // static
1037 void Channel::SetGlobalPid(int pid) { 1041 void Channel::SetGlobalPid(int pid) {
1038 ChannelPosix::SetGlobalPid(pid); 1042 ChannelPosix::SetGlobalPid(pid);
1039 } 1043 }
1040 #endif // OS_LINUX 1044 #endif // OS_LINUX
1041 1045
1042 } // namespace IPC 1046 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix.h ('k') | ipc/ipc_channel_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698