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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 return false; | 47 return false; |
48 } | 48 } |
49 sandbox_port_.reset(port); | 49 sandbox_port_.reset(port); |
50 if ((kr = mach_port_insert_right(task, sandbox_port_.get(), | 50 if ((kr = mach_port_insert_right(task, sandbox_port_.get(), |
51 sandbox_port_.get(), MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS)) { | 51 sandbox_port_.get(), MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS)) { |
52 MACH_LOG(ERROR, kr) << "Failed to allocate dummy sandbox port send right."; | 52 MACH_LOG(ERROR, kr) << "Failed to allocate dummy sandbox port send right."; |
53 return false; | 53 return false; |
54 } | 54 } |
55 sandbox_send_port_.reset(sandbox_port_.get()); | 55 sandbox_send_port_.reset(sandbox_port_.get()); |
56 | 56 |
57 if (base::mac::IsOSYosemiteOrLater()) { | 57 if (base::mac::IsAtLeastOS10_10()) { |
58 message_server_.reset(new XPCMessageServer(this, server_receive_right)); | 58 message_server_.reset(new XPCMessageServer(this, server_receive_right)); |
59 xpc_launchd_ = true; | 59 xpc_launchd_ = true; |
60 } else { | 60 } else { |
61 message_server_.reset( | 61 message_server_.reset( |
62 new MachMessageServer(this, server_receive_right, kBufferSize)); | 62 new MachMessageServer(this, server_receive_right, kBufferSize)); |
63 } | 63 } |
64 return message_server_->Initialize(); | 64 return message_server_->Initialize(); |
65 } | 65 } |
66 | 66 |
67 void LaunchdInterceptionServer::DemuxMessage(IPCMessage request) { | 67 void LaunchdInterceptionServer::DemuxMessage(IPCMessage request) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if (xpc_launchd_) { | 173 if (xpc_launchd_) { |
174 // xpc_dictionary_set_mach_send increments the send right count. | 174 // xpc_dictionary_set_mach_send increments the send right count. |
175 xpc_dictionary_set_mach_send(request.xpc, "domain-port", | 175 xpc_dictionary_set_mach_send(request.xpc, "domain-port", |
176 sandbox_->real_bootstrap_port()); | 176 sandbox_->real_bootstrap_port()); |
177 } | 177 } |
178 | 178 |
179 message_server_->ForwardMessage(request, sandbox_->real_bootstrap_port()); | 179 message_server_->ForwardMessage(request, sandbox_->real_bootstrap_port()); |
180 } | 180 } |
181 | 181 |
182 } // namespace sandbox | 182 } // namespace sandbox |
OLD | NEW |