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

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

Issue 10807059: Refactor the setuid sandbox client code to its own class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SANDBOX_LINUX_SUID_SUID_CLIENT_H_
6 #define SANDBOX_LINUX_SUID_SUID_CLIENT_H_
7
8 #include "base/basictypes.h"
9 #include "base/environment.h"
10
11 namespace sandbox {
12
13 // Helper class to use the setuid sandbox. This class is to be used both
14 // before launching the setuid helper and after being executed through the
15 // setuid helper.
16 //
17 // A typical use would be:
18 // 1. The browser calls SetupLaunchEnvironment()
19 // 2. The browser launches a renderer through the setuid sandbox.
20 // 3. The renderer requests being chroot-ed through ChrootMe() and
21 // requests other sandboxing status via the status functions.
22 class SetuidSandboxClient {
23 public:
24 // All instantation should go through this factory method.
25 static class SetuidSandboxClient* Create();
26 ~SetuidSandboxClient();
27
28 // Ask the setuid helper over the setuid sandbox IPC channel to chroot() us
29 // to an empty directory.
30 // Will only work if we have been launched through the setuid helper.
31 bool ChrootMe();
32 // Did we get launched through an up to date setuid binary ?
Markus (顧孟勤) 2012/07/23 21:06:30 Minor nit. I would put blank lines here to make th
jln (very slow on Chromium) 2012/07/23 21:32:15 Done. I've put one to separate ChrootMe from the I
33 bool IsSuidSandboxUpToDate() const;
34 // Did we get launched through the setuid helper ?
35 bool IsSuidSandboxChild() const;
36 // Did the setuid helper create a new PID namespace ?
37 bool IsInNewPIDNamespace() const;
38 // Did the setuid helper create a new network namespace ?
39 bool IsInNewNETNamespace() const;
40
41 // Set-up the environment. This should be done prior to launching the setuid
42 // helper.
43 void SetupLaunchEnvironment();
44
45 private:
46 // Holds the environment. Will never be NULL.
47 base::Environment* env_;
48 DISALLOW_IMPLICIT_CONSTRUCTORS(SetuidSandboxClient);
49 };
50
51 } // namespace sandbox
52
53 #endif // SANDBOX_LINUX_SUID_SUID_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698