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

Side by Side Diff: ipc/ipc_channel_win.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_win.h ('k') | ipc/ipc_message.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_win.h" 5 #include "ipc/ipc_channel_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 peer_pid_ = claimed_pid; 237 peer_pid_ = claimed_pid;
238 // Validation completed. 238 // Validation completed.
239 validate_client_ = false; 239 validate_client_ = false;
240 240
241 FlushPrelimQueue(); 241 FlushPrelimQueue();
242 242
243 listener()->OnChannelConnected(claimed_pid); 243 listener()->OnChannelConnected(claimed_pid);
244 } 244 }
245 245
246 base::ProcessId ChannelWin::GetSenderPID() {
247 return GetPeerPID();
248 }
249
246 bool ChannelWin::DidEmptyInputBuffers() { 250 bool ChannelWin::DidEmptyInputBuffers() {
247 // We don't need to do anything here. 251 // We don't need to do anything here.
248 return true; 252 return true;
249 } 253 }
250 254
251 // static 255 // static
252 const base::string16 ChannelWin::PipeName( 256 const base::string16 ChannelWin::PipeName(
253 const std::string& channel_id, int32* secret) { 257 const std::string& channel_id, int32* secret) {
254 std::string name("\\\\.\\pipe\\chrome."); 258 std::string name("\\\\.\\pipe\\chrome.");
255 259
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 int secret; 568 int secret;
565 do { // Guarantee we get a non-zero value. 569 do { // Guarantee we get a non-zero value.
566 secret = base::RandInt(0, std::numeric_limits<int>::max()); 570 secret = base::RandInt(0, std::numeric_limits<int>::max());
567 } while (secret == 0); 571 } while (secret == 0);
568 572
569 id.append(GenerateUniqueRandomChannelID()); 573 id.append(GenerateUniqueRandomChannelID());
570 return id.append(base::StringPrintf("\\%d", secret)); 574 return id.append(base::StringPrintf("\\%d", secret));
571 } 575 }
572 576
573 } // namespace IPC 577 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_win.h ('k') | ipc/ipc_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698