| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ | 5 #ifndef SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ |
| 6 #define SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ | 6 #define SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 // Link errors are tedious to track, raise a compile-time error instead. | 9 // Link errors are tedious to track, raise a compile-time error instead. |
| 10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
| 11 #error "Android is not supported." | 11 #error "Android is not supported." |
| 12 #endif // defined(OS_ANDROID). | 12 #endif // defined(OS_ANDROID). |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "sandbox/linux/sandbox_export.h" |
| 18 | 19 |
| 19 namespace sandbox { | 20 namespace sandbox { |
| 20 | 21 |
| 21 // This class should be used to manipulate the current process' credentials. | 22 // This class should be used to manipulate the current process' credentials. |
| 22 // It is currently a stub used to manipulate POSIX.1e capabilities as | 23 // It is currently a stub used to manipulate POSIX.1e capabilities as |
| 23 // implemented by the Linux kernel. | 24 // implemented by the Linux kernel. |
| 24 class Credentials { | 25 class SANDBOX_EXPORT Credentials { |
| 25 public: | 26 public: |
| 26 Credentials(); | 27 Credentials(); |
| 27 ~Credentials(); | 28 ~Credentials(); |
| 28 | 29 |
| 29 // Checks whether the current process has any directory file descriptor open. | 30 // Checks whether the current process has any directory file descriptor open. |
| 30 // Directory file descriptors are "capabilities" that would let a process use | 31 // Directory file descriptors are "capabilities" that would let a process use |
| 31 // system calls such as openat() to bypass restrictions such as | 32 // system calls such as openat() to bypass restrictions such as |
| 32 // DropFileSystemAccess(). | 33 // DropFileSystemAccess(). |
| 33 // Sometimes it's useful to call HasOpenDirectory() after file system access | 34 // Sometimes it's useful to call HasOpenDirectory() after file system access |
| 34 // has been dropped. In this case, |proc_fd| should be a file descriptor to | 35 // has been dropped. In this case, |proc_fd| should be a file descriptor to |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // process has any directory file descriptor open. | 78 // process has any directory file descriptor open. |
| 78 bool DropFileSystemAccess(); | 79 bool DropFileSystemAccess(); |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 DISALLOW_COPY_AND_ASSIGN(Credentials); | 82 DISALLOW_COPY_AND_ASSIGN(Credentials); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace sandbox. | 85 } // namespace sandbox. |
| 85 | 86 |
| 86 #endif // SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ | 87 #endif // SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ |
| OLD | NEW |