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 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" |
| 6 |
5 #include <sys/types.h> | 7 #include <sys/types.h> |
6 #include <sys/wait.h> | 8 #include <sys/wait.h> |
7 #include <unistd.h> | 9 #include <unistd.h> |
8 | 10 |
9 #include "base/environment.h" | 11 #include "base/environment.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/posix/eintr_wrapper.h" | 14 #include "base/posix/eintr_wrapper.h" |
13 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
14 | 16 |
15 #include "sandbox/linux/services/init_process_reaper.h" | 17 #include "sandbox/linux/services/init_process_reaper.h" |
16 #include "sandbox/linux/suid/common/sandbox.h" | 18 #include "sandbox/linux/suid/common/sandbox.h" |
17 #include "sandbox/linux/suid/common/suid_unsafe_environment_variables.h" | 19 #include "sandbox/linux/suid/common/suid_unsafe_environment_variables.h" |
18 #include "setuid_sandbox_client.h" | |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Set an environment variable that reflects the API version we expect from the | 23 // Set an environment variable that reflects the API version we expect from the |
23 // setuid sandbox. Old versions of the sandbox will ignore this. | 24 // setuid sandbox. Old versions of the sandbox will ignore this. |
24 void SetSandboxAPIEnvironmentVariable(base::Environment* env) { | 25 void SetSandboxAPIEnvironmentVariable(base::Environment* env) { |
25 env->SetVar(sandbox::kSandboxEnvironmentApiRequest, | 26 env->SetVar(sandbox::kSandboxEnvironmentApiRequest, |
26 base::IntToString(sandbox::kSUIDSandboxApiNumber)); | 27 base::IntToString(sandbox::kSUIDSandboxApiNumber)); |
27 } | 28 } |
28 | 29 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 bool SetuidSandboxClient::IsSandboxed() const { | 176 bool SetuidSandboxClient::IsSandboxed() const { |
176 return sandboxed_; | 177 return sandboxed_; |
177 } | 178 } |
178 | 179 |
179 void SetuidSandboxClient::SetupLaunchEnvironment() { | 180 void SetuidSandboxClient::SetupLaunchEnvironment() { |
180 SaveSUIDUnsafeEnvironmentVariables(env_); | 181 SaveSUIDUnsafeEnvironmentVariables(env_); |
181 SetSandboxAPIEnvironmentVariable(env_); | 182 SetSandboxAPIEnvironmentVariable(env_); |
182 } | 183 } |
183 | 184 |
184 } // namespace sandbox | 185 } // namespace sandbox |
OLD | NEW |