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 #ifndef SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ | 5 #ifndef SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ |
6 #define SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ | 6 #define SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
| 10 #include "sandbox/linux/sandbox_export.h" |
10 | 11 |
11 namespace base { class Environment; } | 12 namespace base { class Environment; } |
12 | 13 |
13 namespace sandbox { | 14 namespace sandbox { |
14 | 15 |
15 // Helper class to use the setuid sandbox. This class is to be used both | 16 // Helper class to use the setuid sandbox. This class is to be used both |
16 // before launching the setuid helper and after being executed through the | 17 // before launching the setuid helper and after being executed through the |
17 // setuid helper. | 18 // setuid helper. |
18 // | 19 // |
19 // A typical use would be: | 20 // A typical use would be: |
20 // 1. The browser calls SetupLaunchEnvironment() | 21 // 1. The browser calls SetupLaunchEnvironment() |
21 // 2. The browser launches a renderer through the setuid sandbox. | 22 // 2. The browser launches a renderer through the setuid sandbox. |
22 // 3. The renderer requests being chroot-ed through ChrootMe() and | 23 // 3. The renderer requests being chroot-ed through ChrootMe() and |
23 // requests other sandboxing status via the status functions. | 24 // requests other sandboxing status via the status functions. |
24 class SetuidSandboxClient { | 25 class SANDBOX_EXPORT SetuidSandboxClient { |
25 public: | 26 public: |
26 // All instantation should go through this factory method. | 27 // All instantation should go through this factory method. |
27 static class SetuidSandboxClient* Create(); | 28 static class SetuidSandboxClient* Create(); |
28 ~SetuidSandboxClient(); | 29 ~SetuidSandboxClient(); |
29 | 30 |
30 // Ask the setuid helper over the setuid sandbox IPC channel to chroot() us | 31 // Ask the setuid helper over the setuid sandbox IPC channel to chroot() us |
31 // to an empty directory. | 32 // to an empty directory. |
32 // Will only work if we have been launched through the setuid helper. | 33 // Will only work if we have been launched through the setuid helper. |
33 bool ChrootMe(); | 34 bool ChrootMe(); |
34 // When a new PID namespace is created, the process with pid == 1 should | 35 // When a new PID namespace is created, the process with pid == 1 should |
(...skipping 21 matching lines...) Expand all Loading... |
56 // Holds the environment. Will never be NULL. | 57 // Holds the environment. Will never be NULL. |
57 base::Environment* env_; | 58 base::Environment* env_; |
58 bool sandboxed_; | 59 bool sandboxed_; |
59 DISALLOW_IMPLICIT_CONSTRUCTORS(SetuidSandboxClient); | 60 DISALLOW_IMPLICIT_CONSTRUCTORS(SetuidSandboxClient); |
60 }; | 61 }; |
61 | 62 |
62 } // namespace sandbox | 63 } // namespace sandbox |
63 | 64 |
64 #endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ | 65 #endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ |
65 | 66 |
OLD | NEW |