| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sandbox/mac/launchd_interception_server.h" | 5 #include "sandbox/mac/launchd_interception_server.h" |
| 6 | 6 |
| 7 #include <servers/bootstrap.h> | 7 #include <servers/bootstrap.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 LaunchdInterceptionServer::LaunchdInterceptionServer( | 26 LaunchdInterceptionServer::LaunchdInterceptionServer( |
| 27 const BootstrapSandbox* sandbox) | 27 const BootstrapSandbox* sandbox) |
| 28 : sandbox_(sandbox), | 28 : sandbox_(sandbox), |
| 29 xpc_launchd_(false), | 29 xpc_launchd_(false), |
| 30 sandbox_port_(MACH_PORT_NULL), | 30 sandbox_port_(MACH_PORT_NULL), |
| 31 compat_shim_(OSCompatibility::CreateForPlatform()) { | 31 compat_shim_(OSCompatibility::CreateForPlatform()) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 LaunchdInterceptionServer::~LaunchdInterceptionServer() { | 34 LaunchdInterceptionServer::~LaunchdInterceptionServer() { |
| 35 message_server_->Shutdown(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 bool LaunchdInterceptionServer::Initialize(mach_port_t server_receive_right) { | 38 bool LaunchdInterceptionServer::Initialize(mach_port_t server_receive_right) { |
| 38 mach_port_t task = mach_task_self(); | 39 mach_port_t task = mach_task_self(); |
| 39 kern_return_t kr; | 40 kern_return_t kr; |
| 40 | 41 |
| 41 // Allocate the dummy sandbox port. | 42 // Allocate the dummy sandbox port. |
| 42 mach_port_t port; | 43 mach_port_t port; |
| 43 if ((kr = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &port)) != | 44 if ((kr = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &port)) != |
| 44 KERN_SUCCESS) { | 45 KERN_SUCCESS) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (xpc_launchd_) { | 173 if (xpc_launchd_) { |
| 173 // xpc_dictionary_set_mach_send increments the send right count. | 174 // xpc_dictionary_set_mach_send increments the send right count. |
| 174 xpc_dictionary_set_mach_send(request.xpc, "domain-port", | 175 xpc_dictionary_set_mach_send(request.xpc, "domain-port", |
| 175 sandbox_->real_bootstrap_port()); | 176 sandbox_->real_bootstrap_port()); |
| 176 } | 177 } |
| 177 | 178 |
| 178 message_server_->ForwardMessage(request, sandbox_->real_bootstrap_port()); | 179 message_server_->ForwardMessage(request, sandbox_->real_bootstrap_port()); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace sandbox | 182 } // namespace sandbox |
| OLD | NEW |