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" | 5 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return false; | 201 return false; |
202 } | 202 } |
203 | 203 |
204 // We now consider ourselves "fully sandboxed" as far as the | 204 // We now consider ourselves "fully sandboxed" as far as the |
205 // setuid sandbox is concerned. | 205 // setuid sandbox is concerned. |
206 CHECK(IsFileSystemAccessDenied()); | 206 CHECK(IsFileSystemAccessDenied()); |
207 sandboxed_ = true; | 207 sandboxed_ = true; |
208 return true; | 208 return true; |
209 } | 209 } |
210 | 210 |
211 bool SetuidSandboxClient::CreateNewSession() { | |
212 // This could fail if the process is already a process group leader. | |
213 return 0 < setsid(); | |
214 } | |
215 | |
216 bool SetuidSandboxClient::CreateInitProcessReaper( | 211 bool SetuidSandboxClient::CreateInitProcessReaper( |
217 base::Closure* post_fork_parent_callback) { | 212 base::Closure* post_fork_parent_callback) { |
218 return sandbox::CreateInitProcessReaper(post_fork_parent_callback); | 213 return sandbox::CreateInitProcessReaper(post_fork_parent_callback); |
219 } | 214 } |
220 | 215 |
221 bool SetuidSandboxClient::IsSuidSandboxUpToDate() const { | 216 bool SetuidSandboxClient::IsSuidSandboxUpToDate() const { |
222 return GetHelperApi(env_) == kSUIDSandboxApiNumber; | 217 return GetHelperApi(env_) == kSUIDSandboxApiNumber; |
223 } | 218 } |
224 | 219 |
225 bool SetuidSandboxClient::IsSuidSandboxChild() const { | 220 bool SetuidSandboxClient::IsSuidSandboxChild() const { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // kZygoteIdFd. Fixing this requires a sandbox API change. :( | 310 // kZygoteIdFd. Fixing this requires a sandbox API change. :( |
316 fds_to_remap->push_back(std::make_pair(dummy_fd->get(), kZygoteIdFd)); | 311 fds_to_remap->push_back(std::make_pair(dummy_fd->get(), kZygoteIdFd)); |
317 } | 312 } |
318 | 313 |
319 void SetuidSandboxClient::SetupLaunchEnvironment() { | 314 void SetuidSandboxClient::SetupLaunchEnvironment() { |
320 SaveSUIDUnsafeEnvironmentVariables(env_); | 315 SaveSUIDUnsafeEnvironmentVariables(env_); |
321 SetSandboxAPIEnvironmentVariable(env_); | 316 SetSandboxAPIEnvironmentVariable(env_); |
322 } | 317 } |
323 | 318 |
324 } // namespace sandbox | 319 } // namespace sandbox |
OLD | NEW |