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 <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/wait.h> | 9 #include <sys/wait.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "base/environment.h" | 15 #include "base/environment.h" |
16 #include "base/files/scoped_file.h" | 16 #include "base/files/scoped_file.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/posix/eintr_wrapper.h" | 18 #include "base/posix/eintr_wrapper.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "sandbox/linux/suid/common/sandbox.h" | 20 #include "sandbox/linux/suid/common/sandbox.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 bool IsFileSystemAccessDenied() { | 24 bool IsFileSystemAccessDenied() { |
25 base::ScopedFD root_dir(HANDLE_EINTR(open("/", O_RDONLY))); | 25 base::ScopedFD proc_self_exe(HANDLE_EINTR(open("/proc/self/exe", O_RDONLY))); |
mdempsky
2017/01/10 22:48:23
Since we decided to not support root+sandbox, can
Tom (Use chromium acct)
2017/01/10 23:32:03
Unfortunately no, since the dialog box gets shown
mdempsky
2017/01/11 22:20:15
That is unfortunate. Can you at least add a commen
| |
26 return !root_dir.is_valid(); | 26 return !proc_self_exe.is_valid(); |
27 } | 27 } |
28 | 28 |
29 int GetHelperApi(base::Environment* env) { | 29 int GetHelperApi(base::Environment* env) { |
30 std::string api_string; | 30 std::string api_string; |
31 int api_number = 0; // Assume API version 0 if no environment was found. | 31 int api_number = 0; // Assume API version 0 if no environment was found. |
32 if (env->GetVar(sandbox::kSandboxEnvironmentApiProvides, &api_string) && | 32 if (env->GetVar(sandbox::kSandboxEnvironmentApiProvides, &api_string) && |
33 !base::StringToInt(api_string, &api_number)) { | 33 !base::StringToInt(api_string, &api_number)) { |
34 // It's an error if we could not convert the API number. | 34 // It's an error if we could not convert the API number. |
35 api_number = -1; | 35 api_number = -1; |
36 } | 36 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 | 142 |
143 bool SetuidSandboxClient::IsInNewNETNamespace() const { | 143 bool SetuidSandboxClient::IsInNewNETNamespace() const { |
144 return env_->HasVar(kSandboxNETNSEnvironmentVarName); | 144 return env_->HasVar(kSandboxNETNSEnvironmentVarName); |
145 } | 145 } |
146 | 146 |
147 bool SetuidSandboxClient::IsSandboxed() const { | 147 bool SetuidSandboxClient::IsSandboxed() const { |
148 return sandboxed_; | 148 return sandboxed_; |
149 } | 149 } |
150 | 150 |
151 } // namespace sandbox | 151 } // namespace sandbox |
OLD | NEW |