Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: sandbox/linux/suid/client/setuid_sandbox_client.h

Issue 885673007: Minor refactoring of setuid_sandbox_client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | sandbox/linux/suid/client/setuid_sandbox_client.cc » ('j') | sandbox/linux/suid/client/setuid_sandbox_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698