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 <memory> |
| 9 |
8 #include "base/environment.h" | 10 #include "base/environment.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "sandbox/sandbox_export.h" | 12 #include "sandbox/sandbox_export.h" |
12 | 13 |
13 namespace sandbox { | 14 namespace sandbox { |
14 | 15 |
15 // Helper class to use the setuid sandbox. This class is to be used | 16 // Helper class to use the setuid sandbox. This class is to be used |
16 // after being executed through the setuid helper. | 17 // after being executed through the setuid helper. |
17 // This class is difficult to use. It has been created by refactoring very old | 18 // This class is difficult to use. It has been created by refactoring very old |
18 // code scathered through the Chromium code base. | 19 // code scathered through the Chromium code base. |
19 // | 20 // |
20 // A typical use for "A" launching a sandboxed process "B" would be: | 21 // A typical use for "A" launching a sandboxed process "B" would be: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 bool IsInNewPIDNamespace() const; | 54 bool IsInNewPIDNamespace() const; |
54 // Did the setuid helper create a new network namespace ? | 55 // Did the setuid helper create a new network namespace ? |
55 bool IsInNewNETNamespace() const; | 56 bool IsInNewNETNamespace() const; |
56 // Are we done and fully sandboxed ? | 57 // Are we done and fully sandboxed ? |
57 bool IsSandboxed() const; | 58 bool IsSandboxed() const; |
58 | 59 |
59 private: | 60 private: |
60 explicit SetuidSandboxClient(base::Environment* env); | 61 explicit SetuidSandboxClient(base::Environment* env); |
61 | 62 |
62 // Holds the environment. Will never be NULL. | 63 // Holds the environment. Will never be NULL. |
63 scoped_ptr<base::Environment> env_; | 64 std::unique_ptr<base::Environment> env_; |
64 bool sandboxed_; | 65 bool sandboxed_; |
65 | 66 |
66 DISALLOW_COPY_AND_ASSIGN(SetuidSandboxClient); | 67 DISALLOW_COPY_AND_ASSIGN(SetuidSandboxClient); |
67 }; | 68 }; |
68 | 69 |
69 } // namespace sandbox | 70 } // namespace sandbox |
70 | 71 |
71 #endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ | 72 #endif // SANDBOX_LINUX_SUID_SETUID_SANDBOX_CLIENT_H_ |
OLD | NEW |