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

Side by Side Diff: ipc/ipc_channel_win.cc

Issue 1979533003: Fix an attachment broker race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/attachment_broker_privileged_win.cc ('k') | tools/metrics/histograms/histograms.xml » ('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 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return; 256 return;
257 } 257 }
258 258
259 peer_pid_ = claimed_pid; 259 peer_pid_ = claimed_pid;
260 // Validation completed. 260 // Validation completed.
261 validate_client_ = false; 261 validate_client_ = false;
262 262
263 listener()->OnChannelConnected(claimed_pid); 263 listener()->OnChannelConnected(claimed_pid);
264 264
265 FlushPrelimQueue(); 265 FlushPrelimQueue();
266
267 if (IsAttachmentBrokerEndpoint() &&
268 AttachmentBroker::GetGlobal()->IsPrivilegedBroker()) {
269 AttachmentBroker::GetGlobal()->ReceivedPeerPid(claimed_pid);
270 }
266 } 271 }
267 272
268 base::ProcessId ChannelWin::GetSenderPID() { 273 base::ProcessId ChannelWin::GetSenderPID() {
269 return GetPeerPID(); 274 return GetPeerPID();
270 } 275 }
271 276
272 bool ChannelWin::IsAttachmentBrokerEndpoint() { 277 bool ChannelWin::IsAttachmentBrokerEndpoint() {
273 return is_attachment_broker_endpoint(); 278 return is_attachment_broker_endpoint();
274 } 279 }
275 280
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 int secret; 606 int secret;
602 do { // Guarantee we get a non-zero value. 607 do { // Guarantee we get a non-zero value.
603 secret = base::RandInt(0, std::numeric_limits<int>::max()); 608 secret = base::RandInt(0, std::numeric_limits<int>::max());
604 } while (secret == 0); 609 } while (secret == 0);
605 610
606 id.append(GenerateUniqueRandomChannelID()); 611 id.append(GenerateUniqueRandomChannelID());
607 return id.append(base::StringPrintf("\\%d", secret)); 612 return id.append(base::StringPrintf("\\%d", secret));
608 } 613 }
609 614
610 } // namespace IPC 615 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/attachment_broker_privileged_win.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698