| 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 #ifndef SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ | 5 #ifndef SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ |
| 6 #define SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ | 6 #define SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include <dispatch/dispatch.h> | 10 #include <dispatch/dispatch.h> |
| 9 | 11 |
| 10 #include "base/mac/scoped_mach_port.h" | 12 #include "base/mac/scoped_mach_port.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "sandbox/mac/message_server.h" | 13 #include "sandbox/mac/message_server.h" |
| 13 | 14 |
| 14 namespace sandbox { | 15 namespace sandbox { |
| 15 | 16 |
| 16 class BootstrapSandbox; | 17 class BootstrapSandbox; |
| 17 struct BootstrapSandboxPolicy; | 18 struct BootstrapSandboxPolicy; |
| 18 class OSCompatibility; | 19 class OSCompatibility; |
| 19 | 20 |
| 20 // This class is used to run a Mach IPC message server. This server can | 21 // This class is used to run a Mach IPC message server. This server can |
| 21 // hold the receive right for a bootstrap_port of a process, and it filters | 22 // hold the receive right for a bootstrap_port of a process, and it filters |
| (...skipping 25 matching lines...) Expand all Loading... |
| 47 // it replies with an error. | 48 // it replies with an error. |
| 48 void HandleSwapInteger(IPCMessage request); | 49 void HandleSwapInteger(IPCMessage request); |
| 49 | 50 |
| 50 // Forwards the original |request| on to real bootstrap server for handling. | 51 // Forwards the original |request| on to real bootstrap server for handling. |
| 51 void ForwardMessage(IPCMessage request); | 52 void ForwardMessage(IPCMessage request); |
| 52 | 53 |
| 53 // The sandbox for which this message server is running. | 54 // The sandbox for which this message server is running. |
| 54 const BootstrapSandbox* sandbox_; | 55 const BootstrapSandbox* sandbox_; |
| 55 | 56 |
| 56 // The Mach IPC server. | 57 // The Mach IPC server. |
| 57 scoped_ptr<MessageServer> message_server_; | 58 std::unique_ptr<MessageServer> message_server_; |
| 58 | 59 |
| 59 // Whether or not the system is using an XPC-based launchd. | 60 // Whether or not the system is using an XPC-based launchd. |
| 60 bool xpc_launchd_; | 61 bool xpc_launchd_; |
| 61 | 62 |
| 62 // The Mach port handed out in reply to denied look up requests. All denied | 63 // The Mach port handed out in reply to denied look up requests. All denied |
| 63 // requests share the same port, though nothing reads messages from it. | 64 // requests share the same port, though nothing reads messages from it. |
| 64 base::mac::ScopedMachReceiveRight sandbox_port_; | 65 base::mac::ScopedMachReceiveRight sandbox_port_; |
| 65 // The send right for the above |sandbox_port_|, used with | 66 // The send right for the above |sandbox_port_|, used with |
| 66 // MACH_MSG_TYPE_COPY_SEND when handing out references to the dummy port. | 67 // MACH_MSG_TYPE_COPY_SEND when handing out references to the dummy port. |
| 67 base::mac::ScopedMachSendRight sandbox_send_port_; | 68 base::mac::ScopedMachSendRight sandbox_send_port_; |
| 68 | 69 |
| 69 // The compatibility shim that handles differences in message header IDs and | 70 // The compatibility shim that handles differences in message header IDs and |
| 70 // request/reply structures between different OS X versions. | 71 // request/reply structures between different OS X versions. |
| 71 scoped_ptr<OSCompatibility> compat_shim_; | 72 std::unique_ptr<OSCompatibility> compat_shim_; |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 } // namespace sandbox | 75 } // namespace sandbox |
| 75 | 76 |
| 76 #endif // SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ | 77 #endif // SANDBOX_MAC_LAUNCHD_INTERCEPTION_SERVER_H_ |
| OLD | NEW |