blob: f335be02d83711090cad2c3d21876a214fb9804b [file] [log] [blame]
Elly Fong-Jonesd9a16cd2012-11-12 16:09:49 -05001// Copyright (c) 2012 The Chromium OS 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 SANDBOXED_PROCESS_H
6#define SANDBOXED_PROCESS_H
7
8#include <chromeos/process.h>
9
10namespace debugd {
11
12class SandboxedProcess : public chromeos::ProcessImpl {
13 public:
14 SandboxedProcess();
Ben Chan297c3c22013-07-17 17:34:12 -070015 virtual ~SandboxedProcess();
16
17 // Get the full path of a helper executable located at the |relative_path|
18 // relative to the debugd helpers directory. Return false if the full path
19 // is too long.
20 static bool GetHelperPath(const std::string& relative_path,
21 std::string* full_path);
Elly Fong-Jonesd9a16cd2012-11-12 16:09:49 -050022
23 virtual bool Init();
24
25 // Disable the default sandboxing for this process
26 virtual void DisableSandbox();
27
28 // Change the default sandboxing for this process
29 virtual void SandboxAs(const std::string& user, const std::string& group);
30
Elly Fong-Jones215b5622013-03-20 14:32:18 -040031 static const char *kDefaultUser;
32 static const char *kDefaultGroup;
33
Elly Fong-Jonesd9a16cd2012-11-12 16:09:49 -050034 private:
35 bool sandboxing_;
36 std::string user_;
37 std::string group_;
38};
39
40}; // namespace debugd
41
42#endif // SANDBOXED_PROCESS_H