Chromium Code Reviews| 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 "remoting/host/win/elevated_controller.h" | 5 #include "remoting/host/win/elevated_controller.h" |
| 6 | 6 |
| 7 #include "base/file_version_info.h" | 7 #include "base/file_version_info.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 const char kConfigFileSecurityDescriptor[] = | 46 const char kConfigFileSecurityDescriptor[] = |
| 47 "O:BAG:BAD:(A;;GA;;;SY)(A;;GA;;;BA)"; | 47 "O:BAG:BAD:(A;;GA;;;SY)(A;;GA;;;BA)"; |
| 48 | 48 |
| 49 const char kUnprivilegedConfigFileSecurityDescriptor[] = | 49 const char kUnprivilegedConfigFileSecurityDescriptor[] = |
| 50 "O:BAG:BAD:(A;;GA;;;SY)(A;;GA;;;BA)(A;;GR;;;AU)"; | 50 "O:BAG:BAD:(A;;GA;;;SY)(A;;GA;;;BA)(A;;GR;;;AU)"; |
| 51 | 51 |
| 52 // Configuration keys. | 52 // Configuration keys. |
| 53 const char kHostId[] = "host_id"; | 53 const char kHostId[] = "host_id"; |
| 54 const char kXmppLogin[] = "xmpp_login"; | 54 const char kXmppLogin[] = "xmpp_login"; |
| 55 const char kHostOwner[] = "host_owner"; | 55 const char kHostOwner[] = "host_owner"; |
| 56 const char kHostOwnerEmail[] = "host_owner_email"; | |
|
Sergey Ulanov
2014/09/25 02:28:46
I'm not sure why these values need to be duplicate
rmsousa
2014/09/27 01:42:17
Done.
| |
| 56 const char kHostSecretHash[] = "host_secret_hash"; | 57 const char kHostSecretHash[] = "host_secret_hash"; |
| 57 | 58 |
| 58 // The configuration keys that cannot be specified in UpdateConfig(). | 59 // The configuration keys that cannot be specified in UpdateConfig(). |
| 59 const char* const kReadonlyKeys[] = { kHostId, kHostOwner, kXmppLogin }; | 60 const char* const kReadonlyKeys[] = { |
| 61 kHostId, kHostOwner, kHostOwnerEmail, kXmppLogin }; | |
| 60 | 62 |
| 61 // The configuration keys whose values may be read by GetConfig(). | 63 // The configuration keys whose values may be read by GetConfig(). |
| 62 const char* const kUnprivilegedConfigKeys[] = { kHostId, kXmppLogin }; | 64 const char* const kUnprivilegedConfigKeys[] = { kHostId, kXmppLogin }; |
| 63 | 65 |
| 64 // Determines if the client runs in the security context that allows performing | 66 // Determines if the client runs in the security context that allows performing |
| 65 // administrative tasks (i.e. the user belongs to the adminstrators group and | 67 // administrative tasks (i.e. the user belongs to the adminstrators group and |
| 66 // the client runs elevated). | 68 // the client runs elevated). |
| 67 bool IsClientAdmin() { | 69 bool IsClientAdmin() { |
| 68 HRESULT hr = CoImpersonateClient(); | 70 HRESULT hr = CoImpersonateClient(); |
| 69 if (FAILED(hr)) { | 71 if (FAILED(hr)) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 // Extract the configuration data that the user will verify. | 214 // Extract the configuration data that the user will verify. |
| 213 scoped_ptr<base::Value> config_value(base::JSONReader::Read(content)); | 215 scoped_ptr<base::Value> config_value(base::JSONReader::Read(content)); |
| 214 if (!config_value.get()) { | 216 if (!config_value.get()) { |
| 215 return E_FAIL; | 217 return E_FAIL; |
| 216 } | 218 } |
| 217 base::DictionaryValue* config_dict = NULL; | 219 base::DictionaryValue* config_dict = NULL; |
| 218 if (!config_value->GetAsDictionary(&config_dict)) { | 220 if (!config_value->GetAsDictionary(&config_dict)) { |
| 219 return E_FAIL; | 221 return E_FAIL; |
| 220 } | 222 } |
| 221 std::string email; | 223 std::string email; |
| 222 if (!config_dict->GetString(kHostOwner, &email)) { | 224 if (!config_dict->GetString(kHostOwnerEmail, &email)) { |
| 223 if (!config_dict->GetString(kXmppLogin, &email)) { | 225 if (!config_dict->GetString(kHostOwner, &email)) { |
| 224 return E_FAIL; | 226 if (!config_dict->GetString(kXmppLogin, &email)) { |
| 227 return E_FAIL; | |
| 228 } | |
| 225 } | 229 } |
| 226 } | 230 } |
| 227 std::string host_id, host_secret_hash; | 231 std::string host_id, host_secret_hash; |
| 228 if (!config_dict->GetString(kHostId, &host_id) || | 232 if (!config_dict->GetString(kHostId, &host_id) || |
| 229 !config_dict->GetString(kHostSecretHash, &host_secret_hash)) { | 233 !config_dict->GetString(kHostSecretHash, &host_secret_hash)) { |
| 230 return E_FAIL; | 234 return E_FAIL; |
| 231 } | 235 } |
| 232 | 236 |
| 233 // Ask the user to verify the configuration (unless the client is admin | 237 // Ask the user to verify the configuration (unless the client is admin |
| 234 // already). | 238 // already). |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 << "' service"; | 524 << "' service"; |
| 521 | 525 |
| 522 return HRESULT_FROM_WIN32(error); | 526 return HRESULT_FROM_WIN32(error); |
| 523 } | 527 } |
| 524 | 528 |
| 525 service_out->Set(service.Take()); | 529 service_out->Set(service.Take()); |
| 526 return S_OK; | 530 return S_OK; |
| 527 } | 531 } |
| 528 | 532 |
| 529 } // namespace remoting | 533 } // namespace remoting |
| OLD | NEW |