| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SRC_RESTRICTED_TOKEN_H_ | 5 #ifndef SANDBOX_SRC_RESTRICTED_TOKEN_H_ |
| 6 #define SANDBOX_SRC_RESTRICTED_TOKEN_H_ | 6 #define SANDBOX_SRC_RESTRICTED_TOKEN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/strings/string16.h" |
| 12 #include "sandbox/win/src/restricted_token_utils.h" | 13 #include "sandbox/win/src/restricted_token_utils.h" |
| 13 #include "sandbox/win/src/security_level.h" | 14 #include "sandbox/win/src/security_level.h" |
| 14 #include "sandbox/win/src/sid.h" | 15 #include "sandbox/win/src/sid.h" |
| 15 | 16 |
| 16 // Flags present in the Group SID list. These 2 flags are new in Windows Vista | 17 // Flags present in the Group SID list. These 2 flags are new in Windows Vista |
| 17 #ifndef SE_GROUP_INTEGRITY | 18 #ifndef SE_GROUP_INTEGRITY |
| 18 #define SE_GROUP_INTEGRITY (0x00000020L) | 19 #define SE_GROUP_INTEGRITY (0x00000020L) |
| 19 #endif | 20 #endif |
| 20 #ifndef SE_GROUP_INTEGRITY_ENABLED | 21 #ifndef SE_GROUP_INTEGRITY_ENABLED |
| 21 #define SE_GROUP_INTEGRITY_ENABLED (0x00000040L) | 22 #define SE_GROUP_INTEGRITY_ENABLED (0x00000040L) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Lists all privileges in the token and add them to the list of privileges | 113 // Lists all privileges in the token and add them to the list of privileges |
| 113 // to remove except for those present in the exceptions parameter. If | 114 // to remove except for those present in the exceptions parameter. If |
| 114 // there is no exception needed, the caller can pass an empty list or NULL | 115 // there is no exception needed, the caller can pass an empty list or NULL |
| 115 // for the exceptions parameter. | 116 // for the exceptions parameter. |
| 116 // | 117 // |
| 117 // If the function succeeds, the return value is ERROR_SUCCESS. If the | 118 // If the function succeeds, the return value is ERROR_SUCCESS. If the |
| 118 // function fails, the return value is the win32 error code corresponding to | 119 // function fails, the return value is the win32 error code corresponding to |
| 119 // the error. | 120 // the error. |
| 120 // | 121 // |
| 121 // Sample usage: | 122 // Sample usage: |
| 122 // std::vector<std::wstring> privilege_exceptions; | 123 // std::vector<base::string16> privilege_exceptions; |
| 123 // privilege_exceptions.push_back(SE_CHANGE_NOTIFY_NAME); | 124 // privilege_exceptions.push_back(SE_CHANGE_NOTIFY_NAME); |
| 124 // restricted_token.DeleteAllPrivileges(&privilege_exceptions); | 125 // restricted_token.DeleteAllPrivileges(&privilege_exceptions); |
| 125 unsigned DeleteAllPrivileges( | 126 unsigned DeleteAllPrivileges( |
| 126 const std::vector<std::wstring> *exceptions); | 127 const std::vector<base::string16> *exceptions); |
| 127 | 128 |
| 128 // Adds a privilege to the list of privileges to remove in the restricted | 129 // Adds a privilege to the list of privileges to remove in the restricted |
| 129 // token. | 130 // token. |
| 130 // Parameter: privilege is the privilege name to remove. This is the string | 131 // Parameter: privilege is the privilege name to remove. This is the string |
| 131 // representing the privilege. (e.g. "SeChangeNotifyPrivilege"). | 132 // representing the privilege. (e.g. "SeChangeNotifyPrivilege"). |
| 132 // If the function succeeds, the return value is ERROR_SUCCESS. If the | 133 // If the function succeeds, the return value is ERROR_SUCCESS. If the |
| 133 // function fails, the return value is the win32 error code corresponding to | 134 // function fails, the return value is the win32 error code corresponding to |
| 134 // the error. | 135 // the error. |
| 135 // | 136 // |
| 136 // Sample usage: | 137 // Sample usage: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 IntegrityLevel integrity_level_; | 190 IntegrityLevel integrity_level_; |
| 190 // Tells if the object is initialized or not (if Init() has been called) | 191 // Tells if the object is initialized or not (if Init() has been called) |
| 191 bool init_; | 192 bool init_; |
| 192 | 193 |
| 193 DISALLOW_COPY_AND_ASSIGN(RestrictedToken); | 194 DISALLOW_COPY_AND_ASSIGN(RestrictedToken); |
| 194 }; | 195 }; |
| 195 | 196 |
| 196 } // namespace sandbox | 197 } // namespace sandbox |
| 197 | 198 |
| 198 #endif // SANDBOX_SRC_RESTRICTED_TOKEN_H_ | 199 #endif // SANDBOX_SRC_RESTRICTED_TOKEN_H_ |
| OLD | NEW |