summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 21:33:37 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 21:33:37 +0000
commit93d1ae72334650435885a7e1305b33cfb42ba342 (patch)
treeb222c7f8621c589eaf6417a3ff7436a72b68fe42
parent4bb7248ccc2096b76d4ef4c77ce4a7ecc99f2d51 (diff)
downloadchromium_src-93d1ae72334650435885a7e1305b33cfb42ba342.zip
chromium_src-93d1ae72334650435885a7e1305b33cfb42ba342.tar.gz
chromium_src-93d1ae72334650435885a7e1305b33cfb42ba342.tar.bz2
Merge 74514 - Use a struct instead of a union for SandboxInterfaceInfo
BUG=72496 TEST=see bug Review URL: http://codereview.chromium.org/6483006 TBR=cpu@chromium.org Review URL: http://codereview.chromium.org/6549027 git-svn-id: svn://svn.chromium.org/chrome/branches/648/src@75638 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/client_util.h4
-rw-r--r--chrome/common/sandbox_init_wrapper_win.cc21
-rw-r--r--sandbox/src/sandbox_types.h4
3 files changed, 19 insertions, 10 deletions
diff --git a/chrome/app/client_util.h b/chrome/app/client_util.h
index b34eaf6..ae7f2a7 100644
--- a/chrome/app/client_util.h
+++ b/chrome/app/client_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,7 @@
#include <string>
namespace sandbox {
- union SandboxInterfaceInfo;
+ struct SandboxInterfaceInfo;
}
// Implements the common aspects of loading chrome.dll for both chrome and
diff --git a/chrome/common/sandbox_init_wrapper_win.cc b/chrome/common/sandbox_init_wrapper_win.cc
index 5d4399a..a18632e 100644
--- a/chrome/common/sandbox_init_wrapper_win.cc
+++ b/chrome/common/sandbox_init_wrapper_win.cc
@@ -1,10 +1,12 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/common/sandbox_init_wrapper.h"
#include "base/command_line.h"
+#include "base/logging.h"
+
#include "chrome/common/chrome_switches.h"
void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) {
@@ -12,6 +14,9 @@ void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) {
broker_services_ = info->broker_services;
target_services_ = info->target_services;
}
+ // Both interface pointers cannot be non-zero. A process can either
+ // be a target or a broker but not both.
+ DCHECK(!(target_services_ && broker_services_));
}
bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
@@ -22,12 +27,16 @@ bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
(process_type == switches::kExtensionProcess) ||
(process_type == switches::kWorkerProcess) ||
(process_type == switches::kNaClLoaderProcess) ||
- (process_type == switches::kUtilityProcess) ||
- (process_type == switches::kPluginProcess &&
- command_line.HasSwitch(switches::kSafePlugins))) {
+ (process_type == switches::kUtilityProcess)) {
+ // The above five process types must be sandboxed unless --no-sandbox
+ // is present in the command line.
if (!target_services_)
return false;
- target_services_->Init();
+ } else {
+ // Other process types might or might not be sandboxed.
+ // TODO(cpu): clean this mess.
+ if (!target_services_)
+ return true;
}
- return true;
+ return (sandbox::SBOX_ALL_OK == target_services_->Init());
}
diff --git a/sandbox/src/sandbox_types.h b/sandbox/src/sandbox_types.h
index 3346085..ee9da54 100644
--- a/sandbox/src/sandbox_types.h
+++ b/sandbox/src/sandbox_types.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -54,7 +54,7 @@ class TargetServices;
class BrokerServices;
// Contains the pointer to a target or broker service.
-union SandboxInterfaceInfo {
+struct SandboxInterfaceInfo {
TargetServices* target_services;
BrokerServices* broker_services;
};