OLD | NEW |
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 "content/common/sandbox_win.h" | 5 #include "content/common/sandbox_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 if (base::win::GetVersion() > base::win::VERSION_XP) { | 351 if (base::win::GetVersion() > base::win::VERSION_XP) { |
352 // On 2003/Vista the initial token has to be restricted if the main | 352 // On 2003/Vista the initial token has to be restricted if the main |
353 // token is restricted. | 353 // token is restricted. |
354 initial_token = sandbox::USER_RESTRICTED_SAME_ACCESS; | 354 initial_token = sandbox::USER_RESTRICTED_SAME_ACCESS; |
355 } | 355 } |
356 | 356 |
357 policy->SetTokenLevel(initial_token, sandbox::USER_LOCKDOWN); | 357 policy->SetTokenLevel(initial_token, sandbox::USER_LOCKDOWN); |
358 // Prevents the renderers from manipulating low-integrity processes. | 358 // Prevents the renderers from manipulating low-integrity processes. |
359 policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_UNTRUSTED); | 359 policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_UNTRUSTED); |
360 | 360 |
361 bool use_winsta = !CommandLine::ForCurrentProcess()->HasSwitch( | 361 if (sandbox::SBOX_ALL_OK != policy->SetAlternateDesktop(true)) { |
362 switches::kDisableAltWinstation); | |
363 | |
364 if (sandbox::SBOX_ALL_OK != policy->SetAlternateDesktop(use_winsta)) { | |
365 DLOG(WARNING) << "Failed to apply desktop security to the renderer"; | 362 DLOG(WARNING) << "Failed to apply desktop security to the renderer"; |
366 } | 363 } |
367 | 364 |
368 return true; | 365 return true; |
369 } | 366 } |
370 | 367 |
371 // Updates the command line arguments with debug-related flags. If debug flags | 368 // Updates the command line arguments with debug-related flags. If debug flags |
372 // have been used with this process, they will be filtered and added to | 369 // have been used with this process, they will be filtered and added to |
373 // command_line as needed. | 370 // command_line as needed. |
374 void ProcessDebugFlags(CommandLine* command_line) { | 371 void ProcessDebugFlags(CommandLine* command_line) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 } | 738 } |
742 | 739 |
743 return false; | 740 return false; |
744 } | 741 } |
745 | 742 |
746 bool BrokerAddTargetPeer(HANDLE peer_process) { | 743 bool BrokerAddTargetPeer(HANDLE peer_process) { |
747 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 744 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
748 } | 745 } |
749 | 746 |
750 } // namespace content | 747 } // namespace content |
OLD | NEW |