| 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/command_line.h" |
| 10 #include "base/environment.h" |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
| 12 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
| 13 #include "sandbox/sandbox_export.h" | 14 #include "sandbox/sandbox_export.h" |
| 14 | 15 |
| 15 namespace sandbox { | 16 namespace sandbox { |
| 16 | 17 |
| 17 // Helper class to use the setuid sandbox. This class is to be used both | 18 // Helper class to use the setuid sandbox. This class is to be used both |
| 18 // before launching the setuid helper and after being executed through the | 19 // before launching the setuid helper and after being executed through the |
| 19 // setuid helper. | 20 // setuid helper. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 // All instantation should go through this factory method. | 46 // All instantation should go through this factory method. |
| 46 static class SetuidSandboxClient* Create(); | 47 static class SetuidSandboxClient* Create(); |
| 47 ~SetuidSandboxClient(); | 48 ~SetuidSandboxClient(); |
| 48 | 49 |
| 49 // Close the dummy file descriptor leftover from the sandbox ABI. | 50 // Close the dummy file descriptor leftover from the sandbox ABI. |
| 50 void CloseDummyFile(); | 51 void CloseDummyFile(); |
| 51 // Ask the setuid helper over the setuid sandbox IPC channel to chroot() us | 52 // Ask the setuid helper over the setuid sandbox IPC channel to chroot() us |
| 52 // to an empty directory. | 53 // to an empty directory. |
| 53 // Will only work if we have been launched through the setuid helper. | 54 // Will only work if we have been launched through the setuid helper. |
| 54 bool ChrootMe(); | 55 bool ChrootMe(); |
| 55 // When a new PID namespace is created, the process with pid == 1 should | |
| 56 // assume the role of init. | |
| 57 // See sandbox/linux/services/init_process_reaper.h for more information | |
| 58 // on this API. | |
| 59 bool CreateInitProcessReaper(base::Closure* post_fork_parent_callback); | |
| 60 | 56 |
| 61 // Did we get launched through an up to date setuid binary ? | 57 // Did we get launched through an up to date setuid binary ? |
| 62 bool IsSuidSandboxUpToDate() const; | 58 bool IsSuidSandboxUpToDate() const; |
| 63 // Did we get launched through the setuid helper ? | 59 // Did we get launched through the setuid helper ? |
| 64 bool IsSuidSandboxChild() const; | 60 bool IsSuidSandboxChild() const; |
| 65 // Did the setuid helper create a new PID namespace ? | 61 // Did the setuid helper create a new PID namespace ? |
| 66 bool IsInNewPIDNamespace() const; | 62 bool IsInNewPIDNamespace() const; |
| 67 // Did the setuid helper create a new network namespace ? | 63 // Did the setuid helper create a new network namespace ? |
| 68 bool IsInNewNETNamespace() const; | 64 bool IsInNewNETNamespace() const; |
| 69 // Are we done and fully sandboxed ? | 65 // Are we done and fully sandboxed ? |
| (...skipping 27 matching lines...) Expand all Loading... |
| 97 // Holds the environment. Will never be NULL. | 93 // Holds the environment. Will never be NULL. |
| 98 base::Environment* env_; | 94 base::Environment* env_; |
| 99 bool sandboxed_; | 95 bool sandboxed_; |
| 100 | 96 |
| 101 DISALLOW_COPY_AND_ASSIGN(SetuidSandboxClient); | 97 DISALLOW_COPY_AND_ASSIGN(SetuidSandboxClient); |
| 102 }; | 98 }; |
| 103 | 99 |
| 104 } // namespace sandbox | 100 } // namespace sandbox |
| 105 | 101 |
| 106 #endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ | 102 #endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ |
| OLD | NEW |